Update to add streaming tests (#600)

This commit is contained in:
cybermaggedon 2026-01-06 21:48:05 +00:00 committed by GitHub
parent f0c95a4c5e
commit f79d0603f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1062 additions and 57 deletions

View file

@ -51,7 +51,8 @@ class PromptClient(RequestResponse):
end_stream = getattr(resp, 'end_of_stream', False)
if resp.text:
# Always call callback if there's text OR if it's the final message
if resp.text is not None:
last_text = resp.text
# Call chunk callback if provided with both chunk and end_of_stream flag
if chunk_callback:

View file

@ -28,14 +28,17 @@ class TextCompletionResponseTranslator(MessageTranslator):
def from_pulsar(self, obj: TextCompletionResponse) -> Dict[str, Any]:
result = {"response": obj.response}
if obj.in_token:
result["in_token"] = obj.in_token
if obj.out_token:
result["out_token"] = obj.out_token
if obj.model:
result["model"] = obj.model
# Always include end_of_stream flag for streaming support
result["end_of_stream"] = getattr(obj, "end_of_stream", False)
return result
def from_response_with_completion(self, obj: TextCompletionResponse) -> Tuple[Dict[str, Any], bool]: