Skip to content

Handle ping #1037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2025
Merged

Handle ping #1037

merged 2 commits into from
Apr 22, 2025

Conversation

francescov1
Copy link
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