Need for Workflow Management in AI SDK Library #4008
Unanswered
hashiromer
asked this question in
Help
Replies: 1 comment 6 replies
-
What would be the downside of using regular programming to achieve what you want? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So, I came across this and it sounds perfect for the application I am building except managing workflows. I am copying the agent example from documentation to show what am I looking for and what seems to be currently missing.
In this example, we are providing tools to LLM and it can choose to use any of them at its discretion based on chat history, we do not have any control when does the LLM call each tool nor can we control the context provided to LLM for each tool call which can contain a lot of noise if the tool generates a lot of output irrelevant to LLM.
It is a huge problem for any moderate complex AI tool. A lot of times, we need to use the provided tools in a specific order and at other times rely on LLMs. For example, different variations of RAG will start with converting the text into embedding, check some sort of similarity against stored embeddings in a vector DB and rank them followed by retrieval and then generating the final response. All of these tools need to be called in a fixed sequence. If it is left to LLMs, even if it makes one request out of order, it will lead to unnecessary errors which can be avoided. This is also a very simple example, a lot of times, we need to use 10 or 20 tools in a fixed order for complex tasks.
These workflows also frequently require conditional branches, so a RAG tool for example can use an LLM judge or a human in the loop to determine if the response is complete or accurate, if it thinks its not accurate, we can run the above sequence of actions again and again until the judge determines the output is acceptable. So, this sort of conditional branches is also necessary.
There are lots of things like these which are necessary to automate multi step workflows for businesses and this is a solved problem but unfortunately only in Python. I was researching a JavaScript based library which could integrate with my existing NextJs application and runs entirely in browser. Actually, that's what brought me here but from reading the docs, I think it also does not support creating such workflows.
Let me share an example of such workflow from LlamaIndex which allows us to create such workflows to show what sort of features am I looking for.
We define multiple steps in a workflow by sub classing workflow class and use a decorator to describe each step as a method on this class. Each step is triggered when any step emits an event corresponding to its input event and it returns an event itself. There are other frameworks like Langgraph which do it differently.
So, is something like this currently possible in AI SDK or on the roadmap? I am also open to third party libraries which integrate well with AI SDK providing such functionality.
Beta Was this translation helpful? Give feedback.
All reactions