@jaypie/llm 1.2.8 → 1.3.0

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.
@@ -70,6 +70,8 @@ export interface OperateRequest {
70
70
  format?: JsonObject;
71
71
  /** Provider-specific options */
72
72
  providerOptions?: JsonObject;
73
+ /** Sampling temperature (0-2 for most providers) */
74
+ temperature?: number;
73
75
  /** User identifier for tracking */
74
76
  user?: string;
75
77
  }
@@ -223,6 +223,7 @@ export interface LlmOperateOptions {
223
223
  };
224
224
  providerOptions?: JsonObject;
225
225
  system?: string;
226
+ temperature?: number;
226
227
  tools?: LlmTool[] | Toolkit;
227
228
  turns?: boolean | number;
228
229
  user?: string;
package/dist/esm/index.js CHANGED
@@ -990,6 +990,10 @@ class AnthropicAdapter extends BaseProviderAdapter {
990
990
  if (request.providerOptions) {
991
991
  Object.assign(anthropicRequest, request.providerOptions);
992
992
  }
993
+ // First-class temperature takes precedence over providerOptions
994
+ if (request.temperature !== undefined) {
995
+ anthropicRequest.temperature = request.temperature;
996
+ }
993
997
  return anthropicRequest;
994
998
  }
995
999
  formatTools(toolkit, outputSchema) {
@@ -1415,6 +1419,13 @@ class GeminiAdapter extends BaseProviderAdapter {
1415
1419
  ...request.providerOptions,
1416
1420
  };
1417
1421
  }
1422
+ // First-class temperature takes precedence over providerOptions
1423
+ if (request.temperature !== undefined) {
1424
+ geminiRequest.config = {
1425
+ ...geminiRequest.config,
1426
+ temperature: request.temperature,
1427
+ };
1428
+ }
1418
1429
  return geminiRequest;
1419
1430
  }
1420
1431
  formatTools(toolkit, outputSchema) {
@@ -2066,6 +2077,10 @@ class OpenAiAdapter extends BaseProviderAdapter {
2066
2077
  if (request.providerOptions) {
2067
2078
  Object.assign(openaiRequest, request.providerOptions);
2068
2079
  }
2080
+ // First-class temperature takes precedence over providerOptions
2081
+ if (request.temperature !== undefined) {
2082
+ openaiRequest.temperature = request.temperature;
2083
+ }
2069
2084
  return openaiRequest;
2070
2085
  }
2071
2086
  formatTools(toolkit, _outputSchema) {
@@ -2496,6 +2511,11 @@ class OpenRouterAdapter extends BaseProviderAdapter {
2496
2511
  if (request.providerOptions) {
2497
2512
  Object.assign(openRouterRequest, request.providerOptions);
2498
2513
  }
2514
+ // First-class temperature takes precedence over providerOptions
2515
+ if (request.temperature !== undefined) {
2516
+ openRouterRequest.temperature =
2517
+ request.temperature;
2518
+ }
2499
2519
  return openRouterRequest;
2500
2520
  }
2501
2521
  formatTools(toolkit, outputSchema) {
@@ -3905,6 +3925,7 @@ class OperateLoop {
3905
3925
  model: options.model ?? this.adapter.defaultModel,
3906
3926
  providerOptions: options.providerOptions,
3907
3927
  system: options.system,
3928
+ temperature: options.temperature,
3908
3929
  tools: state.formattedTools,
3909
3930
  user: options.user,
3910
3931
  };
@@ -3984,6 +4005,7 @@ class OperateLoop {
3984
4005
  model: options.model ?? this.adapter.defaultModel,
3985
4006
  providerOptions: options.providerOptions,
3986
4007
  system: options.system,
4008
+ temperature: options.temperature,
3987
4009
  tools: state.formattedTools,
3988
4010
  user: options.user,
3989
4011
  };
@@ -4314,6 +4336,7 @@ class StreamLoop {
4314
4336
  model: options.model ?? this.adapter.defaultModel,
4315
4337
  providerOptions: options.providerOptions,
4316
4338
  system: options.system,
4339
+ temperature: options.temperature,
4317
4340
  tools: state.formattedTools,
4318
4341
  user: options.user,
4319
4342
  };
@@ -4380,6 +4403,7 @@ class StreamLoop {
4380
4403
  model: options.model ?? this.adapter.defaultModel,
4381
4404
  providerOptions: options.providerOptions,
4382
4405
  system: options.system,
4406
+ temperature: options.temperature,
4383
4407
  tools: state.formattedTools,
4384
4408
  user: options.user,
4385
4409
  };