langchain 0.3.21 → 0.3.23
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/chains/index.cjs +2 -1
- package/dist/chains/index.d.ts +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/chains/openai_functions/openapi.cjs +2 -1
- package/dist/chains/openai_functions/openapi.d.ts +18 -0
- package/dist/chains/openai_functions/openapi.js +1 -1
- package/dist/chat_models/universal.cjs +2 -1
- package/dist/chat_models/universal.js +2 -1
- package/dist/document_loaders/fs/buffer.d.ts +1 -0
- package/dist/experimental/chrome_ai/app/dist/bundle.cjs +1250 -0
- package/dist/experimental/chrome_ai/app/dist/bundle.d.ts +1 -0
- package/dist/experimental/chrome_ai/app/dist/bundle.js +1249 -0
- package/dist/sql_db.cjs +1 -1
- package/dist/sql_db.js +1 -1
- package/package.json +3 -3
- package/schema/document.cjs +1 -0
- package/schema/document.d.cts +1 -0
- package/schema/document.d.ts +1 -0
- package/schema/document.js +1 -0
package/dist/chains/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createOpenAPIChain = exports.createTaggingChainFromZod = exports.createTaggingChain = exports.createExtractionChainFromZod = exports.createExtractionChain = exports.TransformChain = exports.MultiRetrievalQAChain = exports.MultiPromptChain = exports.LLMRouterChain = exports.RouterChain = exports.MultiRouteChain = exports.OpenAIModerationChain = exports.PRINCIPLES = exports.ConstitutionalPrinciple = exports.ConstitutionalChain = exports.RetrievalQAChain = exports.ConversationalRetrievalQAChain = exports.loadSummarizationChain = exports.loadQARefineChain = exports.loadQAMapReduceChain = exports.loadQAStuffChain = exports.loadQAChain = exports.VectorDBQAChain = exports.AnalyzeDocumentChain = exports.ChatVectorDBQAChain = exports.RefineDocumentsChain = exports.MapReduceDocumentsChain = exports.StuffDocumentsChain = exports.SimpleSequentialChain = exports.SequentialChain = exports.ConversationChain = exports.APIChain = exports.LLMChain = exports.BaseChain = void 0;
|
|
3
|
+
exports.convertOpenAPISpecToOpenAIFunctions = exports.createOpenAPIChain = exports.createTaggingChainFromZod = exports.createTaggingChain = exports.createExtractionChainFromZod = exports.createExtractionChain = exports.TransformChain = exports.MultiRetrievalQAChain = exports.MultiPromptChain = exports.LLMRouterChain = exports.RouterChain = exports.MultiRouteChain = exports.OpenAIModerationChain = exports.PRINCIPLES = exports.ConstitutionalPrinciple = exports.ConstitutionalChain = exports.RetrievalQAChain = exports.ConversationalRetrievalQAChain = exports.loadSummarizationChain = exports.loadQARefineChain = exports.loadQAMapReduceChain = exports.loadQAStuffChain = exports.loadQAChain = exports.VectorDBQAChain = exports.AnalyzeDocumentChain = exports.ChatVectorDBQAChain = exports.RefineDocumentsChain = exports.MapReduceDocumentsChain = exports.StuffDocumentsChain = exports.SimpleSequentialChain = exports.SequentialChain = exports.ConversationChain = exports.APIChain = exports.LLMChain = exports.BaseChain = void 0;
|
|
4
4
|
var base_js_1 = require("./base.cjs");
|
|
5
5
|
Object.defineProperty(exports, "BaseChain", { enumerable: true, get: function () { return base_js_1.BaseChain; } });
|
|
6
6
|
var llm_chain_js_1 = require("./llm_chain.cjs");
|
|
@@ -59,3 +59,4 @@ Object.defineProperty(exports, "createTaggingChain", { enumerable: true, get: fu
|
|
|
59
59
|
Object.defineProperty(exports, "createTaggingChainFromZod", { enumerable: true, get: function () { return tagging_js_1.createTaggingChainFromZod; } });
|
|
60
60
|
var openapi_js_1 = require("./openai_functions/openapi.cjs");
|
|
61
61
|
Object.defineProperty(exports, "createOpenAPIChain", { enumerable: true, get: function () { return openapi_js_1.createOpenAPIChain; } });
|
|
62
|
+
Object.defineProperty(exports, "convertOpenAPISpecToOpenAIFunctions", { enumerable: true, get: function () { return openapi_js_1.convertOpenAPISpecToOpenAIFunctions; } });
|
package/dist/chains/index.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ export { MultiRetrievalQAChain } from "./router/multi_retrieval_qa.js";
|
|
|
22
22
|
export { TransformChain, type TransformChainFields } from "./transform.js";
|
|
23
23
|
export { createExtractionChain, createExtractionChainFromZod, } from "./openai_functions/extraction.js";
|
|
24
24
|
export { type TaggingChainOptions, createTaggingChain, createTaggingChainFromZod, } from "./openai_functions/tagging.js";
|
|
25
|
-
export { type OpenAPIChainOptions, createOpenAPIChain, } from "./openai_functions/openapi.js";
|
|
25
|
+
export { type OpenAPIChainOptions, createOpenAPIChain, convertOpenAPISpecToOpenAIFunctions, } from "./openai_functions/openapi.js";
|
package/dist/chains/index.js
CHANGED
|
@@ -21,4 +21,4 @@ export { MultiRetrievalQAChain } from "./router/multi_retrieval_qa.js";
|
|
|
21
21
|
export { TransformChain } from "./transform.js";
|
|
22
22
|
export { createExtractionChain, createExtractionChainFromZod, } from "./openai_functions/extraction.js";
|
|
23
23
|
export { createTaggingChain, createTaggingChainFromZod, } from "./openai_functions/tagging.js";
|
|
24
|
-
export { createOpenAPIChain, } from "./openai_functions/openapi.js";
|
|
24
|
+
export { createOpenAPIChain, convertOpenAPISpecToOpenAIFunctions, } from "./openai_functions/openapi.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createOpenAPIChain = exports.convertOpenAPISchemaToJSONSchema = void 0;
|
|
3
|
+
exports.createOpenAPIChain = exports.convertOpenAPISpecToOpenAIFunctions = exports.convertOpenAPISchemaToJSONSchema = void 0;
|
|
4
4
|
const openai_1 = require("@langchain/openai");
|
|
5
5
|
const prompts_1 = require("@langchain/core/prompts");
|
|
6
6
|
const openapi_js_1 = require("../../util/openapi.cjs");
|
|
@@ -302,6 +302,7 @@ function convertOpenAPISpecToOpenAIFunctions(spec) {
|
|
|
302
302
|
},
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
+
exports.convertOpenAPISpecToOpenAIFunctions = convertOpenAPISpecToOpenAIFunctions;
|
|
305
306
|
/**
|
|
306
307
|
* A chain for making simple API requests.
|
|
307
308
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { OpenAIClient } from "@langchain/openai";
|
|
1
2
|
import { JsonSchema7Type } from "zod-to-json-schema";
|
|
2
3
|
import type { OpenAPIV3_1 } from "openapi-types";
|
|
3
4
|
import { BaseChatModel } from "@langchain/core/language_models/chat_models";
|
|
@@ -7,6 +8,13 @@ import { OpenAPISpec } from "../../util/openapi.js";
|
|
|
7
8
|
import { BaseChain } from "../base.js";
|
|
8
9
|
import { LLMChainInput } from "../llm_chain.js";
|
|
9
10
|
import { SequentialChain } from "../sequential_chain.js";
|
|
11
|
+
/**
|
|
12
|
+
* Type representing a function for executing OpenAPI requests.
|
|
13
|
+
*/
|
|
14
|
+
type OpenAPIExecutionMethod = (name: string, requestArgs: Record<string, any>, options?: {
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
params?: Record<string, string>;
|
|
17
|
+
}) => Promise<string>;
|
|
10
18
|
/**
|
|
11
19
|
* Converts OpenAPI schemas to JSON schema format.
|
|
12
20
|
* @param schema The OpenAPI schema to convert.
|
|
@@ -14,6 +22,15 @@ import { SequentialChain } from "../sequential_chain.js";
|
|
|
14
22
|
* @returns The JSON schema representation of the OpenAPI schema.
|
|
15
23
|
*/
|
|
16
24
|
export declare function convertOpenAPISchemaToJSONSchema(schema: OpenAPIV3_1.SchemaObject, spec: OpenAPISpec): JsonSchema7Type;
|
|
25
|
+
/**
|
|
26
|
+
* Converts an OpenAPI specification to OpenAI functions.
|
|
27
|
+
* @param spec The OpenAPI specification to convert.
|
|
28
|
+
* @returns An object containing the OpenAI functions derived from the OpenAPI specification and a default execution method.
|
|
29
|
+
*/
|
|
30
|
+
export declare function convertOpenAPISpecToOpenAIFunctions(spec: OpenAPISpec): {
|
|
31
|
+
openAIFunctions: OpenAIClient.Chat.ChatCompletionCreateParams.Function[];
|
|
32
|
+
defaultExecutionMethod?: OpenAPIExecutionMethod;
|
|
33
|
+
};
|
|
17
34
|
/**
|
|
18
35
|
* Type representing the options for creating an OpenAPI chain.
|
|
19
36
|
*/
|
|
@@ -33,3 +50,4 @@ export type OpenAPIChainOptions = {
|
|
|
33
50
|
* @returns OpenAPIChain
|
|
34
51
|
*/
|
|
35
52
|
export declare function createOpenAPIChain(spec: OpenAPIV3_1.Document | string, options?: OpenAPIChainOptions): Promise<SequentialChain>;
|
|
53
|
+
export {};
|
|
@@ -160,7 +160,7 @@ export function convertOpenAPISchemaToJSONSchema(schema, spec) {
|
|
|
160
160
|
* @param spec The OpenAPI specification to convert.
|
|
161
161
|
* @returns An object containing the OpenAI functions derived from the OpenAPI specification and a default execution method.
|
|
162
162
|
*/
|
|
163
|
-
function convertOpenAPISpecToOpenAIFunctions(spec) {
|
|
163
|
+
export function convertOpenAPISpecToOpenAIFunctions(spec) {
|
|
164
164
|
if (!spec.document.paths) {
|
|
165
165
|
return { openAIFunctions: [] };
|
|
166
166
|
}
|
|
@@ -142,7 +142,8 @@ function _inferModelProvider(modelName) {
|
|
|
142
142
|
if (modelName.startsWith("gpt-3") ||
|
|
143
143
|
modelName.startsWith("gpt-4") ||
|
|
144
144
|
modelName.startsWith("o1") ||
|
|
145
|
-
modelName.startsWith("o3")
|
|
145
|
+
modelName.startsWith("o3") ||
|
|
146
|
+
modelName.startsWith("o4")) {
|
|
146
147
|
return "openai";
|
|
147
148
|
}
|
|
148
149
|
else if (modelName.startsWith("claude")) {
|
|
@@ -139,7 +139,8 @@ export function _inferModelProvider(modelName) {
|
|
|
139
139
|
if (modelName.startsWith("gpt-3") ||
|
|
140
140
|
modelName.startsWith("gpt-4") ||
|
|
141
141
|
modelName.startsWith("o1") ||
|
|
142
|
-
modelName.startsWith("o3")
|
|
142
|
+
modelName.startsWith("o3") ||
|
|
143
|
+
modelName.startsWith("o4")) {
|
|
143
144
|
return "openai";
|
|
144
145
|
}
|
|
145
146
|
else if (modelName.startsWith("claude")) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
4
|
import type { readFile as ReadFileT } from "node:fs/promises";
|
|
4
5
|
import { Document } from "@langchain/core/documents";
|
|
5
6
|
import { BaseDocumentLoader } from "../base.js";
|