Skip to content

Conversation

@VisargD
Copy link
Collaborator

@VisargD VisargD commented Nov 11, 2025

…eaming response handling

Title:

Description:

  • Removed redundant custom stream chunk handling and relying on the vendor OpenAI SDK response directly.

Motivation:
To avoid maintain dual stream handling logic

Related Issues:
#

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. auto:refactor labels Nov 11, 2025
@VisargD VisargD requested a review from Copilot November 13, 2025 12:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors streaming response handling for chat and text completion methods by delegating the streaming logic to the OpenAI client's native implementation instead of custom string parsing.

Key Changes:

  • Removed custom streaming response parsing logic that manually handled SSE (Server-Sent Events) data formatting
  • Delegated streaming to OpenAI client's native completions.create() and chat.completions.create() methods
  • Fixed missing await keywords in async stream method calls

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
portkey_ai/api_resources/apis/complete.py Removed custom streaming response handling for text completions and fixed async/await for stream_create call
portkey_ai/api_resources/apis/chat_complete.py Removed custom streaming response handling for chat completions and fixed async/await for stream_create call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@VisargD VisargD merged commit 05e2340 into main Nov 13, 2025
5 of 6 checks passed
@VisargD VisargD deleted the fix/remove-custom-chat-completions-stream-handling branch November 13, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto:refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants