Skip to content

Commit f65dd96

Browse files
Refactor tracing functions to enhance clarity and reduce dependencies
1 parent 8cb85e5 commit f65dd96

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

src/openlayer/lib/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
"trace_oci_genai",
1515
"trace_oci", # Alias for backward compatibility
1616
"update_current_trace",
17-
"update_current_span",
18-
# Type definitions for trace metadata
19-
"LLMTestCase",
20-
"Feedback",
17+
"update_current_span"
2118
]
2219

2320
# ---------------------------------- Tracing --------------------------------- #
2421
from .tracing import tracer
25-
from .tracing.traces import LLMTestCase, Feedback
2622

2723
configure = tracer.configure
2824
trace = tracer.trace

src/openlayer/lib/tracing/tracer.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,7 @@ def update_current_trace(**kwargs) -> None:
562562

563563
def update_current_span(
564564
attributes: Optional[Dict[str, Any]] = None,
565-
metadata: Optional[Dict[str, Any]] = None,
566-
test_case: Optional['traces.LLMTestCase'] = None,
567-
feedback: Optional['traces.Feedback'] = None,
565+
metadata: Optional[Dict[str, Any]] = None
568566
) -> None:
569567
"""Updates the current step (span) with the provided attributes.
570568
@@ -574,16 +572,14 @@ def update_current_span(
574572
Args:
575573
attributes: Optional dictionary of attributes to set on the step
576574
metadata: Optional dictionary of metadata to merge with existing metadata
577-
test_case: Optional LLM test case data
578-
feedback: Optional feedback data
579575
580576
Example:
581-
>>> import openlayer
577+
>>> from openlayer.lib import trace, update_current_span
582578
>>>
583-
>>> @openlayer.trace()
579+
>>> @trace()
584580
>>> def my_function():
585581
>>> # Update current step with additional context
586-
>>> openlayer.update_current_span(
582+
>>> update_current_span(
587583
>>> metadata={"model_version": "v1.2.3"}
588584
>>> )
589585
>>> return "result"
@@ -605,12 +601,6 @@ def update_current_span(
605601
existing_metadata.update(metadata)
606602
update_data["metadata"] = existing_metadata
607603

608-
if test_case is not None:
609-
update_data["test_case"] = test_case
610-
611-
if feedback is not None:
612-
update_data["feedback"] = feedback
613-
614604
# Handle generic attributes by setting them directly on the step
615605
if attributes is not None:
616606
for key, value in attributes.items():

src/openlayer/lib/tracing/traces.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
from .steps import Step
66

77

8-
# Type definitions for metadata updates
9-
LLMTestCase = Dict[str, Any] # Placeholder for LLM test case data
10-
Feedback = Dict[str, Any] # Placeholder for feedback data
11-
12-
138
class Trace:
149
"""Trace, defined as a sequence of steps.
1510

0 commit comments

Comments
 (0)