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

feat(langchain): Allow to passthrough model kwargs via createToolCallingAgent #6743

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

OlegIvaniv
Copy link
Contributor

This PR adds optional kwargs parameter to createToolCallingAgent which are passed to llm.bindTools. This is useful when user needs to specify some model provider parameters, for example to always require the model to use a tool({ tool_choice: 'required' })

Copy link

vercel bot commented Sep 12, 2024

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

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Sep 18, 2024 7:01am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Sep 18, 2024 7:01am

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. auto:improvement Medium size change to existing code to handle new use-cases labels Sep 12, 2024
Copy link
Collaborator

@bracesproul bracesproul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left one small comment, other than that this looks good!
Once fixed please re-request my review

langchain/src/agents/tool_calling/index.ts Outdated Show resolved Hide resolved
@OlegIvaniv
Copy link
Contributor Author

Thanks, @bracesproul! Can you have another look, please?

@OlegIvaniv
Copy link
Contributor Author

Ping @bracesproul :P

@jacoblee93
Copy link
Collaborator

Thanks for this @OlegIvaniv!

You should now be able to pass a model.bindTools([...], { tool_choice: "required" }) directly into the factory method - would that be sufficient for your use case?

@jacoblee93 jacoblee93 added the question Further information is requested label Sep 18, 2024
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 question Further information is requested size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants