Skip to content

Commit

Permalink
Add feedback created id (#206)
Browse files Browse the repository at this point in the history
Add feedback created id
  • Loading branch information
eyurtsev authored Nov 10, 2023
1 parent 13dcfb4 commit 7e1a1a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions langserve/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class Feedback(BaseFeedback):
Represents feedback given on an individual run
"""

id: UUID
"""The unique ID of the feedback that was created."""

created_at: datetime
"""The time the feedback was created."""

Expand Down
1 change: 1 addition & 0 deletions langserve/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@ async def feedback(feedback_create_req: FeedbackCreateRequest) -> Feedback:
# using "Extra.allow" in pydantic since syntax changes between pydantic
# 1.x and 2.x for this functionality
return Feedback(
id=str(feedback_from_langsmith.id),
run_id=str(feedback_from_langsmith.run_id),
created_at=str(feedback_from_langsmith.created_at),
modified_at=str(feedback_from_langsmith.modified_at),
Expand Down
7 changes: 6 additions & 1 deletion tests/unit_tests/test_server_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,12 @@ async def test_feedback_succeeds_when_langsmith_enabled() -> None:
"value": None,
}

assert response.json() == expected_response_json
json_response = response.json()

assert "id" in json_response
del json_response["id"]

assert json_response == expected_response_json


@pytest.mark.asyncio
Expand Down

0 comments on commit 7e1a1a1

Please sign in to comment.