-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(server-utils): Instrument Vercel AI experimental_evaluate #24694
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
91d6874
feat(server-utils): Instrument Vercel AI experimental_evaluate
andreiborza 7086acf
Use GEN_AI_OPERATION_NAME from conventions in evaluate test
andreiborza e0ff82e
Cover lossless answers and disabled recording in evaluate tests
andreiborza e9fa86c
Restore TypeSafe answer confidence from provider metadata
andreiborza 5c2d6cf
Check only span attributes in evaluate privacy tests
andreiborza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/instrument-evaluate.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import * as Sentry from '@sentry/node'; | ||
| import { loggingTransport } from '@sentry-internal/node-integration-tests'; | ||
|
|
||
| Sentry.init({ | ||
| dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
| release: '1.0', | ||
| tracesSampleRate: 1.0, | ||
| // `NO_RECORDING` turns off recording of inputs and outputs for the privacy test. | ||
| dataCollection: process.env.NO_RECORDING ? { genAI: { inputs: false, outputs: false } } : {}, | ||
| transport: loggingTransport, | ||
| }); |
43 changes: 43 additions & 0 deletions
43
dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/scenario-evaluate.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import * as Sentry from '@sentry/node'; | ||
| import { experimental_evaluate } from 'ai'; | ||
| import { Experimental_EvaluationMockModelV4 } from 'ai/test'; | ||
|
|
||
| async function run() { | ||
| await Sentry.startSpan({ op: 'function', name: 'main' }, async () => { | ||
| await experimental_evaluate({ | ||
| model: new Experimental_EvaluationMockModelV4({ | ||
| provider: 'gateway', | ||
| modelId: 'typesafe-ai/jev', | ||
| doEvaluate: async () => ({ | ||
| answers: { | ||
| authIssue: { type: 'boolean', probability: 0.97 }, | ||
| department: { | ||
| type: 'choice', | ||
| choice: 'billing', | ||
| probabilities: { billing: 0.64, technical: 0.36 }, | ||
| }, | ||
| wantsRefund: { type: 'boolean', probability: 0.99 }, | ||
| urgency: { type: 'score', score: 1.8, probabilities: { 0: 0, 1: 0.2, 2: 0.8 } }, | ||
| }, | ||
| usage: { inputTokens: 275, outputTokens: 20 }, | ||
| // What the AI SDK TypeSafe provider returns: answer confidence moves into provider metadata. | ||
| providerMetadata: { typesafe: { confidence: { department: 0.28 } } }, | ||
| warnings: [], | ||
| }), | ||
| }), | ||
| state: 'I cannot log in, and I also want a refund for last month.', | ||
| questions: { | ||
| authIssue: { type: 'boolean', instructions: 'Is there a login problem?' }, | ||
| department: { | ||
| type: 'choice', | ||
| instructions: 'Which team should handle this?', | ||
| criteria: { billing: 'Charges and refunds', technical: 'Bugs and outages' }, | ||
| }, | ||
| wantsRefund: { type: 'boolean', instructions: 'Is a refund requested?' }, | ||
| urgency: { type: 'score', instructions: 'How urgent is this ticket?', criteria: ['low', 'medium', 'high'] }, | ||
| }, | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have PR for that yet?
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 yet, I want to wait a bit on the RFC before finalizing-finalzing that.