-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all[minor]: Add support for openai tools in all tool calling models #5737
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -66,6 +66,7 @@ export const config = { | |||
"utils/testing": "utils/testing/index", | |||
"utils/tiktoken": "utils/tiktoken", | |||
"utils/types": "utils/types/index", | |||
"utils/is_openai_tool": "utils/is_openai_tool", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this in an existing entrypoint? types
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to avoid fragmentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to @langchain/core/language_models/base
so it's exported from the same place as ToolDefinition
} | ||
|
||
return (tools as StructuredToolInterface[]).map((tool) => ({ | ||
name: tool.name, | ||
description: tool.description, | ||
input_schema: zodToJsonSchema(tool.schema), | ||
input_schema: zodToJsonSchema(tool.schema) as AnthropicTool.InputSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why necessary now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're technically using a different type since we import from the SDK now. Anthropic enforces type: string
in their json schemas which are always there, but they aren't typed as explicitly including it.
} else if (data.type === "content_block_delta") { | ||
} else if ( | ||
data.type === "content_block_delta" && | ||
data.delta.type === "text_delta" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why necessary now? We don't support streaming tool calls yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDK types bump req it to access text below
@@ -976,7 +993,7 @@ export class ChatAnthropicMessages< | |||
name: functionName, | |||
description: | |||
jsonSchema.description ?? "A function available to call.", | |||
input_schema: jsonSchema, | |||
input_schema: jsonSchema as AnthropicTool.InputSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer as few changes as possible
Hi @jacoblee93 , Thanks! |
hey @michaelozery this PR will be merged & released today |
anthropic[patch]: Add support for openai tool formats
community[patch]: Add support for openai tool formats with bedrock
google-common[patch]: Add support for openai tool formats
google-genai[patch]: Add support for openai tool formats
google-groq[patch]: Add support for openai tool formats
google-mistral[patch]: Add support for openai tool formats
TODO: update
createToolCallingAgent
to accept openai tools (and any other agent construction func we use)