Closed
Description
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