Replies: 4 comments 4 replies
-
🤖 Your approach of using a router chain with destination chains as API chains is indeed a valid one for routing user input to one of the two chains. This method allows you to define a routing logic in the router chain and then direct the input to the appropriate destination chain based on the result of the routing logic. However, there are a few limitations to consider:
In addition to these, the router chain in LangChain also provides methods for batch processing (both synchronous and asynchronous), which can be useful if you need to process multiple inputs at once. As for alternative methods, it really depends on the specific requirements of your application. If the routing logic is simple, you could potentially use a simple if-else statement to route the input to the appropriate chain. If the routing logic is more complex, you might consider using a decision tree or a rule-based system. The router chain in LangChain, specifically the In the There is also a convenience constructor You can find more details in the source code:
As for the Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Hi, @mukunds97 , could you please mention how did you generate the API documentation. |
Beta Was this translation helpful? Give feedback.
-
Hi @mukunds97 I have two chains one is RAG Chain and other is API Chain. I am facing TypeError: unhashable type: APIChain while putting both chains in destination chains. Were you able to solve this issue or you are using some different mechanism to route instead of using MultiPromptChain? |
Beta Was this translation helpful? Give feedback.
-
Hi @mukunds97, could you mention the example code? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a requirement where in I need to route the user input to one of the 2 chains. These destination chains are API chains as I need these chains to post a request and then retrieve the appropriate answer from an API.
Currently I have made use of a router chain with destination chains being the API chains, I would like to get suggestions if this is the best approach and understand if there are any limitations which should be taken care of?
Would like to know if there are any other alternatives.
Beta Was this translation helpful? Give feedback.
All reactions