-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(tracing): Add missing attributes in vercel-ai spans #18333
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: develop
Are you sure you want to change the base?
fix(tracing): Add missing attributes in vercel-ai spans #18333
Conversation
e14c708 to
830aa2e
Compare
size-limit report 📦
|
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
Also, sort the fields in the integration test, in order to more easily se which fields were missing/misnamed in the fixture objects. Fix JS-1216
830aa2e to
f5b9b31
Compare
RulaKhaled
left a comment
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 logic lgtm, I left some quick comments. We also need to a. update tests for Vercel v5 (it's a nested folder within vercel node integration tests) and b. run yarn fix in the root folder to fix lint issues
| renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, 'gen_ai.tool.output'); | ||
|
|
||
| renameAttributeKey(attributes, AI_SCHEMA_ATTRIBUTE, 'gen_ai.request.schema'); | ||
| renameAttributeKey(attributes, AI_MODEL_ID_ATTRIBUTE, 'gen_ai.request.model'); |
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.
We have GEN_AI_REQUEST_MODEL_ATTRIBUTE in packages/core/src/tracing/ai/gen-ai-attributes.ts can you use it please?
| if (typeof prompt !== 'string') return; | ||
| const maybeMessages = convertPromptToMessages(prompt); | ||
| if (maybeMessages !== undefined) { | ||
| span.setAttribute('gen_ai.request.messages', getTruncatedJsonString(maybeMessages)); |
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.
We also have GEN_AI_REQUEST_MESSAGES_ATTRIBUTE, let's use it here too!
Fix JS-1216
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).