change the way of sending streaming request and specify zurich, switzerland in prompt

This commit is contained in:
Zishan
2025-02-20 13:43:46 +01:00
parent c5ce8e305b
commit 45b9872d73
4 changed files with 61 additions and 39 deletions
@@ -19,9 +19,7 @@ async def test_header(
dataset_name = "claude_header_test" + str(
datetime.datetime.now().strftime("%Y%m%d%H%M%S")
)
print("before patch:",anthropic_api_key)
with patch.dict(os.environ, {"ANTHROPIC_API_KEY": anthropic_api_key + "|invariant-auth: <not needed for test>"}):
print("after patch:",os.environ.get("ANTHROPIC_API_KEY"))
client = anthropic.Anthropic(
http_client=Client(),
base_url = f"{proxy_url}/api/v1/proxy/{dataset_name}/anthropic",
@@ -32,7 +30,7 @@ async def test_header(
messages=[
{
"role": "user",
"content": "Give me an introduction to Zurich within 200 words."
"content": "Give me an introduction to Zurich, Switzerland within 200 words."
}
]
)
@@ -55,7 +53,7 @@ async def test_header(
assert trace["messages"] == [
{
"role": "user",
"content": "Give me an introduction to Zurich within 200 words."
"content": "Give me an introduction to Zurich, Switzerland within 200 words."
},
{
"role": "assistant",
@@ -164,7 +164,7 @@ async def test_response_with_toolcall(
weather_agent = WeatherAgent(proxy_url)
queries = [
"What's the weather like in Zurich city?",
"What's the weather like in Zurich, Switzerland?",
"Tell me the weather for New York",
]
cities = ["zurich", "new york"]
@@ -220,7 +220,7 @@ async def test_streaming_response_with_toolcall(
weather_agent = WeatherAgent(proxy_url)
queries = [
"What's the weather like in Zurich city?",
"What's the weather like in Zurich, Switzerland?",
"Tell me the weather for New York",
]
cities = ["zurich", "new york"]
@@ -25,7 +25,7 @@ async def test_response_without_toolcall(
cities = ["zurich", "new york", "london"]
queries = [
"Can you introduce Zurich city within 200 words?",
"Can you introduce Zurich, Switzerland within 200 words?",
"Tell me the history of New York within 100 words?",
"How's the weather in London next week?"
]
@@ -86,7 +86,7 @@ async def test_streaming_response_without_toolcall(
cities = ["zurich", "new york", "london"]
queries = [
"Can you introduce Zurich city within 200 words?",
"Can you introduce Zurich, Switzerland within 200 words?",
"Tell me the history of New York within 100 words?",
"How's the weather in London next week?"
]