Skip to content

Commit

Permalink
RemoteClient should handle metadata event on streaming (#210)
Browse files Browse the repository at this point in the history
* Handle metadata event on streaming
* Make sure not to duplicate logger error messages

Resolve: #208
  • Loading branch information
eyurtsev authored Nov 11, 2023
1 parent 7e1a1a1 commit c93e3fd
Showing 1 changed file with 8 additions and 2 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

0 comments on commit c93e3fd

Please sign in to comment.