Skip to content

Commit

Permalink
feat(langchain): DEBUG log level for langsmith:hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
hassiebp committed Jan 21, 2025
1 parent 56fb136 commit e515f33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions langfuse-langchain/src/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import type { Document } from "@langchain/core/documents";

import type { ChatPromptClient, LangfuseSpanClient, LangfuseTraceClient, TextPromptClient } from "langfuse-core";

const LANGSMITH_HIDDEN_TAG = "langsmith:hidden";

export type LlmMessage = {
role: string;
content: BaseMessageFields["content"];
Expand Down Expand Up @@ -216,6 +218,7 @@ export class CallbackHandler extends BaseCallbackHandler {
metadata: this.joinTagsAndMetaData(tags, metadata),
input: finalInput,
version: this.version,
level: tags && tags.includes(LANGSMITH_HIDDEN_TAG) ? "DEBUG" : undefined,
});

// If there's no parent run, this is a top-level chain execution.
Expand Down Expand Up @@ -414,6 +417,7 @@ export class CallbackHandler extends BaseCallbackHandler {
modelParameters: modelParameters,
version: this.version,
prompt: registeredPrompt,
level: tags && tags.includes(LANGSMITH_HIDDEN_TAG) ? "DEBUG" : undefined,
});
}

Expand Down Expand Up @@ -500,6 +504,7 @@ export class CallbackHandler extends BaseCallbackHandler {
input: input,
metadata: this.joinTagsAndMetaData(tags, metadata),
version: this.version,
level: tags && tags.includes(LANGSMITH_HIDDEN_TAG) ? "DEBUG" : undefined,
});
} catch (e) {
this._log(e);
Expand All @@ -526,6 +531,7 @@ export class CallbackHandler extends BaseCallbackHandler {
input: query,
metadata: this.joinTagsAndMetaData(tags, metadata),
version: this.version,
level: tags && tags.includes(LANGSMITH_HIDDEN_TAG) ? "DEBUG" : undefined,
});
} catch (e) {
this._log(e);
Expand Down

0 comments on commit e515f33

Please sign in to comment.