Skip to content

Commit 21fca14

Browse files
committed
test: add test for Agent.create_turn non-streaming response
Summary: This tests the fix to the SDK in llamastack/llama-stack-client-python#141 Test Plan: LLAMA_STACK_CONFIG=fireworks pytest -s -v tests/client-sdk/ --safety-shield meta-llama/Llama-Guard-3-8B
1 parent d8a20e0 commit 21fca14

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/client-sdk/agents/test_agents.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,33 @@ def test_rag_and_code_agent(llama_stack_client, agent_config):
525525
logs = [str(log) for log in EventLogger().log(response) if log is not None]
526526
logs_str = "".join(logs)
527527
assert f"Tool:{tool_name}" in logs_str
528+
529+
530+
def test_create_turn_response(llama_stack_client, agent_config):
531+
client_tool = TestClientTool()
532+
agent_config = {
533+
**agent_config,
534+
"input_shields": [],
535+
"output_shields": [],
536+
"client_tools": [client_tool.get_tool_definition()],
537+
}
538+
539+
agent = Agent(llama_stack_client, agent_config, client_tools=(client_tool,))
540+
session_id = agent.create_session(f"test-session-{uuid4()}")
541+
542+
response = agent.create_turn(
543+
messages=[
544+
{
545+
"role": "user",
546+
"content": "What is the boiling point of polyjuice?",
547+
},
548+
],
549+
session_id=session_id,
550+
stream=False,
551+
)
552+
steps = response.steps
553+
assert len(steps) == 3
554+
assert steps[0].step_type == "inference"
555+
assert steps[1].step_type == "tool_execution"
556+
assert steps[1].tool_calls[0].tool_name == "get_boiling_point"
557+
assert steps[2].step_type == "inference"

0 commit comments

Comments
 (0)