|
3 | 3 |
|
4 | 4 | import pydantic |
5 | 5 | import pytest |
6 | | -from dirty_equals import IsInt, IsPartialDict |
| 6 | +from dirty_equals import IsInt, IsPartialDict, IsStr |
7 | 7 | from inline_snapshot import snapshot |
8 | 8 |
|
9 | 9 | import logfire |
@@ -55,12 +55,35 @@ def get_current_weather(location: str) -> str: |
55 | 55 | assert response.text == snapshot('It is rainy in Boston, MA.\n') |
56 | 56 | assert exporter.exported_spans_as_dict(parse_json_attributes=True) == snapshot( |
57 | 57 | [ |
| 58 | + { |
| 59 | + 'name': 'execute_tool get_current_weather', |
| 60 | + 'context': {'trace_id': 1, 'span_id': 3, 'is_remote': False}, |
| 61 | + 'parent': {'trace_id': 1, 'span_id': 1, 'is_remote': False}, |
| 62 | + 'start_time': 3000000000, |
| 63 | + 'end_time': 4000000000, |
| 64 | + 'attributes': { |
| 65 | + 'gen_ai.system': 'gemini', |
| 66 | + 'gen_ai.operation.name': 'execute_tool', |
| 67 | + 'gen_ai.tool.name': 'get_current_weather', |
| 68 | + 'gen_ai.tool.description': IsStr(), |
| 69 | + 'code.function.name': 'get_current_weather', |
| 70 | + 'code.module': 'tests.otel_integrations.test_google_genai', |
| 71 | + 'code.args.positional.count': 0, |
| 72 | + 'code.args.keyword.count': 1, |
| 73 | + 'logfire.span_type': 'span', |
| 74 | + 'logfire.msg': 'execute_tool get_current_weather', |
| 75 | + 'code.function.parameters.location.type': 'str', |
| 76 | + 'code.function.parameters.location.value': 'Boston, MA', |
| 77 | + 'code.function.return.type': 'str', |
| 78 | + 'code.function.return.value': 'rainy', |
| 79 | + }, |
| 80 | + }, |
58 | 81 | { |
59 | 82 | 'name': 'generate_content gemini-2.0-flash-001', |
60 | 83 | 'context': {'trace_id': 1, 'span_id': 1, 'is_remote': False}, |
61 | 84 | 'parent': None, |
62 | 85 | 'start_time': IsInt(), |
63 | | - 'end_time': 4000000000, |
| 86 | + 'end_time': 6000000000, |
64 | 87 | 'attributes': { |
65 | 88 | 'code.function.name': 'google.genai.Models.generate_content', |
66 | 89 | 'gen_ai.system': 'gemini', |
@@ -89,6 +112,6 @@ def get_current_weather(location: str) -> str: |
89 | 112 | 'logfire.json_schema': {'type': 'object', 'properties': {'events': {'type': 'array'}}}, |
90 | 113 | 'gen_ai.response.model': 'gemini-2.0-flash-001', |
91 | 114 | }, |
92 | | - } |
| 115 | + }, |
93 | 116 | ] |
94 | 117 | ) |
0 commit comments