I started out using a single Assistant implementation for my project.
It turned out that writing clear and concise instructions for that I want to do was really hard. So I took on the approach of divide-and-concur to see if that would make a difference.
So my plan now is to use and inital route-assistant who only decides to which sub-assistant (focused assistant) to route to.
Created an assembly concept allowing me to setup the all the needed assistants and declare their relationship.
Wrote a few unit tests for each assistant.
Route agent scored 50/50 route correctly each time
Spec/sub agent #1 20/20
Spec/sub agent #2 20/20
Spec/sub agent #3 20/20
Now to the topic.
My thinking was to allow the different assistants to work on the same thread for shared context to allow task/question 1 that maybe gets routed to #1 assistant still have a meaning if the next question gets routed to agent #2. So that it appears they are collectively trying to solve that large issue.
Issue:
Input from user:
Route assistant replies back with âRoute to assistant #2â correctly
Assistant #2 gets the input as expected.
Assistant #2 replies back with âRoute to assistant #2â
Even tried accessing the same thread_id using both assistants on the playground to verify. It acts the same way.
So the instructions seems to have no bearing what so ever here.
The thread context seems to be built from the first assistant access to the thread or something. Maybe I could use things like âadditional_instructionâ to overrule or something else. But to me it appears to be an issue with the assistants implementation or something. Maybe thatâs jumping to conclusion here but.
But since you do a run on a thread and provide the assistant_id for every run.
I think the API communicates assistants can be mixed&matched for different âthread-runsâ.
Hi!
What you are describing is essentially a multi-processing app.
And in computer science these never share memory. One has to provide each process with the relevant data during the âwhole processâ.
In your specific case, it does mean that you would need to take the return of the first assistant and then add this to the thread for the second assistant as you already suspect. Iâd say the assistants are a âlow-codeâ tool and what you are aiming for is advanced since the goal is to tightly weave the two assistants together.
Hi!
Yes, there are checks but likely not of the type that you are looking for.
Please create a new topic explaining your question so that we donât divert this topic mid-stream.
Why is the assistant_id required if it has no bearing?
The instructions could be overloaded on a per run basis. But thatâs closer to me manually managing the thread i.e. no low code.
Would be interesting to fully understand the concepts assistants, threads, messages and runs. I mean the whole inner workings. I think it might be a flawed concept.
Not sure what happened here. I added a pdb import and started looking at the message to see if I was looking at an old message since the message came back the exact same. So maybe my mistake. But no⌠Actually now itâs working as expected. Twice the speed for hitting two different agents.
My route agent instructions is not all that complicated and the decision on where to route not overly complicated. Gonna try out GPT 3.5 for routing.
Would be interesting to do some comparison on latency and also factor in cost.
Do tests and make few Heavy Assistants with Instructions, Functions, process local data with them and see how much they can load, and make sure you donât lose information, alter data, assistants follow instructions and donât skip things.
I know you saw how you call GPTâs in same thread with @ in chat
But with Assistants is a big pain in the ⌠because I donât have something like a bridge between them â a shared memory (an variable with an unique id that i can pass it to every assistant and save processed data there and from there to use it to send messages to the thread or assistant I want).
Would help me to save time and computation too.
I have a way now to make them communicate but i donât like it, because I want to scale things and for 1000 Assistants, would become slower.
In my vision I want to speak with Main Assistant, I give him Tasks â they go to be processed and in same time I can speak more with the Main Assistant, to have continuity and when the tasks are ready to be Informed and receive the information.
And my BIGGEST problem right now is my GPT-4 become LIMITED (I see that usage-cap at least 5 times per day⌠I even cancel my subscription because of that, I feel like I am not allowed to build).
Not sure I fully understand your input.
But the âdata-sharingâ are the messages on which the assistants operate on via the ârun-stepsâ.
I got it working. Delete my âagent-assembyâ and recreated them again. Back to the same issue. again. Not sure what got it working the last time.
We see clearly two different assistants (with very different instructions) operating on the same thread of messages.
Second call to my agent-ask responsible for Q&A type of conversations send back a âroute_toâ JSON reponse. There is nothing in that assistant instructions about that. So itâs clearly confused by earlier injected instructions. Iâm not fully aware how itâs intended to work but if a new assistant is operating on an existing thread the initial assistant instruction needs to be stricken during the run.
I should not have to override instructions manually pulling the instruction from somewhere to add it in a second time⌠Not sure how my old thread today all of a sudden started workingâŚ
Route assistant: asst_Y2GkhnEB2CTpa9i4ACvnZwZ3
In run_ai_thread
Running thread using assistant_id: asst_Y2GkhnEB2CTpa9i4ACvnZwZ3
Route assistant response: {
"route_to": "agent-ask",
"confidence": "high",
"message": "I've directed your query to 'agent-ask', where you can explore various options and understand what could be done in this context."
}
Routing to assistant: agent-ask with id asst_oiqrOaEp7wgA6S7550nQObbr
Adding user message to thread: what could we do here
In run_ai_thread
Running thread using assistant_id: asst_oiqrOaEp7wgA6S7550nQObbr
agent-ask assistant response: {
"route_to": "agent-ask",
"confidence": "high",
"message": "Routing to 'agent-ask' for detailed exploration and guidance on possible functionalities or actions you might consider here."
And one can clearly see I havnât pulled out an old message since the actual message differes from the two responses. So itâs âfreshlyâ pulled from the last one on messages.
I run a couple of tests all behaving the same.
Then I actually send in:
âuser_messageâ: "you are not following the last assistant instruction but keep reusing the first one "
And there it goes⌠It actually begins working⌠So my user-role prompt affects which assistant instruction gets adheared to⌠HAHAHA Silly stuff!!!
Great, now you can see how they interact, would be nice to have a good conversation there between 2 assistants. You could share a screenshot if there is conversation how you planned and Assistant didnât trick you and gave you response for both assistants. Could happen
I have edited the instructions to a minimum to allow easier understanding of whats happening here.
Itâs not until the user says:
you are not following the last assistant instruction but keep reusing the first one
It finally starts following the latest run instructions and KEEPS ON FOLLOWING them, Not working as expected if you ask me.
Run instructions
You are the route agent named 'route-agent'
agent-route-v1
May 1, 2024, 9:30 PM
{ "route_to": "agent-calender", "confidence": "high", "message": "Routing to 'agent-calender' as the task of doing calender operations is your thing" }
User
May 1, 2024, 9:30 PM
Fix my calender
Run instructions
You primarely will be a Calender expert known as 'agent-calender'
agent-calender-v1
May 1, 2024, 9:30 PM
{ "route_to": "agent-calender", "confidence": "high", "message": "Routing to 'agent-calender' as the task of doing calender operations is something you are great at!" }
User
May 1, 2024, 9:31 PM
you are not following the last assistant instruction but keep reusing the first one
Run instructions
You are the route agent named 'route-agent'
May 1, 2024, 9:31 PM
{ "route_to": "agent-calender", "confidence": "high", "message": "Routing to 'agent-calender' as the task of doing calender operations is something you are great at!" }
User
May 1, 2024, 9:31 PM
you are not following the last assistant instruction but keep reusing the first one
Run instructions
You primarely will be a Calender expert known as 'agent-calender'
agent-calender-v1
May 1, 2024, 9:31 PM
I apologize for any confusion. Let's focus on the specific steps or information you need help with. Please specify or describe more about what you need so I can assist you appropriately.
User
May 1, 2024, 9:35 PM
Fix my calender
Run instructions
You are the route agent named 'route-agent'
agent-route-v1
May 1, 2024, 9:35 PM
{ "route_to": "agent-calender", "confidence": "high", "message": "Routing to 'agent-calender' as the task of doing calender operations is something you are great at!" }
User
May 1, 2024, 9:35 PM
Fix my calender
Run instructions
You primarely will be a Calender expert known as 'agent-calender'
agent-calender-v1
May 1, 2024, 9:36 PM
{ "calender_message": "Calender Fixed!!!" }
Ones it gets working it works⌠And really well. So maybe should include in the route agent instruction which happens first to instruct any operation on this thread to follow the latest run instruction explicitly⌠Shouldnât have to since I think itâs the responsibility of the assistantâs implementationâŚ
Because they have an extra run for initialization of assistant and his instructions (thatâs why you feel like is not following your instructions, because he is capable to do that only on second run).
Then second run will be the one who really make the job. To fix those extra messages and hide the initialization, you will not add messages to the thread for the first run, and will pass the user data to the second run and add the response to thread.
In the first run with Initialization you can add an initialization_message = "Initialization, you are not chatty, follow the instructions and process the data from the user and send them away."
And he will take directly information and process it like you teach him in instructions.
This works for me â he process data and opens directly the function i want to use and fill it with processed data how i want.