Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion python/restate/ext/pydantic/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ async def request_stream_run():
pass
return streamed_response.get()

context = current_context()
if context is None:
raise UserError(
"A model cannot be used without a Restate context. Make sure to run it within an agent or a run context."
)
try:
response = await self._context.run_typed("Model stream call", request_stream_run, self._options)
response = await context.run_typed("Model stream call", request_stream_run, self._options)
yield RestateStreamedResponse(model_request_parameters, response)
except SdkInternalBaseException as e:
raise Exception("Internal error during model stream call") from e
Loading