-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add tracing, factor out some helper functions, fix a few bugs with Nodejs mode #68
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
} | ||
|
||
// https://github.com/openai/openai-node/blob/07b3504e1c40fd929f4aae1651b83afc19e3baf8/src/resources/chat/completions.ts#L43-L49 | ||
// Updated for https://github.com/openai/openai-node/commit/f10c757d831d90407ba47b4659d9cd34b1a35b1d |
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.
Is this comment superseded by the next 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.
Not sure. It's just copy/pasted from Vercel's code. Would rather not change it.
packages/proxy/src/proxy.ts
Outdated
@@ -65,6 +71,12 @@ export interface CacheKeyOptions { | |||
excludeOrgName?: boolean; | |||
} | |||
|
|||
export interface SpanLogging { |
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.
nit: for uniformity, should we name this type SpanLogger
?
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.
yep
setName: (name: string) => void; | ||
log: (args: ExperimentLogPartialArgs) => void; | ||
end: () => void; | ||
} |
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.
do we need to explicitly flush the logger here, or is it guaranteed that the beforeExit
event will fire in all environments that we run this?
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.
I think it's ok to make it the responsibility of the caller (which is currently our own tightly controlled server, where asyncFlush
is false by default anyway).
This change is a bunch of small tweaks. To summarize:
fetch
decompresses data, while workerd's does not. Also, we weren't properly closing streams based on how we use Vercel's AI SDK parser, so I just rewrote that to use our own streaming logic and pulled out the parser code.