-
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
core[minor]docs[minor]: new tool
wrapper
#5782
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
tool
wrapper
":::\n", | ||
"\n", | ||
"\n", | ||
"The [`tool`](https://v02.api.js.langchain.com/classes/langchain_core_tools.tool.html) function is used to wrap a generic JavaScript/TypeScript function, along with additional arguments that define your tool. The `tool` function will return an instance of the [`StructuredTool`](https://v02.api.js.langchain.com/classes/langchain_core_tools.StructuredTool.html) class, so it is compatible with all the existing tool calling infrastructure in the LangChain library." |
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.
nit: Remove the v02
to make it easier to update later
"## `tool` function\n", | ||
"\n", | ||
":::note\n", | ||
"Only available in `@langchain/core` version 0.2.X and above.\n", |
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.
nit: have been using lower case x
to match npm
style:
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.
Planning on replacing this before merge when I know the actual version number it'll be
langchain-core/src/messages/base.ts
Outdated
@@ -53,7 +53,7 @@ export type MessageContentComplex = | |||
| MessageContentText | |||
| MessageContentImageUrl | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
| (Record<string, any> & { type?: "text" | "image_url" | string }) | |||
| (Record<string, any> & { type?: "text" | "image_url" | "tool" | string }) |
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.
Don't think we should be touching this - it's not in our message spec
langchain-core/src/tools.ts
Outdated
description, | ||
schema: schema as RunInput, | ||
func: (input, _runManager, config) => { | ||
return Promise.resolve(func(input, config)); |
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.
Think this can just be an async
function no?
Nice! Excited for this! |
No description provided.