@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.
package/dist/chat_models.cjs
CHANGED
package/dist/chat_models.js
CHANGED
|
@@ -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 ?? {};
|
package/dist/utils/gemini.cjs
CHANGED
|
@@ -829,7 +829,7 @@ function getGeminiAPI(config) {
|
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
831
|
function formatGenerationConfig(parameters) {
|
|
832
|
-
|
|
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 ?? [];
|
package/dist/utils/gemini.js
CHANGED
|
@@ -824,7 +824,7 @@ export function getGeminiAPI(config) {
|
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
function formatGenerationConfig(parameters) {
|
|
827
|
-
|
|
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 ?? [];
|