Skip to content

Commit 0ba11df

Browse files
committed
add tags so we know which model to compare to which when doing evaluation
1 parent 5d9fb07 commit 0ba11df

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

tests/chinook/langfuse/generate_traces.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ async def test_complex_query_0(row: EvaluationRow) -> EvaluationRow:
6363
"""
6464
Complex queries - PydanticAI automatically creates rich Langfuse traces.
6565
"""
66+
if langfuse_client:
67+
langfuse_client.update_current_trace(tags=["chinook_sql"])
68+
6669
return row
6770

6871

@@ -92,6 +95,9 @@ async def test_complex_query_1(row: EvaluationRow) -> EvaluationRow:
9295
"""
9396
Complex queries - PydanticAI automatically creates rich Langfuse traces.
9497
"""
98+
if langfuse_client:
99+
langfuse_client.update_current_trace(tags=["chinook_sql"])
100+
95101
return row
96102

97103

@@ -121,6 +127,9 @@ async def test_complex_query_2(row: EvaluationRow) -> EvaluationRow:
121127
"""
122128
Complex queries - PydanticAI automatically creates rich Langfuse traces.
123129
"""
130+
if langfuse_client:
131+
langfuse_client.update_current_trace(tags=["chinook_sql"])
132+
124133
return row
125134

126135

@@ -150,6 +159,9 @@ async def test_complex_query_3(row: EvaluationRow) -> EvaluationRow:
150159
"""
151160
Complex queries - PydanticAI automatically creates rich Langfuse traces.
152161
"""
162+
if langfuse_client:
163+
langfuse_client.update_current_trace(tags=["chinook_sql"])
164+
153165
return row
154166

155167

@@ -179,6 +191,9 @@ async def test_complex_query_4(row: EvaluationRow) -> EvaluationRow:
179191
"""
180192
Complex queries - PydanticAI automatically creates rich Langfuse traces.
181193
"""
194+
if langfuse_client:
195+
langfuse_client.update_current_trace(tags=["chinook_sql"])
196+
182197
return row
183198

184199

@@ -208,4 +223,7 @@ async def test_complex_query_5(row: EvaluationRow) -> EvaluationRow:
208223
"""
209224
Complex queries - PydanticAI automatically creates rich Langfuse traces.
210225
"""
226+
if langfuse_client:
227+
langfuse_client.update_current_trace(tags=["chinook_sql"])
228+
211229
return row

tests/chinook/langfuse/test_langfuse_chinook.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class Response(BaseModel):
4545
reason: str
4646

4747

48-
def fetch_langfuse_traces_as_evaluation_rows(hours_back: int = 168) -> List[EvaluationRow]:
48+
def fetch_langfuse_traces_as_evaluation_rows(
49+
hours_back: int = 168, tags: List[str] = ["chinook_sql"]
50+
) -> List[EvaluationRow]:
4951
try:
5052
from eval_protocol.adapters.langfuse import create_langfuse_adapter
5153

@@ -59,7 +61,7 @@ def fetch_langfuse_traces_as_evaluation_rows(hours_back: int = 168) -> List[Eval
5961
from_timestamp = now - timedelta(hours=hours_back)
6062

6163
return adapter.get_evaluation_rows(
62-
limit=20, from_timestamp=from_timestamp, to_timestamp=now, include_tool_calls=True
64+
limit=20, from_timestamp=from_timestamp, to_timestamp=now, include_tool_calls=True, tags=tags
6365
)
6466

6567
except Exception as e:

0 commit comments

Comments
 (0)