Skip to content

Commit b69cf58

Browse files
committed
Merge branch 'main' into pr/2813
2 parents 65f2629 + 11375f8 commit b69cf58

7 files changed

Lines changed: 21 additions & 0 deletions

File tree

deepeval/tracing/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class TraceApi(BaseModel):
148148
output: Optional[Any] = Field(None)
149149
status: Optional[TraceSpanApiStatus] = Field(TraceSpanApiStatus.SUCCESS)
150150
test_case_id: Optional[str] = Field(None, alias="testCaseId")
151+
test_run_id: Optional[str] = Field(None, alias="testRunId")
151152
turn_id: Optional[str] = Field(None, alias="turnId")
152153

153154
# additional test case parameters

deepeval/tracing/context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def update_current_trace(
133133
test_case: Optional[LLMTestCase] = None,
134134
confident_api_key: Optional[str] = None,
135135
test_case_id: Optional[str] = None,
136+
test_run_id: Optional[str] = None,
136137
turn_id: Optional[str] = None,
137138
metric_collection: Optional[str] = None,
138139
metrics: Optional[List[BaseMetric]] = None,
@@ -176,6 +177,8 @@ def update_current_trace(
176177
current_trace.confident_api_key = confident_api_key
177178
if test_case_id:
178179
current_trace.test_case_id = test_case_id
180+
if test_run_id:
181+
current_trace.test_run_id = test_run_id
179182
if turn_id:
180183
current_trace.turn_id = turn_id
181184
if metric_collection:

deepeval/tracing/otel/exporter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class BaseSpanWrapper:
8989
trace_tools_called: Optional[List[ToolCall]] = None
9090
trace_expected_tools: Optional[List[ToolCall]] = None
9191
trace_test_case_id: Optional[str] = None
92+
trace_test_run_id: Optional[str] = None
9293
trace_turn_id: Optional[str] = None
9394
trace_metric_collection: Optional[str] = None
9495
trace_environment: Optional[str] = None
@@ -325,6 +326,10 @@ def _set_current_trace_attributes_from_base_span_wrapper(
325326
base_span_wrapper.trace_test_case_id, str
326327
):
327328
current_trace.test_case_id = base_span_wrapper.trace_test_case_id
329+
if base_span_wrapper.trace_test_run_id and isinstance(
330+
base_span_wrapper.trace_test_run_id, str
331+
):
332+
current_trace.test_run_id = base_span_wrapper.trace_test_run_id
328333
if base_span_wrapper.trace_turn_id and isinstance(
329334
base_span_wrapper.trace_turn_id, str
330335
):
@@ -427,6 +432,7 @@ def __set_trace_attributes(
427432
raw_trace_expected_tools = list(raw_trace_expected_tools)
428433

429434
trace_test_case_id = span.attributes.get("confident.trace.test_case_id")
435+
trace_test_run_id = span.attributes.get("confident.trace.test_run_id")
430436
trace_turn_id = span.attributes.get("confident.trace.turn_id")
431437

432438
raw_trace_metric_collection = span.attributes.get(
@@ -460,6 +466,7 @@ def __set_trace_attributes(
460466
base_span_wrapper.trace_tools_called = trace_tools_called
461467
base_span_wrapper.trace_expected_tools = trace_expected_tools
462468
base_span_wrapper.trace_test_case_id = trace_test_case_id
469+
base_span_wrapper.trace_test_run_id = trace_test_run_id
463470
base_span_wrapper.trace_turn_id = trace_turn_id
464471
base_span_wrapper.trace_metric_collection = trace_metric_collection
465472
base_span_wrapper.trace_environment = trace_environment

deepeval/tracing/tracing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ def create_trace_api(self, trace: Trace) -> TraceApi:
877877
toolsCalled=trace.tools_called,
878878
expectedTools=trace.expected_tools,
879879
testCaseId=trace.test_case_id,
880+
testRunId=trace.test_run_id,
880881
turnId=trace.turn_id,
881882
confident_api_key=trace.confident_api_key,
882883
environment=(

deepeval/tracing/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class Trace(BaseModel):
197197
metrics: Optional[List[BaseMetric]] = None
198198
metric_collection: Optional[str] = None
199199
test_case_id: Optional[str] = Field(None, serialization_alias="testCaseId")
200+
test_run_id: Optional[str] = Field(None, serialization_alias="testRunId")
200201
turn_id: Optional[str] = Field(None, serialization_alias="turnId")
201202

202203
# Don't serialize these

typescript/src/tracing/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export interface TraceApi {
101101
threadId?: string;
102102
userId?: string;
103103
testCaseId?: string;
104+
testRunId?: string;
104105
turnId?: string;
105106
input?: any;
106107
output?: any;

typescript/src/tracing/tracing.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export interface Trace {
270270
threadId?: string;
271271
userId?: string;
272272
testCaseId?: string;
273+
testRunId?: string;
273274
turnId?: string;
274275
input?: any;
275276
output?: any;
@@ -797,6 +798,7 @@ export class TraceManager {
797798
threadId: trace.threadId,
798799
userId: trace.userId,
799800
testCaseId: trace.testCaseId,
801+
testRunId: trace.testRunId,
800802
turnId: trace.turnId,
801803
input: trace.input,
802804
output: trace.output,
@@ -1447,6 +1449,7 @@ export interface UpdateCurrentTraceParams {
14471449
threadId?: string;
14481450
userId?: string;
14491451
testCaseId?: string;
1452+
testRunId?: string;
14501453
turnId?: string;
14511454
input?: any;
14521455
output?: any;
@@ -1469,6 +1472,7 @@ export const updateCurrentTrace = ({
14691472
threadId,
14701473
userId,
14711474
testCaseId,
1475+
testRunId,
14721476
turnId,
14731477
input,
14741478
output,
@@ -1516,6 +1520,9 @@ export const updateCurrentTrace = ({
15161520
if (testCaseId !== undefined) {
15171521
currentTrace.testCaseId = testCaseId;
15181522
}
1523+
if (testRunId !== undefined) {
1524+
currentTrace.testRunId = testRunId;
1525+
}
15191526
if (turnId !== undefined) {
15201527
currentTrace.turnId = turnId;
15211528
}

0 commit comments

Comments
 (0)