@langchain/google-common 0.1.0 → 0.1.1
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 +2 -1
- package/dist/chat_models.d.ts +1 -2
- package/dist/chat_models.js +1 -1
- package/dist/utils/gemini.cjs +3 -0
- package/dist/utils/gemini.js +3 -0
- package/package.json +1 -1
package/dist/chat_models.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChatGoogleBase = void 0;
|
|
3
|
+
exports.ChatGoogleBase = exports.ChatConnection = void 0;
|
|
4
4
|
const env_1 = require("@langchain/core/utils/env");
|
|
5
5
|
const chat_models_1 = require("@langchain/core/language_models/chat_models");
|
|
6
6
|
const outputs_1 = require("@langchain/core/outputs");
|
|
@@ -98,6 +98,7 @@ class ChatConnection extends connection_js_1.AbstractGoogleLLMConnection {
|
|
|
98
98
|
return ret;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
exports.ChatConnection = ChatConnection;
|
|
101
102
|
/**
|
|
102
103
|
* Integration with a Google chat model.
|
|
103
104
|
*/
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { GoogleAIBaseLLMInput, GoogleAIModelParams, GoogleAISafetySetting, Googl
|
|
|
11
11
|
import { AbstractGoogleLLMConnection } from "./connection.js";
|
|
12
12
|
import { GoogleAbstractedClient } from "./auth.js";
|
|
13
13
|
import type { GoogleBaseLLMInput, GoogleAISafetyHandler, GoogleAISafetyParams, GoogleAIToolType, GeminiAPIConfig } from "./types.js";
|
|
14
|
-
declare class ChatConnection<AuthOptions> extends AbstractGoogleLLMConnection<BaseMessage[], AuthOptions> {
|
|
14
|
+
export declare class ChatConnection<AuthOptions> extends AbstractGoogleLLMConnection<BaseMessage[], AuthOptions> {
|
|
15
15
|
convertSystemMessageToHumanContent: boolean | undefined;
|
|
16
16
|
constructor(fields: GoogleAIBaseLLMInput<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient, streaming: boolean);
|
|
17
17
|
get useSystemInstruction(): boolean;
|
|
@@ -71,4 +71,3 @@ export declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<
|
|
|
71
71
|
parsed: RunOutput;
|
|
72
72
|
}>;
|
|
73
73
|
}
|
|
74
|
-
export {};
|
package/dist/chat_models.js
CHANGED
|
@@ -11,7 +11,7 @@ import { DefaultGeminiSafetyHandler } from "./utils/gemini.js";
|
|
|
11
11
|
import { ApiKeyGoogleAuth } from "./auth.js";
|
|
12
12
|
import { ensureParams } from "./utils/failed_handler.js";
|
|
13
13
|
import { zodToGeminiParameters } from "./utils/zod_to_gemini_parameters.js";
|
|
14
|
-
class ChatConnection extends AbstractGoogleLLMConnection {
|
|
14
|
+
export class ChatConnection extends AbstractGoogleLLMConnection {
|
|
15
15
|
constructor(fields, caller, client, streaming) {
|
|
16
16
|
super(fields, caller, client, streaming);
|
|
17
17
|
Object.defineProperty(this, "convertSystemMessageToHumanContent", {
|
package/dist/utils/gemini.cjs
CHANGED
|
@@ -469,6 +469,9 @@ function getGeminiAPI(config) {
|
|
|
469
469
|
}
|
|
470
470
|
function responseToChatGenerations(response) {
|
|
471
471
|
const parts = responseToParts(response);
|
|
472
|
+
if (parts.length === 0) {
|
|
473
|
+
return [];
|
|
474
|
+
}
|
|
472
475
|
let ret = parts.map((part) => partToChatGeneration(part));
|
|
473
476
|
if (ret.every((item) => typeof item.message.content === "string")) {
|
|
474
477
|
const combinedContent = ret.map((item) => item.message.content).join("");
|
package/dist/utils/gemini.js
CHANGED
|
@@ -466,6 +466,9 @@ export function getGeminiAPI(config) {
|
|
|
466
466
|
}
|
|
467
467
|
function responseToChatGenerations(response) {
|
|
468
468
|
const parts = responseToParts(response);
|
|
469
|
+
if (parts.length === 0) {
|
|
470
|
+
return [];
|
|
471
|
+
}
|
|
469
472
|
let ret = parts.map((part) => partToChatGeneration(part));
|
|
470
473
|
if (ret.every((item) => typeof item.message.content === "string")) {
|
|
471
474
|
const combinedContent = ret.map((item) => item.message.content).join("");
|