Skip to content

Commit

Permalink
Merge branch 'main' into eugene/remove_env_variable
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev committed Nov 13, 2023
2 parents fc6b212 + fe3abc8 commit 90a35b3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions langserve/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,13 @@ def stream(
_raise_exception_from_data(
sse.data, httpx.Request(method="POST", url=endpoint)
)
elif sse.event == "metadata":
# Nothing to do for metadata for the regular remote client.
continue
elif sse.event == "end":
break
else:
logger.error(
_log_error_message_once(
f"Encountered an unsupported event type: `{sse.event}`. "
f"Try upgrading the remote client to the latest version."
f"Ignoring events of type `{sse.event}`."
Expand Down Expand Up @@ -593,10 +596,13 @@ async def astream(
_raise_exception_from_data(
sse.data, httpx.Request(method="POST", url=endpoint)
)
elif sse.event == "metadata":
# Nothing to do for metadata for the regular remote client.
continue
elif sse.event == "end":
break
else:
logger.error(
_log_error_message_once(
f"Encountered an unsupported event type: `{sse.event}`. "
f"Try upgrading the remote client to the latest version."
f"Ignoring events of type `{sse.event}`."
Expand Down
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langserve"
version = "0.0.25"
version = "0.0.26"
description = ""
readme = "README.md"
authors = ["LangChain"]
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 @@ -1596,7 +1596,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 90a35b3

Please sign in to comment.