Skip to content

Conversation

ianbbqzy
Copy link

  • to show usage for streaming requests

Description

Motivation

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

* to show usage for streaming requests
Copy link
Contributor

Code Quality bug fix

Description

Summary By MatterAI MatterAI logo

🔄 What Changed

This pull request introduces the stream_options parameter to the OpenAI text completion handler. Specifically, it adds a new entry for stream_options in the parameter mapping within src/providers/openai/complete.ts, allowing this option to be correctly passed to the OpenAI API.

🔍 Impact of the Change

This change enables the proper handling and forwarding of stream_options for OpenAI text completion requests. Without this addition, stream_options would be ignored, potentially leading to incorrect streaming behavior or missing functionality when interacting with the OpenAI API. It ensures that the handler fully supports the available parameters for text completion.

📁 Total Files Changed

  • src/providers/openai/complete.ts: Added 3 lines to include stream_options in the parameter mapping.

🧪 Test Added

N/A

🔒Security Vulnerabilities

N/A

Motivation

This change is motivated by a bug where stream_options were not being correctly included in the OpenAI text completion handler, preventing proper utilization of streaming functionalities.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

.

totalScore: 0

Tip

Quality Recommendations

  1. Add a unit test to verify that stream_options is correctly mapped and passed to the OpenAI API client.

Tanka Poem ♫

Options now flow free,
Stream's gentle current guides,
Bug's shadow now gone.
API's breath, a new design,
Code's small fix, a grander stream. ✨

Sequence Diagram

sequenceDiagram
    participant Client
    participant Handler as OpenAICompleteHandler
    participant OpenAI as OpenAI API
    
    Note over Client,Handler: Client initiates text completion request
    Client->>Handler: completeText(..., stream_options: {...})
    Note over Handler: Handler maps request parameters, including stream_options
    Handler->>OpenAI: POST /v1/completions (..., stream_options: {...})
    OpenAI-->>Handler: CompletionResponse
    Handler-->>Client: ProcessedResponse
Loading

Copy link
Contributor

Added stream_options parameter mapping for OpenAI text completion handler

@VisargD VisargD merged commit 85f1c4e into Portkey-AI:main Sep 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants