tracia 0.3.2 → 0.3.3

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/index.d.mts CHANGED
@@ -267,8 +267,8 @@ interface RunLocalInput {
267
267
  stopSequences?: string[];
268
268
  /** Timeout in milliseconds for the LLM call */
269
269
  timeoutMs?: number;
270
- /** Provider-specific options passed directly to the SDK */
271
- customOptions?: Record<string, unknown>;
270
+ /** Provider-specific options passed directly to the AI SDK (e.g., { openai: { strictJsonSchema: true } }) */
271
+ customOptions?: Record<string, Record<string, unknown>>;
272
272
  variables?: Record<string, string>;
273
273
  providerApiKey?: string;
274
274
  tags?: string[];
@@ -466,6 +466,8 @@ interface RunResponsesInput {
466
466
  traceId?: string;
467
467
  /** Parent span ID for chaining spans in a sequence */
468
468
  parentSpanId?: string;
469
+ /** Provider-specific options passed directly to the AI SDK (e.g., { openai: { strictJsonSchema: true } }) */
470
+ customOptions?: Record<string, Record<string, unknown>>;
469
471
  }
470
472
  /**
471
473
  * Final result from a Responses API call.
package/dist/index.d.ts CHANGED
@@ -267,8 +267,8 @@ interface RunLocalInput {
267
267
  stopSequences?: string[];
268
268
  /** Timeout in milliseconds for the LLM call */
269
269
  timeoutMs?: number;
270
- /** Provider-specific options passed directly to the SDK */
271
- customOptions?: Record<string, unknown>;
270
+ /** Provider-specific options passed directly to the AI SDK (e.g., { openai: { strictJsonSchema: true } }) */
271
+ customOptions?: Record<string, Record<string, unknown>>;
272
272
  variables?: Record<string, string>;
273
273
  providerApiKey?: string;
274
274
  tags?: string[];
@@ -466,6 +466,8 @@ interface RunResponsesInput {
466
466
  traceId?: string;
467
467
  /** Parent span ID for chaining spans in a sequence */
468
468
  parentSpanId?: string;
469
+ /** Provider-specific options passed directly to the AI SDK (e.g., { openai: { strictJsonSchema: true } }) */
470
+ customOptions?: Record<string, Record<string, unknown>>;
469
471
  }
470
472
  /**
471
473
  * Final result from a Responses API call.
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ var LLMProvider = /* @__PURE__ */ ((LLMProvider2) => {
76
76
  })(LLMProvider || {});
77
77
 
78
78
  // src/client.ts
79
- var SDK_VERSION = "0.3.2";
79
+ var SDK_VERSION = "0.3.3";
80
80
  var DEFAULT_TIMEOUT_MS = 12e4;
81
81
  function mapApiErrorCodeToTraciaErrorCode(apiCode) {
82
82
  const codeMap = {
@@ -513,6 +513,17 @@ function extractToolCalls(toolCalls) {
513
513
  arguments: tc.input ?? {}
514
514
  }));
515
515
  }
516
+ function mergeProviderOptions(userOptions) {
517
+ const defaults = {
518
+ openai: { strictJsonSchema: false }
519
+ };
520
+ if (!userOptions) return defaults;
521
+ const merged = { ...defaults };
522
+ for (const [provider, options] of Object.entries(userOptions)) {
523
+ merged[provider] = { ...merged[provider], ...options };
524
+ }
525
+ return merged;
526
+ }
516
527
  async function complete(options) {
517
528
  const { generateText } = await loadAISdk();
518
529
  const provider = resolveProvider(options.model, options.provider);
@@ -531,7 +542,8 @@ async function complete(options) {
531
542
  stopSequences: options.stopSequences,
532
543
  tools: convertedTools,
533
544
  toolChoice: convertedToolChoice,
534
- abortSignal: options.timeoutMs ? AbortSignal.timeout(options.timeoutMs) : void 0
545
+ abortSignal: options.timeoutMs ? AbortSignal.timeout(options.timeoutMs) : void 0,
546
+ providerOptions: mergeProviderOptions(options.providerOptions)
535
547
  });
536
548
  const toolCalls = extractToolCalls(result.toolCalls);
537
549
  return {
@@ -578,7 +590,8 @@ function stream(options) {
578
590
  stopSequences: options.stopSequences,
579
591
  tools: convertedTools,
580
592
  toolChoice: convertedToolChoice,
581
- abortSignal
593
+ abortSignal,
594
+ providerOptions: mergeProviderOptions(options.providerOptions)
582
595
  });
583
596
  for await (const chunk of result.textStream) {
584
597
  yield chunk;
@@ -683,7 +696,8 @@ function responsesStream(options) {
683
696
  messages: convertedMessages,
684
697
  maxOutputTokens: options.maxOutputTokens,
685
698
  tools: convertedTools,
686
- abortSignal
699
+ abortSignal,
700
+ providerOptions: mergeProviderOptions(options.providerOptions)
687
701
  });
688
702
  for await (const chunk of result.textStream) {
689
703
  fullText += chunk;
@@ -1066,6 +1080,7 @@ var Tracia = class {
1066
1080
  stopSequences: input.stopSequences,
1067
1081
  tools: input.tools,
1068
1082
  toolChoice: input.toolChoice,
1083
+ providerOptions: input.customOptions,
1069
1084
  timeoutMs: input.timeoutMs
1070
1085
  });
1071
1086
  } catch (error) {
@@ -1224,7 +1239,8 @@ var Tracia = class {
1224
1239
  tools: input.tools,
1225
1240
  maxOutputTokens: input.maxOutputTokens,
1226
1241
  timeoutMs: input.timeoutMs,
1227
- signal
1242
+ signal,
1243
+ providerOptions: input.customOptions
1228
1244
  });
1229
1245
  let collectedText = "";
1230
1246
  const scheduleSpan = this.scheduleSpanCreation.bind(this);
@@ -1354,7 +1370,8 @@ var Tracia = class {
1354
1370
  tools: input.tools,
1355
1371
  toolChoice: input.toolChoice,
1356
1372
  timeoutMs: input.timeoutMs,
1357
- signal
1373
+ signal,
1374
+ providerOptions: input.customOptions
1358
1375
  });
1359
1376
  let collectedText = "";
1360
1377
  const scheduleSpan = this.scheduleSpanCreation.bind(this);