@langchain/google-genai 0.2.18 → 1.0.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/CHANGELOG.md +17 -0
- package/LICENSE +6 -6
- package/README.md +8 -8
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/chat_models.cjs +688 -847
- package/dist/chat_models.cjs.map +1 -0
- package/dist/chat_models.d.cts +575 -0
- package/dist/chat_models.d.cts.map +1 -0
- package/dist/chat_models.d.ts +190 -157
- package/dist/chat_models.d.ts.map +1 -0
- package/dist/chat_models.js +686 -842
- package/dist/chat_models.js.map +1 -0
- package/dist/embeddings.cjs +97 -151
- package/dist/embeddings.cjs.map +1 -0
- package/dist/embeddings.d.cts +104 -0
- package/dist/embeddings.d.cts.map +1 -0
- package/dist/embeddings.d.ts +76 -70
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +93 -144
- package/dist/embeddings.js.map +1 -0
- package/dist/index.cjs +5 -18
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/dist/output_parsers.cjs +47 -75
- package/dist/output_parsers.cjs.map +1 -0
- package/dist/output_parsers.js +47 -72
- package/dist/output_parsers.js.map +1 -0
- package/dist/profiles.cjs +345 -0
- package/dist/profiles.cjs.map +1 -0
- package/dist/profiles.js +344 -0
- package/dist/profiles.js.map +1 -0
- package/dist/types.d.cts +8 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/common.cjs +356 -549
- package/dist/utils/common.cjs.map +1 -0
- package/dist/utils/common.js +357 -545
- package/dist/utils/common.js.map +1 -0
- package/dist/utils/tools.cjs +65 -102
- package/dist/utils/tools.cjs.map +1 -0
- package/dist/utils/tools.js +64 -99
- package/dist/utils/tools.js.map +1 -0
- package/dist/utils/zod_to_genai_parameters.cjs +31 -49
- package/dist/utils/zod_to_genai_parameters.cjs.map +1 -0
- package/dist/utils/zod_to_genai_parameters.js +29 -45
- package/dist/utils/zod_to_genai_parameters.js.map +1 -0
- package/package.json +45 -51
- package/dist/output_parsers.d.ts +0 -20
- package/dist/types.cjs +0 -2
- package/dist/types.js +0 -1
- package/dist/utils/common.d.ts +0 -22
- package/dist/utils/tools.d.ts +0 -10
- package/dist/utils/zod_to_genai_parameters.d.ts +0 -14
- package/index.cjs +0 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
|
@@ -1,48 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
obj) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const key in newObj) {
|
|
19
|
-
if (key in newObj) {
|
|
20
|
-
if (Array.isArray(newObj[key])) {
|
|
21
|
-
newObj[key] = newObj[key].map(removeAdditionalProperties);
|
|
22
|
-
}
|
|
23
|
-
else if (typeof newObj[key] === "object" && newObj[key] !== null) {
|
|
24
|
-
newObj[key] = removeAdditionalProperties(newObj[key]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return newObj;
|
|
29
|
-
}
|
|
30
|
-
return obj;
|
|
1
|
+
import { isInteropZodSchema } from "@langchain/core/utils/types";
|
|
2
|
+
import { toJsonSchema } from "@langchain/core/utils/json_schema";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/zod_to_genai_parameters.ts
|
|
5
|
+
function removeAdditionalProperties(obj) {
|
|
6
|
+
if (typeof obj === "object" && obj !== null) {
|
|
7
|
+
const newObj = { ...obj };
|
|
8
|
+
if ("additionalProperties" in newObj) delete newObj.additionalProperties;
|
|
9
|
+
if ("$schema" in newObj) delete newObj.$schema;
|
|
10
|
+
if ("strict" in newObj) delete newObj.strict;
|
|
11
|
+
for (const key in newObj) if (key in newObj) {
|
|
12
|
+
if (Array.isArray(newObj[key])) newObj[key] = newObj[key].map(removeAdditionalProperties);
|
|
13
|
+
else if (typeof newObj[key] === "object" && newObj[key] !== null) newObj[key] = removeAdditionalProperties(newObj[key]);
|
|
14
|
+
}
|
|
15
|
+
return newObj;
|
|
16
|
+
}
|
|
17
|
+
return obj;
|
|
31
18
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const { $schema, ...rest } = jsonSchema;
|
|
37
|
-
return rest;
|
|
19
|
+
function schemaToGenerativeAIParameters(schema) {
|
|
20
|
+
const jsonSchema = removeAdditionalProperties(isInteropZodSchema(schema) ? toJsonSchema(schema) : schema);
|
|
21
|
+
const { $schema,...rest } = jsonSchema;
|
|
22
|
+
return rest;
|
|
38
23
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
schema
|
|
42
|
-
|
|
43
|
-
// attributes, so we need to explicitly remove them.
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
const jsonSchema = removeAdditionalProperties(schema);
|
|
46
|
-
const { $schema, ...rest } = jsonSchema;
|
|
47
|
-
return rest;
|
|
24
|
+
function jsonSchemaToGeminiParameters(schema) {
|
|
25
|
+
const jsonSchema = removeAdditionalProperties(schema);
|
|
26
|
+
const { $schema,...rest } = jsonSchema;
|
|
27
|
+
return rest;
|
|
48
28
|
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { jsonSchemaToGeminiParameters, removeAdditionalProperties, schemaToGenerativeAIParameters };
|
|
32
|
+
//# sourceMappingURL=zod_to_genai_parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod_to_genai_parameters.js","names":["obj: Record<string, any>","schema: InteropZodType<RunOutput> | JsonSchema7Type","schema: Record<string, any>"],"sources":["../../src/utils/zod_to_genai_parameters.ts"],"sourcesContent":["import {\n type FunctionDeclarationSchema as GenerativeAIFunctionDeclarationSchema,\n type SchemaType as FunctionDeclarationSchemaType,\n} from \"@google/generative-ai\";\nimport {\n InteropZodType,\n isInteropZodSchema,\n} from \"@langchain/core/utils/types\";\nimport {\n type JsonSchema7Type,\n toJsonSchema,\n} from \"@langchain/core/utils/json_schema\";\n\nexport interface GenerativeAIJsonSchema extends Record<string, unknown> {\n properties?: Record<string, GenerativeAIJsonSchema>;\n type: FunctionDeclarationSchemaType;\n}\n\nexport interface GenerativeAIJsonSchemaDirty extends GenerativeAIJsonSchema {\n properties?: Record<string, GenerativeAIJsonSchemaDirty>;\n additionalProperties?: boolean;\n}\n\nexport function removeAdditionalProperties(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj: Record<string, any>\n): GenerativeAIJsonSchema {\n if (typeof obj === \"object\" && obj !== null) {\n const newObj = { ...obj };\n\n if (\"additionalProperties\" in newObj) {\n delete newObj.additionalProperties;\n }\n if (\"$schema\" in newObj) {\n delete newObj.$schema;\n }\n if (\"strict\" in newObj) {\n delete newObj.strict;\n }\n\n for (const key in newObj) {\n if (key in newObj) {\n if (Array.isArray(newObj[key])) {\n newObj[key] = newObj[key].map(removeAdditionalProperties);\n } else if (typeof newObj[key] === \"object\" && newObj[key] !== null) {\n newObj[key] = removeAdditionalProperties(newObj[key]);\n }\n }\n }\n\n return newObj as GenerativeAIJsonSchema;\n }\n\n return obj as GenerativeAIJsonSchema;\n}\n\nexport function schemaToGenerativeAIParameters<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>\n>(\n schema: InteropZodType<RunOutput> | JsonSchema7Type\n): GenerativeAIFunctionDeclarationSchema {\n // GenerativeAI doesn't accept either the $schema or additionalProperties\n // attributes, so we need to explicitly remove them.\n const jsonSchema = removeAdditionalProperties(\n isInteropZodSchema(schema) ? toJsonSchema(schema) : schema\n );\n const { $schema, ...rest } = jsonSchema;\n\n return rest as GenerativeAIFunctionDeclarationSchema;\n}\n\nexport function jsonSchemaToGeminiParameters(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: Record<string, any>\n): GenerativeAIFunctionDeclarationSchema {\n // Gemini doesn't accept either the $schema or additionalProperties\n // attributes, so we need to explicitly remove them.\n const jsonSchema = removeAdditionalProperties(\n schema as GenerativeAIJsonSchemaDirty\n );\n const { $schema, ...rest } = jsonSchema;\n\n return rest as GenerativeAIFunctionDeclarationSchema;\n}\n"],"mappings":";;;;AAuBA,SAAgB,2BAEdA,KACwB;AACxB,KAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;EAC3C,MAAM,SAAS,EAAE,GAAG,IAAK;AAEzB,MAAI,0BAA0B,QAC5B,OAAO,OAAO;AAEhB,MAAI,aAAa,QACf,OAAO,OAAO;AAEhB,MAAI,YAAY,QACd,OAAO,OAAO;AAGhB,OAAK,MAAM,OAAO,OAChB,KAAI,OAAO,QACT;OAAI,MAAM,QAAQ,OAAO,KAAK,EAC5B,OAAO,OAAO,OAAO,KAAK,IAAI,2BAA2B;YAChD,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS,MAC5D,OAAO,OAAO,2BAA2B,OAAO,KAAK;EACtD;AAIL,SAAO;CACR;AAED,QAAO;AACR;AAED,SAAgB,+BAIdC,QACuC;CAGvC,MAAM,aAAa,2BACjB,mBAAmB,OAAO,GAAG,aAAa,OAAO,GAAG,OACrD;CACD,MAAM,EAAE,QAAS,GAAG,MAAM,GAAG;AAE7B,QAAO;AACR;AAED,SAAgB,6BAEdC,QACuC;CAGvC,MAAM,aAAa,2BACjB,OACD;CACD,MAAM,EAAE,QAAS,GAAG,MAAM,GAAG;AAE7B,QAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,94 +1,88 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-genai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Google Generative AI integration for LangChain.js",
|
|
5
|
+
"author": "LangChain",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"type": "module",
|
|
6
8
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
9
|
+
"node": ">=20"
|
|
8
10
|
},
|
|
9
|
-
"main": "./index.js",
|
|
10
|
-
"types": "./index.d.ts",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git@github.com:langchain-ai/langchainjs.git"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-google-genai/",
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "yarn turbo:command build:internal --filter=@langchain/google-genai",
|
|
18
|
-
"build:internal": "yarn lc_build --create-entrypoints --pre --tree-shaking",
|
|
19
|
-
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
|
|
20
|
-
"lint:dpdm": "dpdm --skip-dynamic-imports circular --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
21
|
-
"lint": "yarn lint:eslint && yarn lint:dpdm",
|
|
22
|
-
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
|
|
23
|
-
"clean": "rm -rf .turbo dist/",
|
|
24
|
-
"prepack": "yarn build",
|
|
25
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
|
26
|
-
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
27
|
-
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
|
28
|
-
"test:int": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
29
|
-
"test:standard:unit": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.standard\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
30
|
-
"test:standard:int": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.standard\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
31
|
-
"test:standard": "yarn test:standard:unit && yarn test:standard:int",
|
|
32
|
-
"format": "prettier --config .prettierrc --write \"src\"",
|
|
33
|
-
"format:check": "prettier --config .prettierrc --check \"src\""
|
|
34
|
-
},
|
|
35
|
-
"author": "LangChain",
|
|
36
|
-
"license": "MIT",
|
|
37
16
|
"dependencies": {
|
|
38
17
|
"@google/generative-ai": "^0.24.0",
|
|
39
18
|
"uuid": "^11.1.0"
|
|
40
19
|
},
|
|
41
20
|
"peerDependencies": {
|
|
42
|
-
"@langchain/core": "
|
|
21
|
+
"@langchain/core": "^1.0.0"
|
|
43
22
|
},
|
|
44
23
|
"devDependencies": {
|
|
45
24
|
"@jest/globals": "^29.5.0",
|
|
46
|
-
"@langchain/core": "workspace:*",
|
|
47
|
-
"@langchain/scripts": ">=0.1.0 <0.2.0",
|
|
48
|
-
"@langchain/standard-tests": "0.0.0",
|
|
49
25
|
"@swc/core": "^1.3.90",
|
|
50
26
|
"@swc/jest": "^0.2.29",
|
|
51
27
|
"@tsconfig/recommended": "^1.0.3",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
53
|
-
"@typescript-eslint/parser": "^6.12.0",
|
|
54
28
|
"dotenv": "^16.3.1",
|
|
55
29
|
"dpdm": "^3.14.0",
|
|
56
|
-
"eslint": "^
|
|
57
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
58
|
-
"eslint-config-prettier": "^8.6.0",
|
|
59
|
-
"eslint-plugin-import": "^2.27.5",
|
|
60
|
-
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
61
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
30
|
+
"eslint": "^9.34.0",
|
|
62
31
|
"hnswlib-node": "^3.0.0",
|
|
63
32
|
"jest": "^29.5.0",
|
|
64
33
|
"jest-environment-node": "^29.6.4",
|
|
65
34
|
"prettier": "^2.8.3",
|
|
66
|
-
"release-it": "^18.1.2",
|
|
67
35
|
"rollup": "^4.5.2",
|
|
68
36
|
"ts-jest": "^29.1.0",
|
|
69
37
|
"typescript": "~5.8.3",
|
|
70
|
-
"zod": "^3.25.
|
|
38
|
+
"zod": "^3.25.76",
|
|
39
|
+
"@langchain/standard-tests": "0.0.1",
|
|
40
|
+
"@langchain/core": "1.0.5",
|
|
41
|
+
"@langchain/eslint": "0.1.0"
|
|
71
42
|
},
|
|
72
43
|
"publishConfig": {
|
|
73
44
|
"access": "public"
|
|
74
45
|
},
|
|
46
|
+
"main": "./dist/index.js",
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
75
48
|
"exports": {
|
|
76
49
|
".": {
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
"default": "./index.
|
|
50
|
+
"input": "./src/index.ts",
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"default": "./dist/index.js"
|
|
81
54
|
},
|
|
82
|
-
"
|
|
83
|
-
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/index.d.cts",
|
|
57
|
+
"default": "./dist/index.cjs"
|
|
58
|
+
}
|
|
84
59
|
},
|
|
85
60
|
"./package.json": "./package.json"
|
|
86
61
|
},
|
|
87
62
|
"files": [
|
|
88
63
|
"dist/",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
64
|
+
"CHANGELOG.md",
|
|
65
|
+
"README.md",
|
|
66
|
+
"LICENSE"
|
|
67
|
+
],
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "turbo build:compile --filter @langchain/google-genai",
|
|
70
|
+
"build:compile": "pnpm --filter @langchain/build compile @langchain/google-genai",
|
|
71
|
+
"lint:eslint": "eslint --cache src/",
|
|
72
|
+
"lint:dpdm": "dpdm --skip-dynamic-imports circular --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
73
|
+
"lint": "pnpm lint:eslint && pnpm lint:dpdm",
|
|
74
|
+
"lint:fix": "pnpm lint:eslint --fix && pnpm lint:dpdm",
|
|
75
|
+
"clean": "rm -rf .turbo dist/",
|
|
76
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
|
77
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
78
|
+
"test:single": "NODE_OPTIONS=--experimental-vm-modules pnpm run jest --config jest.config.cjs --testTimeout 100000",
|
|
79
|
+
"test:int": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
80
|
+
"test:standard:unit": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.standard\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
81
|
+
"test:standard:int": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.standard\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
82
|
+
"test:standard": "pnpm test:standard:unit && pnpm test:standard:int",
|
|
83
|
+
"format": "prettier --config .prettierrc --write \"src\"",
|
|
84
|
+
"format:check": "prettier --config .prettierrc --check \"src\"",
|
|
85
|
+
"typegen": "pnpm run typegen:profiles",
|
|
86
|
+
"typegen:profiles": "pnpm --filter @langchain/model-profiles make --config profiles.toml"
|
|
87
|
+
}
|
|
88
|
+
}
|
package/dist/output_parsers.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseLLMOutputParser } from "@langchain/core/output_parsers";
|
|
2
|
-
import { ChatGeneration } from "@langchain/core/outputs";
|
|
3
|
-
import { InteropZodType } from "@langchain/core/utils/types";
|
|
4
|
-
import { JsonOutputKeyToolsParserParamsInterop } from "@langchain/core/output_parsers/openai_tools";
|
|
5
|
-
interface GoogleGenerativeAIToolsOutputParserParams<T extends Record<string, any>> extends JsonOutputKeyToolsParserParamsInterop<T> {
|
|
6
|
-
}
|
|
7
|
-
export declare class GoogleGenerativeAIToolsOutputParser<T extends Record<string, any> = Record<string, any>> extends BaseLLMOutputParser<T> {
|
|
8
|
-
static lc_name(): string;
|
|
9
|
-
lc_namespace: string[];
|
|
10
|
-
returnId: boolean;
|
|
11
|
-
/** The type of tool calls to return. */
|
|
12
|
-
keyName: string;
|
|
13
|
-
/** Whether to return only the first tool call. */
|
|
14
|
-
returnSingle: boolean;
|
|
15
|
-
zodSchema?: InteropZodType<T>;
|
|
16
|
-
constructor(params: GoogleGenerativeAIToolsOutputParserParams<T>);
|
|
17
|
-
protected _validateResult(result: unknown): Promise<T>;
|
|
18
|
-
parseResult(generations: ChatGeneration[]): Promise<T>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
package/dist/types.cjs
DELETED
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/utils/common.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { EnhancedGenerateContentResponse, Content, Part, type FunctionDeclarationsTool as GoogleGenerativeAIFunctionDeclarationsTool, POSSIBLE_ROLES } from "@google/generative-ai";
|
|
2
|
-
import { BaseMessage, UsageMetadata } from "@langchain/core/messages";
|
|
3
|
-
import { ChatGenerationChunk, ChatResult } from "@langchain/core/outputs";
|
|
4
|
-
import { GoogleGenerativeAIToolType } from "../types.js";
|
|
5
|
-
export declare function getMessageAuthor(message: BaseMessage): string;
|
|
6
|
-
/**
|
|
7
|
-
* Maps a message type to a Google Generative AI chat author.
|
|
8
|
-
* @param message The message to map.
|
|
9
|
-
* @param model The model to use for mapping.
|
|
10
|
-
* @returns The message type mapped to a Google Generative AI chat author.
|
|
11
|
-
*/
|
|
12
|
-
export declare function convertAuthorToRole(author: string): (typeof POSSIBLE_ROLES)[number];
|
|
13
|
-
export declare function convertMessageContentToParts(message: BaseMessage, isMultimodalModel: boolean, previousMessages: BaseMessage[]): Part[];
|
|
14
|
-
export declare function convertBaseMessagesToContent(messages: BaseMessage[], isMultimodalModel: boolean, convertSystemMessageToHumanContent?: boolean): Content[];
|
|
15
|
-
export declare function mapGenerateContentResultToChatResult(response: EnhancedGenerateContentResponse, extra?: {
|
|
16
|
-
usageMetadata: UsageMetadata | undefined;
|
|
17
|
-
}): ChatResult;
|
|
18
|
-
export declare function convertResponseContentToChatGenerationChunk(response: EnhancedGenerateContentResponse, extra: {
|
|
19
|
-
usageMetadata?: UsageMetadata | undefined;
|
|
20
|
-
index: number;
|
|
21
|
-
}): ChatGenerationChunk | null;
|
|
22
|
-
export declare function convertToGenerativeAITools(tools: GoogleGenerativeAIToolType[]): GoogleGenerativeAIFunctionDeclarationsTool[];
|
package/dist/utils/tools.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Tool as GenerativeAITool, ToolConfig } from "@google/generative-ai";
|
|
2
|
-
import { ToolChoice } from "@langchain/core/language_models/chat_models";
|
|
3
|
-
import { GoogleGenerativeAIToolType } from "../types.js";
|
|
4
|
-
export declare function convertToolsToGenAI(tools: GoogleGenerativeAIToolType[], extra?: {
|
|
5
|
-
toolChoice?: ToolChoice;
|
|
6
|
-
allowedFunctionNames?: string[];
|
|
7
|
-
}): {
|
|
8
|
-
tools: GenerativeAITool[];
|
|
9
|
-
toolConfig?: ToolConfig;
|
|
10
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type FunctionDeclarationSchema as GenerativeAIFunctionDeclarationSchema, type SchemaType as FunctionDeclarationSchemaType } from "@google/generative-ai";
|
|
2
|
-
import { InteropZodType } from "@langchain/core/utils/types";
|
|
3
|
-
import { type JsonSchema7Type } from "@langchain/core/utils/json_schema";
|
|
4
|
-
export interface GenerativeAIJsonSchema extends Record<string, unknown> {
|
|
5
|
-
properties?: Record<string, GenerativeAIJsonSchema>;
|
|
6
|
-
type: FunctionDeclarationSchemaType;
|
|
7
|
-
}
|
|
8
|
-
export interface GenerativeAIJsonSchemaDirty extends GenerativeAIJsonSchema {
|
|
9
|
-
properties?: Record<string, GenerativeAIJsonSchemaDirty>;
|
|
10
|
-
additionalProperties?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function removeAdditionalProperties(obj: Record<string, any>): GenerativeAIJsonSchema;
|
|
13
|
-
export declare function schemaToGenerativeAIParameters<RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | JsonSchema7Type): GenerativeAIFunctionDeclarationSchema;
|
|
14
|
-
export declare function jsonSchemaToGeminiParameters(schema: Record<string, any>): GenerativeAIFunctionDeclarationSchema;
|
package/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./dist/index.cjs');
|
package/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/index.js'
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/index.js'
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/index.js'
|