-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Adding Tools to Agent Returns errors #1900
Comments
Sorry that documentation has an error because of our latest release - you now need to specify the from letta import EmbeddingConfig, LLMConfig
client.set_default_embedding_config(EmbeddingConfig.default_config(provider="openai"))
client.set_default_llm_config(LLMConfig.default_config(model_name="gpt-4")) Thanks for reporting this issue, and we'll make sure to fix the docs. Let me know if things still aren't working thought! |
Hello! Thank you for your response, I tried using the agent I had created through python, however, I am getting an error related to the openai api key. It seems that key is not found. I am not sure where to put my key now that the config file is depreicated? from letta import create_client
from letta import EmbeddingConfig, LLMConfig
client = create_client()
client.set_default_embedding_config(EmbeddingConfig.default_config(provider="openai"))
client.set_default_llm_config(LLMConfig.default_config(model_name="gpt-4"))
def query_birthday_db(self, name: str):
"""
This tool queries an external database to
lookup the birthday of someone given their name.
Args:
name (str): The name to look up
Returns:
birthday (str): The birthday in mm-dd-yyyy format
"""
my_fake_data = {
"bob": "03-06-1997",
"sarah": "03-06-1997"
}
name = name.lower()
if name not in my_fake_data:
return None
else:
return my_fake_data[name]
birthday_tool = client.create_tool(query_birthday_db)
agentName = "testing_agent"
agent_1 = client.create_agent(
name=agentName,
) Error message when then using Letta Run:
|
I am assuming this issue is appearing from line 127 llm_api_tools.py which has: model_settings: Optional[dict] = None, # TODO: eventually pass from server moedel_settings is not defined when calling create on line 464 file agent.py: response = create(
# agent_state=self.agent_state,
llm_config=self.agent_state.llm_config,
user_id=self.agent_state.user_id,
messages=message_sequence,
functions=self.functions,
functions_python=self.functions_python,
function_call=function_call,
# hint
first_message=first_message,
# streaming
stream=stream,
stream_interface=self.interface,
# putting inner thoughts in func args or not
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
) |
Describe the bug
When following lettas tutorial, letta tutorial, on adding custom tools to letta, I get an error.
Adding tools to the agent throught he online server website also presents weird behavior. i.e. the tool does not run and it removes default tools. It seems that I can either have the default tools OR only my custom tool.
Is there a way to add tools to existing agents?
Where is the html code for the website? i.e. "http://localhost:8283/"
Please describe your setup
I have created a python 3.12 virtual environment
I then did pip install letta
Followed the quickstart guide
macOS 14.6.1, m1 chip,
VSCODE
Running letta though terminal
Here is what happens when I add a tool through python using lettas tutorial on adding custom tools:
(my_letta) (base) williamzheng@WilliamsMBP258 MemGPT_Letta % "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Lett
a/my_letta/bin/python" "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/delete_tool.py"
Initializing database...
Traceback (most recent call last):
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/delete_tool.py", line 6, in
agent_state = client.create_agent(name="test_agent")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/client/client.py", line 1555, in create_agent
assert embedding_config or self._default_embedding_config, f"Embedding config must be provided"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Embedding config must be provided
(my_letta) (base) williamzheng@WilliamsMBP258 MemGPT_Letta %
Here is when I add a tool through the website.
This is the website I am talking about. Additionally, you can see here that only 1 tool is added, all default tools are removed. I think this prevents letta from returning response.
The text was updated successfully, but these errors were encountered: