File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import pytest
2
+ import strands
3
+ from strands import Agent
4
+ from strands .models .vllm import VLLMModel
5
+
6
+
7
+ @pytest .fixture
8
+ def model ():
9
+ return VLLMModel (
10
+ model_id = "meta-llama/Llama-3.2-3B" , # or whatever your model ID is
11
+ host = "http://localhost:8000" , # adjust as needed
12
+ max_tokens = 128 ,
13
+ )
14
+
15
+
16
+ @pytest .fixture
17
+ def tools ():
18
+ @strands .tool
19
+ def tool_time () -> str :
20
+ return "12:00"
21
+
22
+ @strands .tool
23
+ def tool_weather () -> str :
24
+ return "cloudy"
25
+
26
+ return [tool_time , tool_weather ]
27
+
28
+
29
+ @pytest .fixture
30
+ def agent (model , tools ):
31
+ return Agent (model = model , tools = tools )
32
+
33
+
34
+ def test_agent (agent ):
35
+ result = agent ("What is the time and weather in Melboune Australia?" )
36
+ text = result .message ["content" ][0 ]["text" ].lower ()
37
+
38
+ assert all (string in text for string in ["3:00" , "cloudy" ])
You can’t perform that action at this time.
0 commit comments