Skip to content
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

Merged
merged 20 commits into from
Jun 18, 2024
Merged

core[minor]docs[minor]: new tool wrapper #5782

merged 20 commits into from
Jun 18, 2024

Conversation

bracesproul
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Jun 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 8:50am
langchainjs-docs ✅ Ready (Inspect) Visit Preview Jun 18, 2024 8:50am

@bracesproul bracesproul changed the title Brace/tool wrapper core[minor]docs[minor]: new tool wrapper Jun 17, 2024
@bracesproul bracesproul marked this pull request as ready for review June 17, 2024 22:52
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder labels Jun 17, 2024
":::\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."
Copy link
Collaborator

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",
Copy link
Collaborator

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:

https://www.npmjs.com/package/semver

Copy link
Collaborator Author

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

@@ -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 })
Copy link
Collaborator

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

description,
schema: schema as RunInput,
func: (input, _runManager, config) => {
return Promise.resolve(func(input, config));
Copy link
Collaborator

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?

@jacoblee93
Copy link
Collaborator

Nice! Excited for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants