Skip to content
Closed
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 @@ -4,7 +4,7 @@ import { MockLanguageModelV3 } from 'ai/test';

// Calls routed through the Vercel AI Gateway carry a `gateway` key in `providerMetadata` instead of a
// provider name, so cache counts can only be derived from the SDK's normalized usage object.
async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
await generateText({
experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
Expand All @@ -27,5 +27,3 @@ async function run() {
});
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function consume(result) {
}
}

async function run() {
export async function run() {
// A single model instance shared by two *concurrent* streamText calls. The shared model carries
// only a single captured-parent slot, so naive parent tracking could attribute a model call to
// whichever operation resolved the model last. Each `generate_content` (doStream) must land under
Expand All @@ -57,5 +57,3 @@ async function run() {
await Promise.all(streams.map(consume));
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function makeModel(text) {
});
}

async function run() {
export async function run() {
// A single model instance shared by two *concurrent* generateText calls. This
// is the case where naive parent tracking could attribute a model call to the
// wrong invoke_agent span; each generate_content must land under its own
Expand All @@ -39,5 +39,3 @@ async function run() {
]);
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const toolCallModel = new MockLanguageModelV3({
}),
});

async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
// A turn of an OpenAI Conversations API conversation.
await generateText({
Expand Down Expand Up @@ -71,5 +71,3 @@ async function run() {
});
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Sentry from '@sentry/node';
import { generateText } from 'ai';
import { MockLanguageModelV3 } from 'ai/test';

async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
await generateText({
experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
Expand Down Expand Up @@ -31,5 +31,3 @@ async function run() {
});
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { z } from 'zod';
// output now flows through the `streamText` primitive with an `experimental_output`, which does. So a
// streamed structured-output call must still produce the usual streamText/doStream spans, with the
// streamed JSON captured as the output.
async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
const result = streamText({
experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
Expand Down Expand Up @@ -44,5 +44,3 @@ async function run() {
}
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Sentry from '@sentry/node';
import { streamText } from 'ai';
import { MockLanguageModelV3, simulateReadableStream } from 'ai/test';

async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
const result = streamText({
experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
Expand Down Expand Up @@ -38,5 +38,3 @@ async function run() {
}
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { stepCountIs, streamText, tool } from 'ai';
import { MockLanguageModelV3, simulateReadableStream } from 'ai/test';
import { z } from 'zod';

async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
let callCount = 0;

Expand Down Expand Up @@ -74,5 +74,3 @@ async function run() {
}
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const model = () =>
const brief = { role: 'system', content: 'Be brief.' };
const kind = { role: 'system', content: 'Be kind.' };

async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
// v6 reads `system`, v7 reads `instructions`.
await generateText({
Expand All @@ -38,5 +38,3 @@ async function run() {
});
});
}

run();
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ToolLoopAgent, stepCountIs, tool } from 'ai';
import { MockLanguageModelV3 } from 'ai/test';
import { z } from 'zod';

async function run() {
export async function run() {
await Sentry.startSpan({ op: 'function', name: 'main' }, async () => {
let callCount = 0;

Expand Down Expand Up @@ -57,5 +57,3 @@ async function run() {
});
});
}

run();
Loading
Loading