diff --git a/.github/workflows/openai-vercel-gateway-tests.yml b/.github/workflows/openai-vercel-gateway-tests.yml new file mode 100644 index 000000000..b3bb7dd03 --- /dev/null +++ b/.github/workflows/openai-vercel-gateway-tests.yml @@ -0,0 +1,80 @@ +name: OpenAI Vercel gateway tests + +on: + pull_request: + branches: [dev, main] + paths: + - 'typescript/packages/traceai_openai/**' + - 'typescript/packages/fi-core/**' + - 'typescript/packages/fi-semantic-conventions/**' + - 'typescript/pnpm-lock.yaml' + - '.github/workflows/openai-vercel-gateway-tests.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + contracts: + name: Vercel gateway OpenAI ${{ matrix.sdk }} + runs-on: ubuntu-24.04 + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + # 7.x is a manual attribution probe, not expanded automatic-hook support. + sdk: ['4.0.0', '5.23.2', '7.47.0'] + defaults: + run: + shell: bash + working-directory: typescript + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '22.23.4' + - name: Install pinned dependencies + run: | + mkdir -p "$RUNNER_TEMP/corepack-bin" + corepack enable --install-directory "$RUNNER_TEMP/corepack-bin" pnpm + echo "$RUNNER_TEMP/corepack-bin" >> "$GITHUB_PATH" + corepack pnpm --filter @traceai/openai... install --frozen-lockfile --ignore-scripts + npm install --prefix "$RUNNER_TEMP/openai-sdk" --ignore-scripts --no-audit --no-fund "openai@${{ matrix.sdk }}" + - name: Build package + run: | + pnpm run build:deps + pnpm --filter @traceai/openai run build + - name: Install packed package for the qualified client types + if: matrix.sdk == '5.23.2' + run: | + mkdir -p "$RUNNER_TEMP/gateway-pack" + pnpm --dir packages/traceai_openai pack --pack-destination "$RUNNER_TEMP/gateway-pack" + npm install --prefix "$RUNNER_TEMP/openai-sdk" --ignore-scripts --no-audit --no-fund "$RUNNER_TEMP"/gateway-pack/*.tgz + cp packages/traceai_openai/test/moduleTypes.mts packages/traceai_openai/test/moduleTypes.cts "$RUNNER_TEMP/openai-sdk/" + - name: Network-isolated ESM and CommonJS type contracts + if: matrix.sdk == '5.23.2' + run: | + sudo unshare --net -- bash -c 'ip link set lo up; exec "$@"' bash \ + env PATH="$PATH" node node_modules/typescript/bin/tsc --noEmit \ + --module NodeNext --moduleResolution NodeNext --target ES2022 --strict --skipLibCheck \ + "$RUNNER_TEMP/openai-sdk/moduleTypes.mts" "$RUNNER_TEMP/openai-sdk/moduleTypes.cts" + - name: Network-isolated SDK and OTLP contracts + env: + OPENAI_TEST_SDK: ${{ runner.temp }}/openai-sdk/node_modules/openai + run: | + for hide in false true; do + sudo unshare --net -- bash -c 'ip link set lo up; exec "$@"' bash \ + env PATH="$PATH" OPENAI_TEST_SDK="$OPENAI_TEST_SDK" \ + FI_HIDE_INPUTS="$hide" FI_HIDE_OUTPUTS="$hide" \ + FI_HIDE_LLM_INVOCATION_PARAMETERS="$hide" FI_HIDE_ERROR_DETAILS="$hide" \ + node --test packages/traceai_openai/test/vercelGateway.cjs + done + - name: Network-isolated locked SDK unit suite + if: matrix.sdk == '5.23.2' + run: | + sudo unshare --net -- bash -c 'ip link set lo up; exec "$@"' bash \ + env PATH="$PATH" node packages/traceai_openai/node_modules/jest/bin/jest.js \ + --config packages/traceai_openai/jest.config.js --runInBand diff --git a/typescript/packages/traceai_openai/README.md b/typescript/packages/traceai_openai/README.md index 6c1decf43..9e73bff78 100644 --- a/typescript/packages/traceai_openai/README.md +++ b/typescript/packages/traceai_openai/README.md @@ -93,6 +93,62 @@ try { } ``` +## Vercel AI Gateway + +Use the same instrumentor for the gateway's OpenAI-compatible client; do not add a second gateway instrumentor. This non-streaming Chat Completions recipe uses `openai@5.23.2`. The declared peer and automatic-hook range remains OpenAI 4.x/5.x, not 6.x/7.x. For applications using `ai` instead of `openai`, use the [Vercel AI SDK integration](https://docs.futureagi.com/docs/integrations/traceai/vercel). + +```bash +npm install @traceai/openai @traceai/fi-core@1.1.0 openai@5.23.2 +export AI_GATEWAY_API_KEY="your-vercel-gateway-key" +export AI_GATEWAY_MODEL="provider/model" +export FI_API_KEY="your-futureagi-api-key" +export FI_SECRET_KEY="your-futureagi-secret-key" +# Keep prompt, answer, invocation and error content out of telemetry. +export FI_HIDE_INPUTS=true +export FI_HIDE_OUTPUTS=true +export FI_HIDE_LLM_INVOCATION_PARAMETERS=true +export FI_HIDE_ERROR_DETAILS=true +``` + +Choose `AI_GATEWAY_MODEL` from [Vercel's model list](https://vercel.com/docs/ai-gateway/models-and-providers). With Node.js 22.23.4 or later, save as `gateway.mts` and run `node gateway.mts`: + +```typescript +import OpenAI from "openai"; +import { register, ProjectType } from "@traceai/fi-core"; +import { OpenAIInstrumentation } from "@traceai/openai"; + +const model = process.env.AI_GATEWAY_MODEL; +if (!model) throw new Error("Set AI_GATEWAY_MODEL to a Vercel model ID."); + +const provider = register({ + projectName: "my-gateway-app", + projectType: ProjectType.OBSERVE, +}); +const instrumentation = new OpenAIInstrumentation(); +instrumentation.setTracerProvider(provider); +instrumentation.manuallyInstrument(OpenAI); + +const client = new OpenAI({ + baseURL: "https://ai-gateway.vercel.sh/v1", + apiKey: process.env.AI_GATEWAY_API_KEY, +}); +try { + const response = await client.chat.completions.create({ + model, + messages: [{ role: "user", content: "Say hello in five words." }], + }); + console.log(response.choices[0].message.content); +} finally { + await provider.shutdown(); +} +``` + +`gen_ai.provider.name=vercel` identifies the receiving gateway at `ai-gateway.vercel.sh`, not a model's author or the gateway's eventual upstream provider. Attribution is set before the request, including for failed calls, and is shared by Chat Completions, Completions, Responses and Embeddings. This is instrumentor coverage, not a claim that Vercel implements every OpenAI endpoint. Other endpoints retain their existing attribution behavior. + +Open **Observe → my-gateway-app** to see the client span. Successful non-streaming Chat Completions include the response model and reported usage; absent usage is not zero. Content hiding does not remove model names or token counts and does not hide requests from Vercel. Tool definitions and custom attributes need their own privacy review. + +This route does not expose gateway routing, upstream retries or billing. [Vercel Trace Drains](https://vercel.com/docs/ai-gateway/observability-and-spend/trace-drains) are a separate server-side source without prompts or completions. Do not sum their usage with application spans or layer multiple instrumentors on the same client call. This recipe does not configure a drain destination. + ## Environment Variables The following environment variables are required: diff --git a/typescript/packages/traceai_openai/package.json b/typescript/packages/traceai_openai/package.json index b2f62159b..3691aa9f7 100644 --- a/typescript/packages/traceai_openai/package.json +++ b/typescript/packages/traceai_openai/package.json @@ -8,9 +8,14 @@ "types": "./dist/src/index.d.ts", "exports": { ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/esm/index.js", - "require": "./dist/src/index.js" + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/src/index.d.ts", + "default": "./dist/src/index.js" + } } }, "scripts": { @@ -53,10 +58,11 @@ "@opentelemetry/semantic-conventions": "^1.34.0", "@types/jest": "^29.5.12", "jest": "^29.7.0", - "ts-jest": "^29.1.4", "openai": "^4.52.7", "rimraf": "^6.0.1", - "tsc-alias": "^1.8.16" + "ts-jest": "^29.1.4", + "tsc-alias": "^1.8.16", + "zod": "^3.25.76" }, "keywords": [ "opentelemetry", diff --git a/typescript/packages/traceai_openai/src/instrumentation.ts b/typescript/packages/traceai_openai/src/instrumentation.ts index 95857f102..1666ed598 100644 --- a/typescript/packages/traceai_openai/src/instrumentation.ts +++ b/typescript/packages/traceai_openai/src/instrumentation.ts @@ -60,6 +60,33 @@ import { const MODULE_NAME = "openai"; +/** Attribute the receiving service, not a model's author or a guessed fallback route. */ +function providerForResource(resource: unknown): string { + try { + // OpenAI 4.0 uses `client`; later clients use `_client`. Resolve per request + // because different clients (or a changed baseURL) can share patched methods. + const owner = resource as { + _client?: { baseURL?: unknown }; + client?: { baseURL?: unknown }; + } | null; + const baseURL = (owner?._client ?? owner?.client)?.baseURL; + if (typeof baseURL === "string") { + const url = new URL(baseURL); + if ( + (url.protocol === "https:" || url.protocol === "http:") && + url.hostname.toLowerCase().replace(/\.$/, "") === "ai-gateway.vercel.sh" + ) { + return "vercel"; + } + } + } catch { + // Do not log the URL or the exception: either can contain credentials. + diag.debug("@traceai/openai: unable to resolve endpoint provider; retaining compatibility attribution"); + } + // Preserve historical attribution for all other endpoints. Never export the URL. + return LLMProvider.OPENAI; +} + /** * Flag to check if the openai module has been patched * Note: This is a fallback in case the module is made immutable (e.x. Deno, webpack, etc.) @@ -216,7 +243,7 @@ export class OpenAIInstrumentation extends InstrumentationBase{ [SemanticConventions.INPUT_MIME_TYPE]: MimeType.JSON, [SemanticConventions.LLM_INVOCATION_PARAMETERS]: JSON.stringify(invocationParameters), - [SemanticConventions.LLM_PROVIDER]: LLMProvider.OPENAI, + [SemanticConventions.LLM_PROVIDER]: providerForResource(this), [SemanticConventions.GEN_AI_OPERATION_NAME]: "chat", ...getLLMInputMessagesAttributes(body), ...getLLMToolsJSONSchema(body), @@ -310,7 +337,7 @@ export class OpenAIInstrumentation extends InstrumentationBase{ [SemanticConventions.LLM_MODEL_NAME]: body.model, [SemanticConventions.LLM_INVOCATION_PARAMETERS]: JSON.stringify(invocationParameters), - [SemanticConventions.LLM_PROVIDER]: LLMProvider.OPENAI, + [SemanticConventions.LLM_PROVIDER]: providerForResource(this), [SemanticConventions.GEN_AI_OPERATION_NAME]: "text_completion", ...getCompletionInputValueAndMimeType(body), [SemanticConventions.RAW_INPUT]: safelyJSONStringify(body) ?? "", @@ -396,6 +423,7 @@ export class OpenAIInstrumentation extends InstrumentationBase{ [SemanticConventions.INPUT_MIME_TYPE]: isStringInput ? MimeType.TEXT : MimeType.JSON, + [SemanticConventions.LLM_PROVIDER]: providerForResource(this), [SemanticConventions.GEN_AI_OPERATION_NAME]: "embeddings", ...getEmbeddingTextAttributes(body), [SemanticConventions.RAW_INPUT]: safelyJSONStringify(body) ?? "", @@ -473,7 +501,7 @@ export class OpenAIInstrumentation extends InstrumentationBase{ [SemanticConventions.INPUT_MIME_TYPE]: MimeType.JSON, [SemanticConventions.LLM_INVOCATION_PARAMETERS]: JSON.stringify(invocationParameters), - [SemanticConventions.LLM_PROVIDER]: LLMProvider.OPENAI, + [SemanticConventions.LLM_PROVIDER]: providerForResource(this), [SemanticConventions.GEN_AI_OPERATION_NAME]: "chat", ...getResponsesInputMessagesAttributes(body), ...getLLMToolsJSONSchema(body), diff --git a/typescript/packages/traceai_openai/test/moduleTypes.cts b/typescript/packages/traceai_openai/test/moduleTypes.cts new file mode 100644 index 000000000..4174f04b0 --- /dev/null +++ b/typescript/packages/traceai_openai/test/moduleTypes.cts @@ -0,0 +1,5 @@ +import OpenAI from "openai"; +import { OpenAIInstrumentation } from "@traceai/openai"; + +// Keep the existing CommonJS entry point and declaration working. +new OpenAIInstrumentation().manuallyInstrument(OpenAI); diff --git a/typescript/packages/traceai_openai/test/moduleTypes.mts b/typescript/packages/traceai_openai/test/moduleTypes.mts new file mode 100644 index 000000000..f78547078 --- /dev/null +++ b/typescript/packages/traceai_openai/test/moduleTypes.mts @@ -0,0 +1,5 @@ +import OpenAI from "openai"; +import { OpenAIInstrumentation } from "@traceai/openai"; + +// ESM must resolve the ESM OpenAI declaration, not its nominally distinct CJS type. +new OpenAIInstrumentation().manuallyInstrument(OpenAI); diff --git a/typescript/packages/traceai_openai/test/vercelGateway.cjs b/typescript/packages/traceai_openai/test/vercelGateway.cjs new file mode 100644 index 000000000..b7d3c0362 --- /dev/null +++ b/typescript/packages/traceai_openai/test/vercelGateway.cjs @@ -0,0 +1,207 @@ +// Actual OpenAI SDK calls with synthetic fetch responses and a localhost OTLP receiver. +// Run only with outbound networking disabled (loopback allowed). +const assert = require('node:assert/strict'); +const http = require('node:http'); +const { once } = require('node:events'); +const { test, before, after, beforeEach } = require('node:test'); +const SDK = require(process.env.OPENAI_TEST_SDK || 'openai'); +const OpenAI = SDK.OpenAI; +const { SemanticConventions: SC } = require('@traceai/fi-semantic-conventions'); +const { register, ProjectType } = require('@traceai/fi-core'); +const { OpenAIInstrumentation } = require('../dist/src'); +const { diag, DiagLogLevel } = require('@opentelemetry/api'); +const diagnostics = []; +diag.setLogger({ debug: (...args) => diagnostics.push(args), info() {}, warn() {}, error() {}, verbose() {} }, DiagLogLevel.DEBUG); + +const gateway = 'https://ai-gateway.vercel.sh/v1'; +const requestedModel = 'vendor/requested-model'; +const responseModel = 'different-vendor/resolved-model'; +const key = 'synthetic-gateway-credential'; +const payloads = []; +let provider; +let server; + +function attributes(list) { + return Object.fromEntries(list.map(({ key, value }) => [key, + value.stringValue ?? (value.intValue === undefined ? undefined : Number(value.intValue)) + ?? value.doubleValue ?? value.boolValue])); +} +function wireSpans() { + return payloads.flatMap(p => p.resourceSpans.flatMap(r => { + assert.equal(attributes(r.resource.attributes).project_name, 'vercel-gateway-contract'); + return r.scopeSpans.flatMap(s => s.spans); + })); +} +function json(body, status = 200) { + return new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } }); +} +function reply(kind) { + const usage = { prompt_tokens: 3, completion_tokens: 2, total_tokens: 5 }; + if (kind === 'embeddings') return { object: 'list', model: responseModel, + data: [{ object: 'embedding', index: 0, embedding: [0.1, 0.2] }], usage }; + if (kind === 'responses') return { object: 'response', id: 'resp_synthetic', model: responseModel, + status: 'completed', output: [{ type: 'message', role: 'assistant', content: [ + { type: 'output_text', text: 'synthetic-output', annotations: [] }], status: 'completed' }], + usage: { input_tokens: 3, output_tokens: 2, total_tokens: 5 } }; + return { object: kind === 'chat' ? 'chat.completion' : 'text_completion', id: 'cmpl_synthetic', + model: responseModel, created: 1, usage, choices: [{ index: 0, finish_reason: 'stop', + ...(kind === 'chat' ? { message: { role: 'assistant', content: 'synthetic-output' } } + : { text: 'synthetic-output' }) }] }; +} +function client(baseURL = gateway, kind = 'chat', fail = false, stream = false) { + return new OpenAI({ baseURL, apiKey: key, maxRetries: 0, fetch: async (_url, init) => { + // Ensure tracing did not mutate the SDK request or credentials. + const body = JSON.parse(init.body); + assert.equal(body.model, requestedModel); + if (fail) return json({ error: { message: 'synthetic-error-content', type: 'invalid_request_error' } }, 400); + if (stream) { + const chunks = [ + { id: 'chunk_synthetic', object: 'chat.completion.chunk', created: 1, model: responseModel, + choices: [{ index: 0, delta: { role: 'assistant', content: 'synthetic-output' }, finish_reason: null }] }, + { id: 'chunk_synthetic', object: 'chat.completion.chunk', created: 1, model: responseModel, + choices: [{ index: 0, delta: {}, finish_reason: 'stop' }], + usage: { prompt_tokens: 3, completion_tokens: 2, total_tokens: 5 } }, + ]; + return new Response(chunks.map(c => `data: ${JSON.stringify(c)}\n\n`).join('') + 'data: [DONE]\n\n', + { headers: { 'content-type': 'text/event-stream' } }); + } + return json(reply(kind)); + } }); +} +function invoke(sdk, kind) { + if (kind === 'chat') return sdk.chat.completions.create({ model: requestedModel, + messages: [{ role: 'user', content: 'synthetic-input' }] }); + if (kind === 'completions') return sdk.completions.create({ model: requestedModel, prompt: 'synthetic-input' }); + return sdk[kind].create({ model: requestedModel, input: 'synthetic-input' }); +} +async function check(expected, kind = 'chat', error = false, streaming = false) { + await provider.forceFlush(); + const spans = wireSpans(); + assert.equal(spans.length, 1, 'exactly one client span, not one per instrumentation registration'); + const span = spans[0]; + const attrs = attributes(span.attributes); + assert.equal(attrs['gen_ai.provider.name'], expected); + if (!streaming) assert.equal(span.status.code, error ? 2 : 1); + if (kind !== 'embeddings') { + assert.equal(attrs[SC.LLM_MODEL_NAME], error || streaming ? requestedModel : responseModel); + if (!error && !streaming) { + assert.equal(attrs[SC.LLM_TOKEN_COUNT_PROMPT], 3); + assert.equal(attrs[SC.LLM_TOKEN_COUNT_COMPLETION], 2); + assert.equal(attrs[SC.LLM_TOKEN_COUNT_TOTAL], 5); + } + } + const wire = JSON.stringify(payloads); + for (const marker of [key, 'url-user-marker', 'url-password-marker', 'url-query-marker', 'url-path-marker', 'url-fragment-marker']) { + assert.ok(!wire.includes(marker), `URL or credential marker leaked: ${marker}`); + } + if (process.env.FI_HIDE_INPUTS === 'true' && kind !== 'embeddings') { + for (const marker of ['synthetic-input', 'synthetic-output', 'synthetic-error-content']) { + assert.ok(!wire.includes(marker), `content marker leaked: ${marker}`); + } + } + return attrs; +} + +before(async () => { + server = http.createServer((req, res) => { + const chunks = []; + req.on('data', c => chunks.push(c)); + req.on('end', () => { + assert.equal(req.url, '/tracer/v1/traces'); + assert.equal(req.headers['x-api-key'], 'synthetic-fi-api'); + assert.equal(req.headers['x-secret-key'], 'synthetic-fi-secret'); + payloads.push(JSON.parse(Buffer.concat(chunks).toString())); + res.writeHead(200, { 'content-type': 'application/json' }); + res.end('{}'); + }); + }); + server.listen(0, '127.0.0.1'); + await once(server, 'listening'); + provider = register({ projectName: 'vercel-gateway-contract', projectType: ProjectType.OBSERVE, + endpoint: `http://127.0.0.1:${server.address().port}/tracer/v1/traces`, batch: false, + headers: { 'X-Api-Key': 'synthetic-fi-api', 'X-Secret-Key': 'synthetic-fi-secret' } }); + const instrumentation = new OpenAIInstrumentation(); + instrumentation.setTracerProvider(provider); + instrumentation.manuallyInstrument(SDK); + instrumentation.manuallyInstrument(SDK); +}); +beforeEach(async () => { await provider.forceFlush(); payloads.length = 0; diagnostics.length = 0; }); +after(async () => { await provider?.shutdown(); if (server) await new Promise(r => server.close(r)); }); + +for (const kind of ['chat', 'completions', 'embeddings', ...(OpenAI.Responses ? ['responses'] : [])]) { + test(`${kind}: gateway attribution survives a different response model`, async () => { + const result = await invoke(client(gateway, kind), kind); + assert.equal(result.model, responseModel); + await check('vercel', kind); + }); + test(`${kind}: gateway attribution exists before an HTTP failure`, async () => { + await assert.rejects(invoke(client(gateway, kind, true), kind), { status: 400 }); + await check('vercel', kind, true); + }); +} +for (const baseURL of [ + 'https://AI-GATEWAY.VERCEL.SH/v1', 'https://ai-gateway.vercel.sh.:443/v1', + 'https://url-user-marker:url-password-marker@ai-gateway.vercel.sh:8443/url-path-marker?token=url-query-marker#url-fragment-marker', +]) { + test(`exact normalized gateway host: ${baseURL}`, async () => { + await invoke(client(baseURL), 'chat'); + await check('vercel'); + }); +} +for (const baseURL of [ + 'https://api.openai.com/v1', 'https://proxy.example/v1', + 'https://ai-gateway.vercel.sh.evil.example/v1', 'https://not-ai-gateway.vercel.sh/v1', + 'https://ai-gateway.vercel.sh@evil.example/v1', 'https://evil.example/ai-gateway.vercel.sh/v1', +]) { + test(`preserve existing provider behavior outside the gateway: ${baseURL}`, async () => { + await invoke(client(baseURL), 'chat'); + await check('openai'); + }); +} +test('resolve per request after changing the SDK base URL', async () => { + const sdk = client(); + await invoke(sdk, 'chat'); + await check('vercel'); + payloads.length = 0; + sdk.baseURL = 'https://api.openai.com/v1'; + await invoke(sdk, 'chat'); + await check('openai'); +}); +test('concurrent clients do not share gateway attribution', async () => { + await Promise.all([invoke(client(), 'chat'), invoke(client('https://api.openai.com/v1'), 'chat')]); + await provider.forceFlush(); + const spans = wireSpans(); + assert.equal(spans.length, 2); + assert.deepEqual(spans.map(s => attributes(s.attributes)['gen_ai.provider.name']).sort(), ['openai', 'vercel']); +}); +for (const value of [undefined, 'not-a-url', new Error('url-password-marker')]) { + test(`unavailable SDK metadata does not break the request: ${String(value)}`, async () => { + const sdk = client(); + let reads = 0; + Object.defineProperty(sdk, 'baseURL', { get() { + // Metadata is unavailable to tracing; the SDK still obtains a working URL. + if (reads++ > 0) return gateway; + if (value instanceof Error) throw value; + return value; + } }); + await invoke(sdk, 'chat'); + await check('openai'); + if (value !== undefined) assert.ok(diagnostics.some(args => String(args[0]).includes('unable to resolve endpoint provider'))); + assert.ok(!require('node:util').inspect(diagnostics).includes('url-password-marker')); + }); +} +// The 4.0.0 SDK has no Stream.tee(); that existing lifecycle defect is repaired separately. +const sdkDirectory = require('node:path').dirname(require.resolve(process.env.OPENAI_TEST_SDK || 'openai')); +const major = Number(require(`${sdkDirectory}/package.json`).version.split('.')[0]); +if (major >= 5) { + test('completed chat stream keeps gateway attribution on one client span', async () => { + const stream = await client(gateway, 'chat', false, true).chat.completions.create({ + model: requestedModel, messages: [{ role: 'user', content: 'synthetic-input' }], + stream: true, stream_options: { include_usage: true }, + }); + const chunks = []; + for await (const chunk of stream) chunks.push(chunk); + assert.equal(chunks.length, 2); + await check('vercel', 'chat', false, true); + }); +} diff --git a/typescript/pnpm-lock.yaml b/typescript/pnpm-lock.yaml index c6feab057..db1a282b3 100644 --- a/typescript/pnpm-lock.yaml +++ b/typescript/pnpm-lock.yaml @@ -1601,6 +1601,9 @@ importers: tsc-alias: specifier: ^1.8.16 version: 1.8.16 + zod: + specifier: ^3.25.76 + version: 3.25.76 packages/traceai_openai_agents: dependencies: