@langchain/google-common 0.1.7 → 0.1.8

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.
@@ -173,7 +173,7 @@ class ChatGoogleBase extends chat_models_1.BaseChatModel {
173
173
  enumerable: true,
174
174
  configurable: true,
175
175
  writable: true,
176
- value: false
176
+ value: void 0
177
177
  });
178
178
  Object.defineProperty(this, "topLogprobs", {
179
179
  enumerable: true,
@@ -169,7 +169,7 @@ export class ChatGoogleBase extends BaseChatModel {
169
169
  enumerable: true,
170
170
  configurable: true,
171
171
  writable: true,
172
- value: false
172
+ value: void 0
173
173
  });
174
174
  Object.defineProperty(this, "topLogprobs", {
175
175
  enumerable: true,
@@ -19,12 +19,12 @@ function failedAttemptHandler(error) {
19
19
  if (status === 0) {
20
20
  // What is this?
21
21
  console.error("failedAttemptHandler", error);
22
+ throw error;
22
23
  }
23
24
  // What errors shouldn't be retried?
24
25
  if (STATUS_NO_RETRY.includes(+status)) {
25
26
  throw error;
26
27
  }
27
- throw error;
28
28
  }
29
29
  exports.failedAttemptHandler = failedAttemptHandler;
30
30
  function ensureParams(params) {
@@ -16,12 +16,12 @@ export function failedAttemptHandler(error) {
16
16
  if (status === 0) {
17
17
  // What is this?
18
18
  console.error("failedAttemptHandler", error);
19
+ throw error;
19
20
  }
20
21
  // What errors shouldn't be retried?
21
22
  if (STATUS_NO_RETRY.includes(+status)) {
22
23
  throw error;
23
24
  }
24
- throw error;
25
25
  }
26
26
  export function ensureParams(params) {
27
27
  const base = params ?? {};
@@ -829,7 +829,7 @@ function getGeminiAPI(config) {
829
829
  }
830
830
  }
831
831
  function formatGenerationConfig(parameters) {
832
- return {
832
+ const ret = {
833
833
  temperature: parameters.temperature,
834
834
  topK: parameters.topK,
835
835
  topP: parameters.topP,
@@ -838,9 +838,16 @@ function getGeminiAPI(config) {
838
838
  maxOutputTokens: parameters.maxOutputTokens,
839
839
  stopSequences: parameters.stopSequences,
840
840
  responseMimeType: parameters.responseMimeType,
841
- responseLogprobs: parameters.logprobs,
842
- logprobs: parameters.topLogprobs,
843
841
  };
842
+ // Add the logprobs if explicitly set
843
+ if (typeof parameters.logprobs !== "undefined") {
844
+ ret.responseLogprobs = parameters.logprobs;
845
+ if (parameters.logprobs &&
846
+ typeof parameters.topLogprobs !== "undefined") {
847
+ ret.logprobs = parameters.topLogprobs;
848
+ }
849
+ }
850
+ return ret;
844
851
  }
845
852
  function formatSafetySettings(parameters) {
846
853
  return parameters.safetySettings ?? [];
@@ -824,7 +824,7 @@ export function getGeminiAPI(config) {
824
824
  }
825
825
  }
826
826
  function formatGenerationConfig(parameters) {
827
- return {
827
+ const ret = {
828
828
  temperature: parameters.temperature,
829
829
  topK: parameters.topK,
830
830
  topP: parameters.topP,
@@ -833,9 +833,16 @@ export function getGeminiAPI(config) {
833
833
  maxOutputTokens: parameters.maxOutputTokens,
834
834
  stopSequences: parameters.stopSequences,
835
835
  responseMimeType: parameters.responseMimeType,
836
- responseLogprobs: parameters.logprobs,
837
- logprobs: parameters.topLogprobs,
838
836
  };
837
+ // Add the logprobs if explicitly set
838
+ if (typeof parameters.logprobs !== "undefined") {
839
+ ret.responseLogprobs = parameters.logprobs;
840
+ if (parameters.logprobs &&
841
+ typeof parameters.topLogprobs !== "undefined") {
842
+ ret.logprobs = parameters.topLogprobs;
843
+ }
844
+ }
845
+ return ret;
839
846
  }
840
847
  function formatSafetySettings(parameters) {
841
848
  return parameters.safetySettings ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/google-common",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Core types and classes for Google services.",
5
5
  "type": "module",
6
6
  "engines": {