Create langchain tool dynamically #27821
Voileexperiments
announced in
Ideas
Replies: 1 comment
-
Langchain.js already has a DynamicTool that might help in implementing this feature. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
Provide a method to create langchain tool dynamically through data structure, other than staticly defining tools in code.
Motivation
Currently I'm using langchain to interface with an existing system which has different kinds of business objects. I'd like to make user ask the LLM to perform AI-powered search (e.g "search for all {object A} in {folder B} today where {field C} equals {value D}") on these business objects, by LLM generating a query for searching.
However, users can freely define business objects and configure fields in every logic. They are completely dynamic, so we cannot decide the search schema ahead in time, nor is it feasible to pass all business object schema into the LLM.
User might also ask about other things, so it is infeasible to strictly limit LLM to generate query.
I want to use tools to achieve this. Currently I enforce the business object limit by defining in advance which business objects are eligible for LLM to generate a search query for, then turn them into a tool for each business object. However, langchain only provides constructs that define static tools. There are no APIs to define tools on the fly and make use of them for the specific LLM request.
Please note that I DO NOT want to bind raw json directly to model, since I still want to use
InjectedToolArg
and existing langchain tool constructs.I use langchain Python.
Proposal (If applicable)
No response
Beta Was this translation helpful? Give feedback.
All reactions