Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions packages/core/src/tracing/vercel-ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
import type { ProviderMetadata } from './vercel-ai-attributes';
import {
AI_MODEL_ID_ATTRIBUTE,
AI_MODEL_PROVIDER_ATTRIBUTE,
AI_PROMPT_MESSAGES_ATTRIBUTE,
AI_PROMPT_TOOLS_ATTRIBUTE,
AI_RESPONSE_OBJECT_ATTRIBUTE,
Expand Down Expand Up @@ -65,12 +64,10 @@ function onVercelAiSpanStart(span: Span): void {
return;
}

// The AI and Provider must be defined for generate, stream, and embed spans.
// The id of the model
// The AI model ID must be defined for generate, stream, and embed spans.
// The provider is optional and may not always be present.
const aiModelId = attributes[AI_MODEL_ID_ATTRIBUTE];
// the provider of the model
const aiModelProvider = attributes[AI_MODEL_PROVIDER_ATTRIBUTE];
if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {
if (typeof aiModelId !== 'string' || !aiModelId) {
return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing regression test for the fix (Bugbot Rules)

This is flagged because it was mentioned in the rules file. This is a fix PR that relaxes the validation to only require ai.model.id instead of both ai.model.id and ai.model.provider. The rules specify that fix PRs should include at least one test that tests the regression being fixed (a test that failed before the fix and passes after). There's no test in this PR that verifies spans without the provider attribute are now processed correctly.

Fix in Cursor Fix in Web

}

Expand Down
Loading