Skip to content

Commit a5d761d

Browse files
committed
chore(llmo): run formatter
1 parent 6164324 commit a5d761d

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

posthog/test/ai/anthropic/test_anthropic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def test_tool_definition(mock_client, mock_anthropic_response):
442442
return_value=mock_anthropic_response,
443443
):
444444
client = Anthropic(api_key="test-key", posthog_client=mock_client)
445-
445+
446446
tools = [
447447
{
448448
"name": "get_weather",
@@ -452,14 +452,14 @@ def test_tool_definition(mock_client, mock_anthropic_response):
452452
"properties": {
453453
"location": {
454454
"type": "string",
455-
"description": "The city or location name to get weather for"
455+
"description": "The city or location name to get weather for",
456456
}
457457
},
458-
"required": ["location"]
459-
}
458+
"required": ["location"],
459+
},
460460
}
461461
]
462-
462+
463463
response = client.messages.create(
464464
model="claude-3-5-sonnet-20241022",
465465
max_tokens=200,

posthog/test/ai/gemini/test_gemini.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,11 @@ def test_tool_use_response(mock_client, mock_google_genai_client, mock_gemini_re
337337
properties={
338338
"location": MagicMock(
339339
type="STRING",
340-
description="The city and state, e.g. San Francisco, CA"
340+
description="The city and state, e.g. San Francisco, CA",
341341
)
342342
},
343-
required=["location"]
344-
)
343+
required=["location"],
344+
),
345345
)
346346
]
347347

posthog/test/ai/langchain/test_callbacks.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ def test_tool_definition(mock_client):
17961796
"""Test that tools defined in invocation parameters are captured in $ai_tools property"""
17971797
callbacks = CallbackHandler(mock_client)
17981798
run_id = uuid.uuid4()
1799-
1799+
18001800
# Define tools to be passed to the invocation parameters
18011801
tools = [
18021802
{
@@ -1809,15 +1809,15 @@ def test_tool_definition(mock_client):
18091809
"properties": {
18101810
"location": {
18111811
"type": "string",
1812-
"description": "The city or location name to get weather for"
1812+
"description": "The city or location name to get weather for",
18131813
}
18141814
},
1815-
"required": ["location"]
1816-
}
1817-
}
1815+
"required": ["location"],
1816+
},
1817+
},
18181818
}
18191819
]
1820-
1820+
18211821
with patch("time.time", return_value=1234567890):
18221822
callbacks._set_llm_metadata(
18231823
{"kwargs": {"openai_api_base": "https://api.openai.com/v1"}},
@@ -1827,7 +1827,7 @@ def test_tool_definition(mock_client):
18271827
metadata={"ls_model_name": "gpt-4o-mini", "ls_provider": "openai"},
18281828
name="test",
18291829
)
1830-
1830+
18311831
expected = GenerationMetadata(
18321832
model="gpt-4o-mini",
18331833
input=[{"role": "user", "content": "hey"}],
@@ -1840,29 +1840,29 @@ def test_tool_definition(mock_client):
18401840
end_time=None,
18411841
)
18421842
assert callbacks._runs[run_id] == expected
1843-
1843+
18441844
with patch("time.time", return_value=1234567891):
18451845
run = callbacks._pop_run_metadata(run_id)
18461846
expected.end_time = 1234567891
18471847
assert run == expected
18481848
assert callbacks._runs == {}
1849-
1849+
18501850
# Now test that the tools are properly captured in the PostHog event
18511851
mock_response = MagicMock()
18521852
mock_response.generations = [[MagicMock()]]
1853-
1853+
18541854
callbacks._capture_generation(
18551855
trace_id=run_id,
18561856
run_id=run_id,
18571857
run=run,
18581858
output=mock_response,
18591859
parent_run_id=None,
18601860
)
1861-
1861+
18621862
assert mock_client.capture.call_count == 1
18631863
call_args = mock_client.capture.call_args[1]
18641864
props = call_args["properties"]
1865-
1865+
18661866
assert call_args["distinct_id"] == run_id
18671867
assert call_args["event"] == "$ai_generation"
18681868
assert props["$ai_provider"] == "openai"

posthog/test/ai/openai/test_openai.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def test_tool_definition(mock_client, mock_openai_response):
775775
return_value=mock_openai_response,
776776
):
777777
client = OpenAI(api_key="test-key", posthog_client=mock_client)
778-
778+
779779
# Define tools to be passed to the create function
780780
tools = [
781781
{
@@ -788,15 +788,15 @@ def test_tool_definition(mock_client, mock_openai_response):
788788
"properties": {
789789
"location": {
790790
"type": "string",
791-
"description": "The city or location name to get weather for"
791+
"description": "The city or location name to get weather for",
792792
}
793793
},
794-
"required": ["location"]
795-
}
796-
}
794+
"required": ["location"],
795+
},
796+
},
797797
}
798798
]
799-
799+
800800
response = client.chat.completions.create(
801801
model="gpt-4o-mini",
802802
messages=[{"role": "user", "content": "hey"}],

0 commit comments

Comments
 (0)