Skip to content

Commit f96352c

Browse files
fix(core): Infer tool return types, with related tool type fixes (#8056)
Co-authored-by: Ben Burns <[email protected]>
1 parent 62f6523 commit f96352c

File tree

6 files changed

+749
-158
lines changed

6 files changed

+749
-158
lines changed

langchain-core/src/messages/tool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface ToolMessageFieldsWithToolCallId extends ToolMessageFields {
4141
* a string and wrapped in a ToolMessage.
4242
*/
4343
export interface DirectToolOutput {
44-
readonly lc_direct_tool_output: boolean;
44+
readonly lc_direct_tool_output: true;
4545
}
4646

4747
export function isDirectToolOutput(x: unknown): x is DirectToolOutput {
@@ -68,7 +68,7 @@ export class ToolMessage extends BaseMessage implements DirectToolOutput {
6868
return { tool_call_id: "tool_call_id" };
6969
}
7070

71-
lc_direct_tool_output = true;
71+
lc_direct_tool_output = true as const;
7272

7373
/**
7474
* Status of the tool invocation.

0 commit comments

Comments
 (0)