Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: modify composio example (#1885)
Matthew Zhou6cdc14f6fe83
diff --git a/examples/composio_tool_usage.py b/examples/composio_tool_usage.pyindex e72a31d23..7246a9f4a 100644--- a/examples/composio_tool_usage.py+++ b/examples/composio_tool_usage.py@@ -2,6 +2,8 @@ import jsonimport uuidfrom letta import create_client+from letta.schemas.embedding_config import EmbeddingConfig+from letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import ChatMemoryfrom letta.schemas.tool import Tool@@ -10,6 +12,8 @@ Setup here."""# Create a `LocalClient` (you can also use a `RESTClient`, see the letta_rest_client.py example)client = create_client()+client.set_default_llm_config(LLMConfig.default_config("gpt-4o-mini"))+client.set_default_embedding_config(EmbeddingConfig.default_config(provider="openai"))# Generate uuid for agent name for this examplenamespace = uuid.NAMESPACE_DNS@@ -59,18 +63,18 @@ def main():"""# Create an agent- agent_state = client.create_agent(name=agent_uuid, memory=ChatMemory(human="My name is Matt.", persona=persona), tools=[tool.name])- print(f"Created agent: {agent_state.name} with ID {str(agent_state.id)}")+ agent = client.create_agent(name=agent_uuid, memory=ChatMemory(human="My name is Matt.", persona=persona), tools=[tool.name])+ print(f"Created agent: {agent.name} with ID {str(agent.id)}")# Send a message to the agent- send_message_response = client.user_message(agent_id=agent_state.id, message="Star a repo composio with owner composiohq on GitHub")+ send_message_response = client.user_message(agent_id=agent.id, message="Star a repo composio with owner composiohq on GitHub")for message in send_message_response.messages:response_json = json.dumps(message.model_dump(), indent=4)print(f"{response_json}\n")# Delete agent- client.delete_agent(agent_id=agent_state.id)- print(f"Deleted agent: {agent_state.name} with ID {str(agent_state.id)}")+ client.delete_agent(agent_id=agent.id)+ print(f"Deleted agent: {agent.name} with ID {str(agent.id)}")if __name__ == "__main__":diff --git a/letta/schemas/llm_config.py b/letta/schemas/llm_config.pyindex b3d7f02f0..ffdb60cff 100644--- a/letta/schemas/llm_config.py+++ b/letta/schemas/llm_config.py@@ -33,6 +33,7 @@ class LLMConfig(BaseModel):"koboldcpp","vllm","hugging-face",+ "mistral",] = Field(..., description="The endpoint type for the model.")model_endpoint: Optional[str] = Field(None, description="The endpoint for the model.")model_wrapper: Optional[str] = Field(None, description="The wrapper for the model.")