You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having problem getting an agent to execute a tool properly. The Letta server is executed from Windows command line with the 0.6.12 release.
Here is the code for my python client, which simply copies the roll-dice tool from the quick-start guide:
from letta import create_client, agent, EmbeddingConfig, LLMConfig
client = create_client()
def roll_dice_20() -> str:
"""
Simulate the roll of a 20-sided die (d20).
This function generates a random integer between 1 and 20, inclusive,
which represents the outcome of a single roll of a d20.
Returns:
str: The result of the die roll.
"""
import random
dice_role_outcome = random.randint(1, 20)
output_string = f"You rolled a {dice_role_outcome}"
return output_string
def create_agent(client):
try:
tool = client.create_tool(
func=roll_dice_20,
name = 'rd20f',
)
print(f"...Created tool {tool.name}")
agent = client.create_agent(
tool_ids=[tool.id]
)
return agent
except Exception as e:
print(f"Error creating agent: {e}")
return None
client.set_default_llm_config(LLMConfig.default_config(model_name="gpt-4"))
client.set_default_embedding_config(EmbeddingConfig.default_config(model_name="text-embedding-ada-002"))
agent = create_agent(client)
After opening up this newly created agent in ADE, the dialog goes as follows:
User: roll dice
Agent: It looks like the dice game isn't working at the moment. How about we chat instead? Do you have any burning questions that you've been pondering over recently?
When searching for this newly created tool in the ADE, it does appear in the "All tools" list.
Letta Config
Here is my ~/.letta/config file:
[defaults]
preset = memgpt_chat
persona = sam_pov
human = basic
[archival_storage]
type = sqlite
path = C:\Users\kaihu\.letta
[recall_storage]
type = sqlite
path = C:\Users\kaihu\.letta
[metadata_storage]
type = sqlite
path = C:\Users\kaihu\.letta
[version]
letta_version = 0.6.12
The text was updated successfully, but these errors were encountered:
Seems that the argument 'name' is the source of the problem.
The following call executed with no error, but the agent can't find the roll_dice_20 function. In addition, if I call it more than one then I get SQL error since name is an unique key in the DB. If I keep changing the name to avoid the SQL unique key error, then I ended up with many copies of the function in the DB.
With the following, roll_dict_20 gets called in ADE without problem, but the call can be made only once for the same reason as above, so I got problem if I am updating my code for some reason.
tool = client.create_tool(
func=roll_dice_20)
The following seems to be the best practice, where I don't get the SQL unique key exception, and I don't end up with many copies of the function in the DB in different names, and it also works fine in ADE.
I am having problem getting an agent to execute a tool properly. The Letta server is executed from Windows command line with the 0.6.12 release.
Here is the code for my python client, which simply copies the roll-dice tool from the quick-start guide:
After opening up this newly created agent in ADE, the dialog goes as follows:
When searching for this newly created tool in the ADE, it does appear in the "All tools" list.
Letta Config
Here is my
~/.letta/config
file:The text was updated successfully, but these errors were encountered: