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[patch]: Allow dynamic tools to be initialized with JSON schema #6306

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

jacoblee93
Copy link
Collaborator

If you init a tool with JSON schema, it will not currently validate/infer any types.

Types are starting to get pretty hairy in general but I've added some tests around them.

CC @bracesproul @nfcampos

Copy link

vercel bot commented Aug 1, 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 Aug 1, 2024 2:36am
langchainjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 2:36am

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. auto:improvement Medium size change to existing code to handle new use-cases labels Aug 1, 2024
@debajyoti-truefoundry
Copy link

debajyoti-truefoundry commented Aug 23, 2024

@jacoblee93 I tried using this feature with the ReAct agent but realized the JSON schema was not passed on to the OpenAI request.

https://github.com/dkundel/langchainjs/blob/9ec46a2f4d4598bbca4b97034b63cde4146d8809/langchain-core/src/tools/index.ts#L432

    '  "tools": [\n' +
    '    {\n' +
    '      "type": "function",\n' +
    '      "function": {\n' +
    '        "name": "postModel",\n' +
    '        "description": "Model",\n' +
    '        "parameters": {\n' +
    '          "type": "object",\n' +
    '          "properties": {},\n' +
    '          "additionalProperties": true,\n' +
    '          "$schema": "http://json-schema.org/draft-07/schema#"\n' +
    '        }\n' +
    '      }\n' +
    '    },\n' 

Even though there will be no validation, the JSON Schema should at least be forwarded to the model invocation. It would be helpful if you could let me know what the expected behaviour is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases 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