Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize Agent with prior conversations #251

Open
thoo opened this issue Jan 17, 2025 · 1 comment
Open

Initialize Agent with prior conversations #251

thoo opened this issue Jan 17, 2025 · 1 comment

Comments

@thoo
Copy link

thoo commented Jan 17, 2025

Is there anyway to pass a list of prior messages like this when I create the agent? I want the agent to pick up where the user left from yesterday or something along the line.
I saw there is an option to write to memory from logs.

messages = [
  {"role": "user", "content": "Hello, how are you?"},
  {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
  {"role": "user", "content": "No need to help, take it easy."},
]

Something like this would do.

agent = CodeAgent(
    tools=[sql_engine],
    model=HfApiModel("meta-llama/Meta-Llama-3.1-8B-Instruct"),
memory_to_initialize=messages # does this exit now?
)
@thoo
Copy link
Author

thoo commented Jan 17, 2025

It looks like I can save the logs logs= agent.logs and use write_inner_memory_from_logs to write it back to the agent in the beginning ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant