@llmops/sdk 0.5.2 → 0.5.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/express.d.cts +2 -2
- package/dist/express.d.mts +2 -2
- package/dist/hono.d.cts +1 -1
- package/dist/hono.d.mts +1 -1
- package/dist/{index-BkLZoEW_.d.mts → index-BvYAMh37.d.mts} +10 -2
- package/dist/{index-CHeoSGK0.d.cts → index-CoflKbMf.d.mts} +1 -1
- package/dist/{index-bdFT7Yxj.d.mts → index-DQVdCbkh.d.cts} +1 -1
- package/dist/{index-De3QdpKX.d.cts → index-DdwqBi1V.d.cts} +10 -2
- package/dist/index.cjs +350 -8
- package/dist/index.d.cts +244 -3
- package/dist/index.d.mts +244 -3
- package/dist/index.mjs +349 -9
- package/dist/nextjs.d.cts +1 -1
- package/dist/nextjs.d.mts +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
1
|
+
import { i as createLLMOps, n as ProviderOptions, r as TraceContext, t as LLMOpsClient } from "./index-DdwqBi1V.cjs";
|
|
2
|
+
import { t as createLLMOpsMiddleware } from "./index-DQVdCbkh.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/auth/client.d.ts
|
|
5
5
|
|
|
@@ -170,4 +170,245 @@ declare class AuthFeatureNotAvailableError extends Error {
|
|
|
170
170
|
constructor(feature: string, authType: string);
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
|
-
|
|
173
|
+
//#region src/telemetry/exporter.d.ts
|
|
174
|
+
/**
|
|
175
|
+
* LLMOps OTLP Span Exporter
|
|
176
|
+
*
|
|
177
|
+
* A lightweight OTel SpanExporter that sends spans to the LLMOps server's
|
|
178
|
+
* OTLP ingestion endpoint. Compatible with OpenTelemetry SDK.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* import { createLLMOpsSpanExporter } from '@llmops/sdk/telemetry';
|
|
183
|
+
* import { NodeTracerProvider, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
184
|
+
*
|
|
185
|
+
* const provider = new NodeTracerProvider();
|
|
186
|
+
* provider.addSpanProcessor(
|
|
187
|
+
* new SimpleSpanProcessor(createLLMOpsSpanExporter({
|
|
188
|
+
* baseURL: process.env.LLMOPS_URL,
|
|
189
|
+
* apiKey: process.env.LLMOPS_API_KEY,
|
|
190
|
+
* }))
|
|
191
|
+
* );
|
|
192
|
+
* provider.register();
|
|
193
|
+
*
|
|
194
|
+
* // Now Vercel AI SDK spans automatically flow to LLMOps
|
|
195
|
+
* const result = await generateText({
|
|
196
|
+
* model: openai('gpt-4o'),
|
|
197
|
+
* prompt: 'Hello',
|
|
198
|
+
* experimental_telemetry: { isEnabled: true },
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Minimal OTel SpanExporter interface
|
|
204
|
+
* We don't depend on @opentelemetry/sdk-trace-base — just implement the interface
|
|
205
|
+
*/
|
|
206
|
+
interface SpanExporter {
|
|
207
|
+
export(spans: ReadonlyArray<ReadableSpan>, resultCallback: (result: ExportResult) => void): void;
|
|
208
|
+
shutdown(): Promise<void>;
|
|
209
|
+
forceFlush?(): Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
/** Subset of OTel ReadableSpan we consume */
|
|
212
|
+
interface ReadableSpan {
|
|
213
|
+
readonly spanContext: () => {
|
|
214
|
+
traceId: string;
|
|
215
|
+
spanId: string;
|
|
216
|
+
traceFlags: number;
|
|
217
|
+
};
|
|
218
|
+
readonly parentSpanId?: string;
|
|
219
|
+
readonly name: string;
|
|
220
|
+
readonly kind: number;
|
|
221
|
+
readonly startTime: [number, number];
|
|
222
|
+
readonly endTime: [number, number];
|
|
223
|
+
readonly status: {
|
|
224
|
+
code: number;
|
|
225
|
+
message?: string;
|
|
226
|
+
};
|
|
227
|
+
readonly attributes: Record<string, unknown>;
|
|
228
|
+
readonly events: ReadonlyArray<{
|
|
229
|
+
name: string;
|
|
230
|
+
time: [number, number];
|
|
231
|
+
attributes?: Record<string, unknown>;
|
|
232
|
+
}>;
|
|
233
|
+
readonly resource: {
|
|
234
|
+
attributes: Record<string, unknown>;
|
|
235
|
+
};
|
|
236
|
+
readonly instrumentationLibrary: {
|
|
237
|
+
name: string;
|
|
238
|
+
version?: string;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
interface ExportResult {
|
|
242
|
+
code: ExportResultCode;
|
|
243
|
+
error?: Error;
|
|
244
|
+
}
|
|
245
|
+
declare enum ExportResultCode {
|
|
246
|
+
SUCCESS = 0,
|
|
247
|
+
FAILED = 1,
|
|
248
|
+
}
|
|
249
|
+
interface LLMOpsExporterConfig {
|
|
250
|
+
/** LLMOps server base URL (e.g. http://localhost:3000) */
|
|
251
|
+
baseURL: string;
|
|
252
|
+
/** Environment secret or API key for authentication */
|
|
253
|
+
apiKey: string;
|
|
254
|
+
/** Custom headers to include in requests */
|
|
255
|
+
headers?: Record<string, string>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Create an OTel SpanExporter that sends spans to an LLMOps server.
|
|
259
|
+
*/
|
|
260
|
+
declare function createLLMOpsSpanExporter(config: LLMOpsExporterConfig): SpanExporter;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/telemetry/agents-exporter.d.ts
|
|
263
|
+
/**
|
|
264
|
+
* LLMOps Tracing Exporter for @openai/agents
|
|
265
|
+
*
|
|
266
|
+
* Implements the TracingExporter interface from @openai/agents-core, converting
|
|
267
|
+
* the agents framework's Trace/Span format to OTLP JSON and sending it to
|
|
268
|
+
* the LLMOps OTLP ingestion endpoint.
|
|
269
|
+
*
|
|
270
|
+
* No dependency on @openai/agents — types are defined inline using structural
|
|
271
|
+
* compatibility (same pattern as the OTel exporter).
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* import { createLLMOpsAgentsExporter } from '@llmops/sdk';
|
|
276
|
+
* import { setTraceProcessors, BatchTraceProcessor } from '@openai/agents';
|
|
277
|
+
*
|
|
278
|
+
* const exporter = createLLMOpsAgentsExporter({
|
|
279
|
+
* baseURL: 'http://localhost:5177',
|
|
280
|
+
* apiKey: process.env.LLMOPS_API_KEY!,
|
|
281
|
+
* });
|
|
282
|
+
*
|
|
283
|
+
* setTraceProcessors([new BatchTraceProcessor(exporter)]);
|
|
284
|
+
*
|
|
285
|
+
* // All @openai/agents traces now flow to LLMOps automatically
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
/** Matches TracingExporter from @openai/agents-core */
|
|
289
|
+
interface AgentsTracingExporter {
|
|
290
|
+
export(items: (AgentsTrace | AgentsSpan)[], signal?: AbortSignal): Promise<void>;
|
|
291
|
+
}
|
|
292
|
+
/** Matches Trace from @openai/agents-core */
|
|
293
|
+
interface AgentsTrace {
|
|
294
|
+
type: 'trace';
|
|
295
|
+
traceId: string;
|
|
296
|
+
name: string;
|
|
297
|
+
groupId?: string | null;
|
|
298
|
+
metadata?: Record<string, unknown>;
|
|
299
|
+
}
|
|
300
|
+
/** Matches SpanError from @openai/agents-core */
|
|
301
|
+
interface AgentsSpanError {
|
|
302
|
+
message: string;
|
|
303
|
+
data?: Record<string, unknown>;
|
|
304
|
+
}
|
|
305
|
+
/** Matches Span from @openai/agents-core */
|
|
306
|
+
interface AgentsSpan {
|
|
307
|
+
type: 'trace.span';
|
|
308
|
+
spanId: string;
|
|
309
|
+
traceId: string;
|
|
310
|
+
parentId?: string | null;
|
|
311
|
+
startedAt?: string | null;
|
|
312
|
+
endedAt?: string | null;
|
|
313
|
+
error?: AgentsSpanError | null;
|
|
314
|
+
spanData: AgentsSpanData;
|
|
315
|
+
}
|
|
316
|
+
type AgentSpanData = {
|
|
317
|
+
type: 'agent';
|
|
318
|
+
name: string;
|
|
319
|
+
handoffs?: string[];
|
|
320
|
+
tools?: string[];
|
|
321
|
+
output_type?: string;
|
|
322
|
+
};
|
|
323
|
+
type FunctionSpanData = {
|
|
324
|
+
type: 'function';
|
|
325
|
+
name: string;
|
|
326
|
+
input: string;
|
|
327
|
+
output: string;
|
|
328
|
+
mcp_data?: string;
|
|
329
|
+
};
|
|
330
|
+
type GenerationUsageData = {
|
|
331
|
+
input_tokens?: number;
|
|
332
|
+
output_tokens?: number;
|
|
333
|
+
details?: Record<string, unknown> | null;
|
|
334
|
+
[key: string]: unknown;
|
|
335
|
+
};
|
|
336
|
+
type GenerationSpanData = {
|
|
337
|
+
type: 'generation';
|
|
338
|
+
input?: Record<string, unknown>[];
|
|
339
|
+
output?: Record<string, unknown>[];
|
|
340
|
+
model?: string;
|
|
341
|
+
model_config?: Record<string, unknown>;
|
|
342
|
+
usage?: GenerationUsageData;
|
|
343
|
+
};
|
|
344
|
+
type ResponseSpanData = {
|
|
345
|
+
type: 'response';
|
|
346
|
+
response_id?: string;
|
|
347
|
+
[key: string]: unknown;
|
|
348
|
+
};
|
|
349
|
+
type HandoffSpanData = {
|
|
350
|
+
type: 'handoff';
|
|
351
|
+
from_agent?: string;
|
|
352
|
+
to_agent?: string;
|
|
353
|
+
};
|
|
354
|
+
type CustomSpanData = {
|
|
355
|
+
type: 'custom';
|
|
356
|
+
name: string;
|
|
357
|
+
data: Record<string, unknown>;
|
|
358
|
+
};
|
|
359
|
+
type GuardrailSpanData = {
|
|
360
|
+
type: 'guardrail';
|
|
361
|
+
name: string;
|
|
362
|
+
triggered: boolean;
|
|
363
|
+
};
|
|
364
|
+
type TranscriptionSpanData = {
|
|
365
|
+
type: 'transcription';
|
|
366
|
+
input: unknown;
|
|
367
|
+
output?: string;
|
|
368
|
+
model?: string;
|
|
369
|
+
model_config?: Record<string, unknown>;
|
|
370
|
+
};
|
|
371
|
+
type SpeechSpanData = {
|
|
372
|
+
type: 'speech';
|
|
373
|
+
input?: string;
|
|
374
|
+
output: unknown;
|
|
375
|
+
model?: string;
|
|
376
|
+
model_config?: Record<string, unknown>;
|
|
377
|
+
};
|
|
378
|
+
type SpeechGroupSpanData = {
|
|
379
|
+
type: 'speech_group';
|
|
380
|
+
input?: string;
|
|
381
|
+
};
|
|
382
|
+
type MCPListToolsSpanData = {
|
|
383
|
+
type: 'mcp_tools';
|
|
384
|
+
server?: string;
|
|
385
|
+
result?: string[];
|
|
386
|
+
};
|
|
387
|
+
type AgentsSpanData = AgentSpanData | FunctionSpanData | GenerationSpanData | ResponseSpanData | HandoffSpanData | CustomSpanData | GuardrailSpanData | TranscriptionSpanData | SpeechSpanData | SpeechGroupSpanData | MCPListToolsSpanData;
|
|
388
|
+
interface LLMOpsAgentsExporterConfig {
|
|
389
|
+
/** LLMOps server base URL (e.g. http://localhost:5177) */
|
|
390
|
+
baseURL: string;
|
|
391
|
+
/** Environment secret or API key for authentication */
|
|
392
|
+
apiKey: string;
|
|
393
|
+
/** Custom headers to include in requests */
|
|
394
|
+
headers?: Record<string, string>;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Create a TracingExporter for @openai/agents that sends traces to LLMOps.
|
|
398
|
+
*
|
|
399
|
+
* Usage:
|
|
400
|
+
* ```typescript
|
|
401
|
+
* import { createLLMOpsAgentsExporter } from '@llmops/sdk';
|
|
402
|
+
* import { setTraceProcessors, BatchTraceProcessor } from '@openai/agents';
|
|
403
|
+
*
|
|
404
|
+
* setTraceProcessors([
|
|
405
|
+
* new BatchTraceProcessor(createLLMOpsAgentsExporter({
|
|
406
|
+
* baseURL: 'http://localhost:5177',
|
|
407
|
+
* apiKey: process.env.LLMOPS_API_KEY!,
|
|
408
|
+
* }))
|
|
409
|
+
* ]);
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
declare function createLLMOpsAgentsExporter(config: LLMOpsAgentsExporterConfig): AgentsTracingExporter;
|
|
413
|
+
//#endregion
|
|
414
|
+
export { type AgentsTracingExporter, AuthClient, AuthFeatureNotAvailableError, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, PaginatedResponse, PaginationOptions, Permission, type ProviderOptions, Session, type SpanExporter, type TraceContext, User, createLLMOpsAgentsExporter, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createLLMOpsMiddleware } from "./index-
|
|
1
|
+
import { i as createLLMOps, n as ProviderOptions, r as TraceContext, t as LLMOpsClient } from "./index-BvYAMh37.mjs";
|
|
2
|
+
import { t as createLLMOpsMiddleware } from "./index-CoflKbMf.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/auth/client.d.ts
|
|
5
5
|
|
|
@@ -170,4 +170,245 @@ declare class AuthFeatureNotAvailableError extends Error {
|
|
|
170
170
|
constructor(feature: string, authType: string);
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
|
-
|
|
173
|
+
//#region src/telemetry/exporter.d.ts
|
|
174
|
+
/**
|
|
175
|
+
* LLMOps OTLP Span Exporter
|
|
176
|
+
*
|
|
177
|
+
* A lightweight OTel SpanExporter that sends spans to the LLMOps server's
|
|
178
|
+
* OTLP ingestion endpoint. Compatible with OpenTelemetry SDK.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* import { createLLMOpsSpanExporter } from '@llmops/sdk/telemetry';
|
|
183
|
+
* import { NodeTracerProvider, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
184
|
+
*
|
|
185
|
+
* const provider = new NodeTracerProvider();
|
|
186
|
+
* provider.addSpanProcessor(
|
|
187
|
+
* new SimpleSpanProcessor(createLLMOpsSpanExporter({
|
|
188
|
+
* baseURL: process.env.LLMOPS_URL,
|
|
189
|
+
* apiKey: process.env.LLMOPS_API_KEY,
|
|
190
|
+
* }))
|
|
191
|
+
* );
|
|
192
|
+
* provider.register();
|
|
193
|
+
*
|
|
194
|
+
* // Now Vercel AI SDK spans automatically flow to LLMOps
|
|
195
|
+
* const result = await generateText({
|
|
196
|
+
* model: openai('gpt-4o'),
|
|
197
|
+
* prompt: 'Hello',
|
|
198
|
+
* experimental_telemetry: { isEnabled: true },
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Minimal OTel SpanExporter interface
|
|
204
|
+
* We don't depend on @opentelemetry/sdk-trace-base — just implement the interface
|
|
205
|
+
*/
|
|
206
|
+
interface SpanExporter {
|
|
207
|
+
export(spans: ReadonlyArray<ReadableSpan>, resultCallback: (result: ExportResult) => void): void;
|
|
208
|
+
shutdown(): Promise<void>;
|
|
209
|
+
forceFlush?(): Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
/** Subset of OTel ReadableSpan we consume */
|
|
212
|
+
interface ReadableSpan {
|
|
213
|
+
readonly spanContext: () => {
|
|
214
|
+
traceId: string;
|
|
215
|
+
spanId: string;
|
|
216
|
+
traceFlags: number;
|
|
217
|
+
};
|
|
218
|
+
readonly parentSpanId?: string;
|
|
219
|
+
readonly name: string;
|
|
220
|
+
readonly kind: number;
|
|
221
|
+
readonly startTime: [number, number];
|
|
222
|
+
readonly endTime: [number, number];
|
|
223
|
+
readonly status: {
|
|
224
|
+
code: number;
|
|
225
|
+
message?: string;
|
|
226
|
+
};
|
|
227
|
+
readonly attributes: Record<string, unknown>;
|
|
228
|
+
readonly events: ReadonlyArray<{
|
|
229
|
+
name: string;
|
|
230
|
+
time: [number, number];
|
|
231
|
+
attributes?: Record<string, unknown>;
|
|
232
|
+
}>;
|
|
233
|
+
readonly resource: {
|
|
234
|
+
attributes: Record<string, unknown>;
|
|
235
|
+
};
|
|
236
|
+
readonly instrumentationLibrary: {
|
|
237
|
+
name: string;
|
|
238
|
+
version?: string;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
interface ExportResult {
|
|
242
|
+
code: ExportResultCode;
|
|
243
|
+
error?: Error;
|
|
244
|
+
}
|
|
245
|
+
declare enum ExportResultCode {
|
|
246
|
+
SUCCESS = 0,
|
|
247
|
+
FAILED = 1,
|
|
248
|
+
}
|
|
249
|
+
interface LLMOpsExporterConfig {
|
|
250
|
+
/** LLMOps server base URL (e.g. http://localhost:3000) */
|
|
251
|
+
baseURL: string;
|
|
252
|
+
/** Environment secret or API key for authentication */
|
|
253
|
+
apiKey: string;
|
|
254
|
+
/** Custom headers to include in requests */
|
|
255
|
+
headers?: Record<string, string>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Create an OTel SpanExporter that sends spans to an LLMOps server.
|
|
259
|
+
*/
|
|
260
|
+
declare function createLLMOpsSpanExporter(config: LLMOpsExporterConfig): SpanExporter;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/telemetry/agents-exporter.d.ts
|
|
263
|
+
/**
|
|
264
|
+
* LLMOps Tracing Exporter for @openai/agents
|
|
265
|
+
*
|
|
266
|
+
* Implements the TracingExporter interface from @openai/agents-core, converting
|
|
267
|
+
* the agents framework's Trace/Span format to OTLP JSON and sending it to
|
|
268
|
+
* the LLMOps OTLP ingestion endpoint.
|
|
269
|
+
*
|
|
270
|
+
* No dependency on @openai/agents — types are defined inline using structural
|
|
271
|
+
* compatibility (same pattern as the OTel exporter).
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* import { createLLMOpsAgentsExporter } from '@llmops/sdk';
|
|
276
|
+
* import { setTraceProcessors, BatchTraceProcessor } from '@openai/agents';
|
|
277
|
+
*
|
|
278
|
+
* const exporter = createLLMOpsAgentsExporter({
|
|
279
|
+
* baseURL: 'http://localhost:5177',
|
|
280
|
+
* apiKey: process.env.LLMOPS_API_KEY!,
|
|
281
|
+
* });
|
|
282
|
+
*
|
|
283
|
+
* setTraceProcessors([new BatchTraceProcessor(exporter)]);
|
|
284
|
+
*
|
|
285
|
+
* // All @openai/agents traces now flow to LLMOps automatically
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
/** Matches TracingExporter from @openai/agents-core */
|
|
289
|
+
interface AgentsTracingExporter {
|
|
290
|
+
export(items: (AgentsTrace | AgentsSpan)[], signal?: AbortSignal): Promise<void>;
|
|
291
|
+
}
|
|
292
|
+
/** Matches Trace from @openai/agents-core */
|
|
293
|
+
interface AgentsTrace {
|
|
294
|
+
type: 'trace';
|
|
295
|
+
traceId: string;
|
|
296
|
+
name: string;
|
|
297
|
+
groupId?: string | null;
|
|
298
|
+
metadata?: Record<string, unknown>;
|
|
299
|
+
}
|
|
300
|
+
/** Matches SpanError from @openai/agents-core */
|
|
301
|
+
interface AgentsSpanError {
|
|
302
|
+
message: string;
|
|
303
|
+
data?: Record<string, unknown>;
|
|
304
|
+
}
|
|
305
|
+
/** Matches Span from @openai/agents-core */
|
|
306
|
+
interface AgentsSpan {
|
|
307
|
+
type: 'trace.span';
|
|
308
|
+
spanId: string;
|
|
309
|
+
traceId: string;
|
|
310
|
+
parentId?: string | null;
|
|
311
|
+
startedAt?: string | null;
|
|
312
|
+
endedAt?: string | null;
|
|
313
|
+
error?: AgentsSpanError | null;
|
|
314
|
+
spanData: AgentsSpanData;
|
|
315
|
+
}
|
|
316
|
+
type AgentSpanData = {
|
|
317
|
+
type: 'agent';
|
|
318
|
+
name: string;
|
|
319
|
+
handoffs?: string[];
|
|
320
|
+
tools?: string[];
|
|
321
|
+
output_type?: string;
|
|
322
|
+
};
|
|
323
|
+
type FunctionSpanData = {
|
|
324
|
+
type: 'function';
|
|
325
|
+
name: string;
|
|
326
|
+
input: string;
|
|
327
|
+
output: string;
|
|
328
|
+
mcp_data?: string;
|
|
329
|
+
};
|
|
330
|
+
type GenerationUsageData = {
|
|
331
|
+
input_tokens?: number;
|
|
332
|
+
output_tokens?: number;
|
|
333
|
+
details?: Record<string, unknown> | null;
|
|
334
|
+
[key: string]: unknown;
|
|
335
|
+
};
|
|
336
|
+
type GenerationSpanData = {
|
|
337
|
+
type: 'generation';
|
|
338
|
+
input?: Record<string, unknown>[];
|
|
339
|
+
output?: Record<string, unknown>[];
|
|
340
|
+
model?: string;
|
|
341
|
+
model_config?: Record<string, unknown>;
|
|
342
|
+
usage?: GenerationUsageData;
|
|
343
|
+
};
|
|
344
|
+
type ResponseSpanData = {
|
|
345
|
+
type: 'response';
|
|
346
|
+
response_id?: string;
|
|
347
|
+
[key: string]: unknown;
|
|
348
|
+
};
|
|
349
|
+
type HandoffSpanData = {
|
|
350
|
+
type: 'handoff';
|
|
351
|
+
from_agent?: string;
|
|
352
|
+
to_agent?: string;
|
|
353
|
+
};
|
|
354
|
+
type CustomSpanData = {
|
|
355
|
+
type: 'custom';
|
|
356
|
+
name: string;
|
|
357
|
+
data: Record<string, unknown>;
|
|
358
|
+
};
|
|
359
|
+
type GuardrailSpanData = {
|
|
360
|
+
type: 'guardrail';
|
|
361
|
+
name: string;
|
|
362
|
+
triggered: boolean;
|
|
363
|
+
};
|
|
364
|
+
type TranscriptionSpanData = {
|
|
365
|
+
type: 'transcription';
|
|
366
|
+
input: unknown;
|
|
367
|
+
output?: string;
|
|
368
|
+
model?: string;
|
|
369
|
+
model_config?: Record<string, unknown>;
|
|
370
|
+
};
|
|
371
|
+
type SpeechSpanData = {
|
|
372
|
+
type: 'speech';
|
|
373
|
+
input?: string;
|
|
374
|
+
output: unknown;
|
|
375
|
+
model?: string;
|
|
376
|
+
model_config?: Record<string, unknown>;
|
|
377
|
+
};
|
|
378
|
+
type SpeechGroupSpanData = {
|
|
379
|
+
type: 'speech_group';
|
|
380
|
+
input?: string;
|
|
381
|
+
};
|
|
382
|
+
type MCPListToolsSpanData = {
|
|
383
|
+
type: 'mcp_tools';
|
|
384
|
+
server?: string;
|
|
385
|
+
result?: string[];
|
|
386
|
+
};
|
|
387
|
+
type AgentsSpanData = AgentSpanData | FunctionSpanData | GenerationSpanData | ResponseSpanData | HandoffSpanData | CustomSpanData | GuardrailSpanData | TranscriptionSpanData | SpeechSpanData | SpeechGroupSpanData | MCPListToolsSpanData;
|
|
388
|
+
interface LLMOpsAgentsExporterConfig {
|
|
389
|
+
/** LLMOps server base URL (e.g. http://localhost:5177) */
|
|
390
|
+
baseURL: string;
|
|
391
|
+
/** Environment secret or API key for authentication */
|
|
392
|
+
apiKey: string;
|
|
393
|
+
/** Custom headers to include in requests */
|
|
394
|
+
headers?: Record<string, string>;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Create a TracingExporter for @openai/agents that sends traces to LLMOps.
|
|
398
|
+
*
|
|
399
|
+
* Usage:
|
|
400
|
+
* ```typescript
|
|
401
|
+
* import { createLLMOpsAgentsExporter } from '@llmops/sdk';
|
|
402
|
+
* import { setTraceProcessors, BatchTraceProcessor } from '@openai/agents';
|
|
403
|
+
*
|
|
404
|
+
* setTraceProcessors([
|
|
405
|
+
* new BatchTraceProcessor(createLLMOpsAgentsExporter({
|
|
406
|
+
* baseURL: 'http://localhost:5177',
|
|
407
|
+
* apiKey: process.env.LLMOPS_API_KEY!,
|
|
408
|
+
* }))
|
|
409
|
+
* ]);
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
declare function createLLMOpsAgentsExporter(config: LLMOpsAgentsExporterConfig): AgentsTracingExporter;
|
|
413
|
+
//#endregion
|
|
414
|
+
export { type AgentsTracingExporter, AuthClient, AuthFeatureNotAvailableError, type LLMOpsAgentsExporterConfig, type LLMOpsClient, type LLMOpsExporterConfig, PaginatedResponse, PaginationOptions, Permission, type ProviderOptions, Session, type SpanExporter, type TraceContext, User, createLLMOpsAgentsExporter, createLLMOpsMiddleware, createLLMOpsSpanExporter, createLLMOps as llmops };
|