Skip to content

Handle ping#1037

Merged
VisargD merged 2 commits into
Portkey-AI:mainfrom
francescov1:handle-deepinfra-ping
Apr 22, 2025
Merged

Handle ping#1037
VisargD merged 2 commits into
Portkey-AI:mainfrom
francescov1:handle-deepinfra-ping

Conversation

@francescov1
Copy link
Copy Markdown
Contributor

@francescov1 francescov1 commented Apr 13, 2025

Code Quality bug fix

Author Description

(optional)
Deepinfra streams back ping chunks on long requests. They're a weird format, here's what they look like before any processing: : ping - 2025-04-13 03:55:09.637341+00:00.

Title: Handle ping chunks from deep infra

🔄 What Changed

  • Added regex pattern to identify DeepInfra ping messages
  • Implemented filtering logic to remove ping messages from response stream
  • Ping messages like : ping - 2025-04-13 03:55:09.637341+00:00 are now properly handled

🔍 Impact of the Change

  • Fixes bug where DeepInfra ping messages were being incorrectly processed as response data
  • Improves reliability of DeepInfra integrations
  • Ensures only relevant response data is processed

📁 Total Files Changed

  • 1 file modified (src/providers/deepinfra/chatComplete.ts)
  • 9 lines added, 0 lines removed

🧪 Test Added

N/A - No tests were added in this PR

🔒 Security Vulnerabilities

N/A - No security vulnerabilities were addressed

Motivation:
Fixes a bug where DeepInfra ping messages were being incorrectly processed as part of the response data.

Related Issues:

Quality Recommendations

  1. Consider adding unit tests to verify the ping message filtering functionality

  2. Add error handling in case the regex matching fails unexpectedly

  3. Consider adding a comment explaining why these ping messages need to be filtered out

@VisargD VisargD merged commit 2561e3a into Portkey-AI:main Apr 22, 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