-
Notifications
You must be signed in to change notification settings - Fork 364
hotfix: added better error parsing for stream parsing #3379
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ No documentation updates required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Implemented centralized stream parsing with improved error handling across OpenAI, Anthropic, and TogetherAI processors through a new shared helper function.
- Added new
mapLines
helper in/valhalla/jawn/src/lib/shared/bodyProcessors/helpers.ts
to standardize stream parsing across providers - Enhanced error logging by including provider-specific context in error messages
- Standardized handling of '[DONE]' markers and 'data:' prefix removal across all processors
- Improved Claude-3 token usage tracking with cache-related fields in
/valhalla/jawn/src/lib/shared/bodyProcessors/anthropicStreamBodyProcessor.ts
- Removed redundant line parsing logic from individual processor implementations
4 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
console.log( | ||
`Helicone had an error parsing this line: ${line} for provider ${provider}` | ||
); | ||
return err({ msg: `Helicone had an error parsing this line: `, line }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Error message is incomplete - missing the actual line content that was referenced in the template literal
return err({ msg: `Helicone had an error parsing this line: `, line }); | |
return err({ msg: `Helicone had an error parsing this line: ${line}`, line }); |
export function mapLines(lines: string[], provider: string): any[] { | ||
return lines.map((line, i) => { | ||
try { | ||
const chunk = line.replace("data:", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: line.replace() will only replace first occurrence of 'data:'. Use replaceAll() if multiple occurrences need to be handled
Summary
🚨 3 failed
|
No description provided.