-
Notifications
You must be signed in to change notification settings - Fork 71
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
chore(weave): capture request id for openai completions #3153
Conversation
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=4efabd9d7845b7b0d0f661564ba87b117aaf7e57 |
9f58d95
to
d98cafc
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d98cafc
to
7f917fa
Compare
@@ -64,7 +64,7 @@ def test_instructor_openai( | |||
assert op_name_from_ref(call.op_name) == "openai.chat.completions.create" | |||
output = call.output | |||
output_arguments = json.loads( | |||
output.choices[0].message.tool_calls[0].function.arguments | |||
output["choices"][0]["message"]["tool_calls"][0]["function"]["arguments"] |
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.
why do you have to change from dot to bracket notation?
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.
The output here comes from the post processor I'm modifying. In practice value
can have many types depending on integrations, sdk versions, and I think even the type of completion being requested. In some cases the post processor returns a pydantic object, in some cases it returns a dict. For the standard case where we receive a ChatCompletion
we will now return a dict with this extra key. The alternative would be adding the attribute to the pydantic class which feels hackier, and ultimately I think the output just gets dumped later in our pipe anyway.
7f917fa
to
e7df7c2
Compare
Description
Openai integration captures the request id from completion responses and adds them to
request_id
on the call output.