Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds SDK-level support for streaming text inference by introducing an HTTP base URL alongside the existing WebSocket base URL and wiring deliveryMethod="stream" into textInference().
Changes:
- Added HTTP base URLs and a WS→HTTP mapping helper (
get_http_url_from_ws_url) for streaming requests. - Extended
EDeliveryMethodwithSTREAMand routedtextInference()to an SSE-based HTTP streaming implementation. - Added
httpxas a dependency inrequirements.txt.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| runware/utils.py | Introduces HTTP base URL constants and WS→HTTP translation helper used by streaming. |
| runware/types.py | Adds EDeliveryMethod.STREAM. |
| runware/base.py | Implements SSE streaming path for textInference() using httpx. |
| requirements.txt | Adds httpx dependency for the new streaming implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
ITextInference.deliveryMethodisEDeliveryMethod.STREAM,textInference()returns an async iterator that yields:str) fromchoices[0].delta.contentITextwithusage(ITextInferenceUsage),cost,finishReason,taskUUID_requestTextStream()in base: HTTP POST withAccept: text/event-stream, SSE line parsing (data:prefix),json.loads(line), and support for bothline.get("data")and top-level keys.TEXT_STREAM_READ_TIMEOUTin utils (milliseconds): configurable viaRUNWARE_TEXT_STREAM_TIMEOUT(default 600000, 10 min) for long-lived SSE reads.get_http_url_from_ws_url()in utils: maps WebSocket base URL to HTTP URL via_WS_TO_HTTP(fromBASE_RUNWARE_URLS/BASE_RUNWARE_HTTP_URLS)._WS_TO_HTTPdict in utils:BASE_RUNWARE_URLS[env]→BASE_RUNWARE_HTTP_URLS[env]for production and test._request_semaphoreso streamed requests count towardRUNWARE_MAX_CONCURRENT_REQUESTS.RUNWARE_TEXT_STREAM_TIMEOUTunder “Text Operations” in Configuring Timeouts.Changed
textInference(): UsesEDeliveryMethod(andrequestText.deliveryMethod) to branch; stream path returnsstream_with_semaphore()wrapper around_requestTextStream()._requestTextStream()wraps execution intry/exceptand re-raises asRunwareAPIError({"message": str(e)})for consistent error handling.ITextStreamChunk: Final stream payload is nowIText(same as sync response) withtaskType,taskUUID,finishReason,usage,cost.