Skip to content

Commit

Permalink
Add trace_id param
Browse files Browse the repository at this point in the history
  • Loading branch information
akira committed Oct 28, 2024
1 parent d5a25ea commit 484b79b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4150,6 +4150,7 @@ def _submit_feedback(**kwargs):
),
feedback_source_type=ls_schemas.FeedbackSourceType.MODEL,
project_id=project_id,
trace_id=run.trace_id if run else None,
)
return results

Expand Down Expand Up @@ -4220,6 +4221,7 @@ def create_feedback(
project_id: Optional[ID_TYPE] = None,
comparative_experiment_id: Optional[ID_TYPE] = None,
feedback_group_id: Optional[ID_TYPE] = None,
trace_id: Optional[ID_TYPE] = None,
**kwargs: Any,
) -> ls_schemas.Feedback:
"""Create a feedback in the LangSmith API.
Expand Down Expand Up @@ -4313,7 +4315,7 @@ def create_feedback(
# If run_id is None, this is interpreted as session-level
# feedback.
run_id=_ensure_uuid(run_id, accept_null=True),
trace_id=_ensure_uuid(run_id, accept_null=True),
trace_id=_ensure_uuid(trace_id, accept_null=True),
key=key,
score=score,
value=value,
Expand All @@ -4335,7 +4337,11 @@ def create_feedback(
"use_multipart_endpoint", False
)

if use_multipart and self.tracing_queue is not None:
if (
use_multipart
and self.tracing_queue is not None
and feedback.trace_id is not None
):
self.tracing_queue.put(
TracingQueueItem(str(feedback.id), "feedback", feedback)
)
Expand Down

0 comments on commit 484b79b

Please sign in to comment.