MemGPT/tests/test_agent_function_update.py
Sarah Wooders d631cec3d6
feat: require LLMConfig and EmbeddingConfig to be specified for agent creation + allow multiple simultaneous provider configs for server (#1814)
Co-authored-by: Shubham Naik <shubham.naik10@gmail.com>
Co-authored-by: Matthew Zhou <mattzh1314@gmail.com>
Co-authored-by: Matt Zhou <mattzhou@Matts-MacBook-Pro.local>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
2024-10-04 19:35:00 -07:00

45 lines
1.1 KiB
Python

import pytest
from letta import create_client
from letta.schemas.message import Message
from letta.utils import assistant_function_to_tool, json_dumps
from tests.utils import wipe_config
def hello_world(self) -> str:
"""Test function for agent to gain access to
Returns:
str: A message for the world
"""
return "hello, world!"
@pytest.fixture(scope="module")
def agent():
"""Create a test agent that we can call functions on"""
wipe_config()
global client
# create letta client
client = create_client()
agent_state = client.create_agent()
return client.server._get_or_load_agent(agent_id=agent_state.id)
@pytest.fixture(scope="module")
def ai_function_call():
return Message(
**assistant_function_to_tool(
{
"role": "assistant",
"text": "I will now call hello world", # TODO: change to `content` once `Message` is updated
"function_call": {
"name": "hello_world",
"arguments": json_dumps({}),
},
}
)
)