-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathtest_resources.py
66 lines (58 loc) · 1.8 KB
/
test_resources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import pytest
@pytest.mark.skip("wait for next version of python sdk")
@pytest.mark.integration
@pytest.mark.asyncio
@pytest.mark.e2e
@pytest.mark.parametrize(
"model_name",
[
"haiku",
],
)
async def test_using_resource_blob(fast_agent, model_name):
"""Test that the agent can process a simple prompt using directory-specific config."""
# Use the FastAgent instance from the test directory fixture
fast = fast_agent
# Define the agent
@fast.agent(
"agent",
instruction="You are a helpful AI Agent",
model=model_name,
servers=["prompt_server"],
)
async def agent_function():
async with fast.run() as agent:
assert "fast-agent" in await agent.with_resource(
"Summarise this PDF please, be sure to include the product name",
"prompt_server",
"resource://fast-agent/sample.pdf",
)
await agent_function()
@pytest.mark.integration
@pytest.mark.asyncio
@pytest.mark.e2e
@pytest.mark.parametrize(
"model_name",
[
"haiku",
],
)
async def test_using_resource_text(fast_agent, model_name):
"""Test that the agent can process a simple prompt using directory-specific config."""
# Use the FastAgent instance from the test directory fixture
fast = fast_agent
# Define the agent
@fast.agent(
"agent",
instruction="You are a helpful AI Agent",
model=model_name,
servers=["prompt_server"],
)
async def agent_function():
async with fast.run() as agent:
assert "white" in await agent.agent.with_resource(
"What colour are buttons in this file?",
"prompt_server",
"resource://fast-agent/style.css",
)
await agent_function()