Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ import {
SENTRY_OP,
SENTRY_ORIGIN,
} from '@sentry/conventions/attributes';
import { GEN_AI_DECIDE } from '@sentry/conventions/op';
import { GEN_AI_DECIDE, GEN_AI_EXTRACT } from '@sentry/conventions/op';
import { SDK_VERSION } from '@sentry/core';
import { expect, it } from 'vitest';
import {
GEN_AI_EXTRACT_OP,
GEN_AI_REQUEST_STREAM_ATTRIBUTE,
} from '../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
import { createRunner } from '../../../runner';
import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils';

Expand Down Expand Up @@ -250,7 +247,7 @@ it('traces a Clairic extraction', async ({ signal }) => {
is_segment: false,
attributes: {
[SENTRY_ORIGIN]: { value: 'auto.ai.cloudflare.workers_ai', type: 'string' },
[SENTRY_OP]: { value: GEN_AI_EXTRACT_OP, type: 'string' },
[SENTRY_OP]: { value: GEN_AI_EXTRACT, type: 'string' },
[GEN_AI_PROVIDER_NAME]: { value: 'cloudflare.workers_ai', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'extract', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: '@cf/cloudflare/clairic', type: 'string' },
Expand Down
6 changes: 0 additions & 6 deletions packages/server-utils/src/ai/core/gen-ai-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,3 @@ export const GEN_AI_RESPONSE_STOP_REASON_ATTRIBUTE = 'gen_ai.response.stop_reaso
* The tool call ID
*/
export const GEN_AI_TOOL_CALL_ID_ATTRIBUTE = 'gen_ai.tool.call.id';

/**
* The span op for extraction of typed fields from a state (e.g. Cloudflare Clairic)
* TODO: Import from `@sentry/conventions/op` once getsentry/sentry-conventions#728 is released
*/
export const GEN_AI_EXTRACT_OP = 'gen_ai.extract';
6 changes: 3 additions & 3 deletions packages/server-utils/src/ai/workers-ai/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import {
GEN_AI_SYSTEM_INSTRUCTIONS,
SENTRY_ORIGIN,
} from '@sentry/conventions/attributes';
import { GEN_AI_CHAT, GEN_AI_EMBEDDINGS, GEN_AI_DECIDE } from '@sentry/conventions/op';
import { GEN_AI_CHAT, GEN_AI_EMBEDDINGS, GEN_AI_DECIDE, GEN_AI_EXTRACT } from '@sentry/conventions/op';
import { isObjectLike, stringify } from '@sentry/core';
import type { Span, SpanAttributeValue } from '@sentry/core';
import { GEN_AI_EXTRACT_OP, GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes';
import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes';
import {
extractSystemInstructions,
getEvaluationInputMessages,
Expand All @@ -40,7 +40,7 @@ export const WORKERS_AI_OPERATION_SPAN_OPS: Record<WorkersAiOperationName, strin
chat: GEN_AI_CHAT,
embeddings: GEN_AI_EMBEDDINGS,
decide: GEN_AI_DECIDE,
extract: GEN_AI_EXTRACT_OP,
extract: GEN_AI_EXTRACT,
};

/**
Expand Down
Loading