@hiper2d/ai-agents 0.19.1 → 0.19.2

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.mjs CHANGED
@@ -961,6 +961,10 @@ var SupportedAiModels = {
961
961
  apiKeyName: API_KEY_CONSTANTS.GOOGLE,
962
962
  hasThinking: true,
963
963
  reasoningEffort: "high",
964
+ // Pre-3.6: still honours sampling params, so it keeps the 0.2 GoogleAgent always sent
965
+ // before 2026-10-07. 3.6+ ignore them and future Gemini models reject them — leave
966
+ // `temperature` unset on every newer Gemini entry (GoogleAgent then sends none).
967
+ temperature: 0.2,
964
968
  tags: ["expensive"]
965
969
  },
966
970
  [LLM_CONSTANTS.GEMINI_FLASH]: {
@@ -980,6 +984,8 @@ var SupportedAiModels = {
980
984
  apiKeyName: API_KEY_CONSTANTS.GOOGLE,
981
985
  hasThinking: true,
982
986
  reasoningEffort: "minimal",
987
+ // Pre-3.6, same as Pro: keeps the 0.2 it always had.
988
+ temperature: 0.2,
983
989
  tags: ["fast", "cheap"]
984
990
  },
985
991
  // Always-on reasoning — no non-thinking sibling. Bumped 4.6 → 4.7 on 2026-09-22 (id verified
@@ -3057,6 +3063,13 @@ function throwForEmptyGeminiResponse(model, response, fallback) {
3057
3063
  }
3058
3064
  var GoogleAgent = class extends AbstractAgent {
3059
3065
  client;
3066
+ /**
3067
+ * Sampling temperature to send, or undefined to send none. Google deprecated custom sampling
3068
+ * (notice of 2026-10): since Gemini 3.6 Flash temperature/top_p/top_k are ignored, and its
3069
+ * upcoming models reject them with a 400. So it is sent only for a catalog entry that sets
3070
+ * `temperature` (the pre-3.6 models, to keep their behaviour) — never by default.
3071
+ */
3072
+ samplingTemperature;
3060
3073
  defaultConfig = {
3061
3074
  responseMimeType: "application/json"
3062
3075
  };
@@ -3072,7 +3085,9 @@ var GoogleAgent = class extends AbstractAgent {
3072
3085
  unsupportedRole: (role) => `Unsupported role type: ${role}`
3073
3086
  };
3074
3087
  constructor(name, instruction, model, apiKey, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
3075
- super(name, instruction, model, 0.2, enableThinking, agentLoggingConfig);
3088
+ const samplingTemperature = getModelConfigByApiName(model)?.temperature;
3089
+ super(name, instruction, model, samplingTemperature ?? 0, enableThinking, agentLoggingConfig);
3090
+ this.samplingTemperature = samplingTemperature;
3076
3091
  this.client = new GoogleGenAI3({
3077
3092
  apiKey
3078
3093
  });
@@ -3171,7 +3186,7 @@ var GoogleAgent = class extends AbstractAgent {
3171
3186
  try {
3172
3187
  const googleSchema = ZodSchemaConverter.toGoogleSchema(zodSchema);
3173
3188
  const config = {
3174
- temperature: this.temperature,
3189
+ ...this.samplingTemperature !== void 0 ? { temperature: this.samplingTemperature } : {},
3175
3190
  responseMimeType: "application/json",
3176
3191
  responseSchema: googleSchema,
3177
3192
  maxOutputTokens: this.maxOutputTokens,
@@ -3261,7 +3276,7 @@ var GoogleAgent = class extends AbstractAgent {
3261
3276
  const contents = this.convertToContents(messages);
3262
3277
  try {
3263
3278
  const config = {
3264
- temperature: this.temperature,
3279
+ ...this.samplingTemperature !== void 0 ? { temperature: this.samplingTemperature } : {},
3265
3280
  maxOutputTokens: this.maxOutputTokens,
3266
3281
  systemInstruction: this.instruction
3267
3282
  };