langchain 0.3.21 → 0.3.22
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/document_loaders/fs/buffer.d.ts +1 -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
|
}
|
|
@@ -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";
|
package/dist/sql_db.cjs
CHANGED
|
@@ -74,7 +74,7 @@ class SqlDatabase extends serializable_1.Serializable {
|
|
|
74
74
|
this.appDataSource = fields.appDataSource;
|
|
75
75
|
this.appDataSourceOptions = fields.appDataSource.options;
|
|
76
76
|
if (fields?.includesTables && fields?.ignoreTables) {
|
|
77
|
-
throw new Error("Cannot specify both
|
|
77
|
+
throw new Error("Cannot specify both includeTables and ignoreTables");
|
|
78
78
|
}
|
|
79
79
|
this.includesTables = fields?.includesTables ?? [];
|
|
80
80
|
this.ignoreTables = fields?.ignoreTables ?? [];
|
package/dist/sql_db.js
CHANGED
|
@@ -71,7 +71,7 @@ export class SqlDatabase extends Serializable {
|
|
|
71
71
|
this.appDataSource = fields.appDataSource;
|
|
72
72
|
this.appDataSourceOptions = fields.appDataSource.options;
|
|
73
73
|
if (fields?.includesTables && fields?.ignoreTables) {
|
|
74
|
-
throw new Error("Cannot specify both
|
|
74
|
+
throw new Error("Cannot specify both includeTables and ignoreTables");
|
|
75
75
|
}
|
|
76
76
|
this.includesTables = fields?.includesTables ?? [];
|
|
77
77
|
this.ignoreTables = fields?.ignoreTables ?? [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -458,7 +458,7 @@
|
|
|
458
458
|
"peggy": "^3.0.2",
|
|
459
459
|
"prettier": "^2.8.3",
|
|
460
460
|
"reflect-metadata": "^0.2.2",
|
|
461
|
-
"release-it": "^
|
|
461
|
+
"release-it": "^18.1.2",
|
|
462
462
|
"rimraf": "^5.0.1",
|
|
463
463
|
"rollup": "^3.19.1",
|
|
464
464
|
"ts-jest": "^29.1.0",
|
|
@@ -545,7 +545,7 @@
|
|
|
545
545
|
"js-tiktoken": "^1.0.12",
|
|
546
546
|
"js-yaml": "^4.1.0",
|
|
547
547
|
"jsonpointer": "^5.0.1",
|
|
548
|
-
"langsmith": "
|
|
548
|
+
"langsmith": "^0.3.16",
|
|
549
549
|
"openapi-types": "^12.1.3",
|
|
550
550
|
"p-retry": "4",
|
|
551
551
|
"uuid": "^10.0.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/schema/document.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/schema/document.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/schema/document.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/schema/document.js'
|