Open Bargemanos opened 1 month ago
Yes, use this code:
from agency_swarm.agency.genesis import GenesisAgency
chat_id = "my_chat_id"
def load_threads(chat_id):
# Load threads from a file or database using the chat_id
with open(f"{chat_id}_threads.json", "r") as file:
threads = json.load(file)
return threads
def save_threads(new_threads, chat_id):
# Save threads to a file or database using the chat_id
with open(f"{chat_id}_threads.json", "w") as file:
json.dump(new_threads, file)
agency = GenesisAgency(with_browsing=False,
threads_callbacks={
'load': lambda: load_threads(chat_id=chat_id),
'save': lambda new_threads: save_threads(new_threads, chat_id=chat_id)
})
demo = agency.demo_gradio(height=900)
By changing chat id, you can control the thread on openai manually. If it's the same, agents will retain previous context.
Hey @VRSEN which file do I update this in?
my_chat_id
is this from https://platform.openai.com/assistants/
? or somewhere else?
Would I just run agency-swarm genesis
again?
Is it possible to restart or "pickup where left" an agency creation run started with Genesis, after hitting an OpenAI api Error or a token limit hit? Before i ran into rate limits multiple times and started over with a different approach. Also used 4o-mini a few time and that worked pretty ok most of the times.
Just now i'm able to use the tear 2 limits, and while i did not hit a token limit error, i did received an API error. So i started wondering, is it possible to continue or (partially) redo a agency creation job?
I tried a few things in the playground on OpenAI web console, but without success.