langchain 0.3.2 → 0.3.3
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/graph_qa/cypher.cjs +14 -0
- package/dist/chains/graph_qa/cypher.d.ts +14 -0
- package/dist/chains/graph_qa/cypher.js +14 -0
- package/dist/chains/openai_functions/extraction.d.ts +2 -2
- package/dist/chains/openai_functions/structured_output.d.ts +2 -2
- package/dist/chains/openai_functions/tagging.d.ts +2 -2
- package/dist/chains/query_constructor/index.d.ts +1 -1
- package/dist/chat_models/universal.d.ts +1 -1
- package/dist/experimental/openai_assistant/index.d.ts +9 -3
- package/dist/experimental/openai_files/index.d.ts +9 -3
- package/dist/output_parsers/openai_tools.cjs +1 -0
- package/dist/output_parsers/openai_tools.js +1 -0
- package/package.json +2 -2
|
@@ -11,6 +11,8 @@ const entrypoint_deprecation_js_1 = require("../../util/entrypoint_deprecation.c
|
|
|
11
11
|
});
|
|
12
12
|
exports.INTERMEDIATE_STEPS_KEY = "intermediateSteps";
|
|
13
13
|
/**
|
|
14
|
+
* Chain for question-answering against a graph by generating Cypher statements.
|
|
15
|
+
*
|
|
14
16
|
* @example
|
|
15
17
|
* ```typescript
|
|
16
18
|
* const chain = new GraphCypherQAChain({
|
|
@@ -19,6 +21,18 @@ exports.INTERMEDIATE_STEPS_KEY = "intermediateSteps";
|
|
|
19
21
|
* });
|
|
20
22
|
* const res = await chain.invoke("Who played in Pulp Fiction?");
|
|
21
23
|
* ```
|
|
24
|
+
*
|
|
25
|
+
* @security
|
|
26
|
+
* This chain will execute Cypher statements against the provided database.
|
|
27
|
+
* Make sure that the database connection uses credentials
|
|
28
|
+
* that are narrowly-scoped to only include necessary permissions.
|
|
29
|
+
* Failure to do so may result in data corruption or loss, since the calling code
|
|
30
|
+
* may attempt commands that would result in deletion, mutation of data
|
|
31
|
+
* if appropriately prompted or reading sensitive data if such data is present in the database.
|
|
32
|
+
* The best way to guard against such negative outcomes is to (as appropriate) limit the
|
|
33
|
+
* permissions granted to the credentials used with this tool.
|
|
34
|
+
*
|
|
35
|
+
* See https://js.langchain.com/docs/security for more information.
|
|
22
36
|
*/
|
|
23
37
|
class GraphCypherQAChain extends base_js_1.BaseChain {
|
|
24
38
|
constructor(props) {
|
|
@@ -26,6 +26,8 @@ export interface FromLLMInput {
|
|
|
26
26
|
returnDirect?: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
+
* Chain for question-answering against a graph by generating Cypher statements.
|
|
30
|
+
*
|
|
29
31
|
* @example
|
|
30
32
|
* ```typescript
|
|
31
33
|
* const chain = new GraphCypherQAChain({
|
|
@@ -34,6 +36,18 @@ export interface FromLLMInput {
|
|
|
34
36
|
* });
|
|
35
37
|
* const res = await chain.invoke("Who played in Pulp Fiction?");
|
|
36
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @security
|
|
41
|
+
* This chain will execute Cypher statements against the provided database.
|
|
42
|
+
* Make sure that the database connection uses credentials
|
|
43
|
+
* that are narrowly-scoped to only include necessary permissions.
|
|
44
|
+
* Failure to do so may result in data corruption or loss, since the calling code
|
|
45
|
+
* may attempt commands that would result in deletion, mutation of data
|
|
46
|
+
* if appropriately prompted or reading sensitive data if such data is present in the database.
|
|
47
|
+
* The best way to guard against such negative outcomes is to (as appropriate) limit the
|
|
48
|
+
* permissions granted to the credentials used with this tool.
|
|
49
|
+
*
|
|
50
|
+
* See https://js.langchain.com/docs/security for more information.
|
|
37
51
|
*/
|
|
38
52
|
export declare class GraphCypherQAChain extends BaseChain {
|
|
39
53
|
private graph;
|
|
@@ -8,6 +8,8 @@ import { logVersion020MigrationWarning } from "../../util/entrypoint_deprecation
|
|
|
8
8
|
});
|
|
9
9
|
export const INTERMEDIATE_STEPS_KEY = "intermediateSteps";
|
|
10
10
|
/**
|
|
11
|
+
* Chain for question-answering against a graph by generating Cypher statements.
|
|
12
|
+
*
|
|
11
13
|
* @example
|
|
12
14
|
* ```typescript
|
|
13
15
|
* const chain = new GraphCypherQAChain({
|
|
@@ -16,6 +18,18 @@ export const INTERMEDIATE_STEPS_KEY = "intermediateSteps";
|
|
|
16
18
|
* });
|
|
17
19
|
* const res = await chain.invoke("Who played in Pulp Fiction?");
|
|
18
20
|
* ```
|
|
21
|
+
*
|
|
22
|
+
* @security
|
|
23
|
+
* This chain will execute Cypher statements against the provided database.
|
|
24
|
+
* Make sure that the database connection uses credentials
|
|
25
|
+
* that are narrowly-scoped to only include necessary permissions.
|
|
26
|
+
* Failure to do so may result in data corruption or loss, since the calling code
|
|
27
|
+
* may attempt commands that would result in deletion, mutation of data
|
|
28
|
+
* if appropriately prompted or reading sensitive data if such data is present in the database.
|
|
29
|
+
* The best way to guard against such negative outcomes is to (as appropriate) limit the
|
|
30
|
+
* permissions granted to the credentials used with this tool.
|
|
31
|
+
*
|
|
32
|
+
* See https://js.langchain.com/docs/security for more information.
|
|
19
33
|
*/
|
|
20
34
|
export class GraphCypherQAChain extends BaseChain {
|
|
21
35
|
constructor(props) {
|
|
@@ -10,7 +10,7 @@ import { LLMChain } from "../llm_chain.js";
|
|
|
10
10
|
* @param llm Must be a ChatOpenAI or AnthropicFunctions model that supports function calling.
|
|
11
11
|
* @returns A LLMChain instance configured to return data matching the schema.
|
|
12
12
|
*/
|
|
13
|
-
export declare function createExtractionChain(schema: FunctionParameters, llm: BaseChatModel<BaseFunctionCallOptions>): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").
|
|
13
|
+
export declare function createExtractionChain(schema: FunctionParameters, llm: BaseChatModel<BaseFunctionCallOptions>): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").AIMessageChunk>>;
|
|
14
14
|
/**
|
|
15
15
|
* Function that creates an extraction chain from a Zod schema. It
|
|
16
16
|
* converts the Zod schema to a JSON schema using zod-to-json-schema
|
|
@@ -19,4 +19,4 @@ export declare function createExtractionChain(schema: FunctionParameters, llm: B
|
|
|
19
19
|
* @param llm Must be a ChatOpenAI or AnthropicFunctions model that supports function calling.
|
|
20
20
|
* @returns A LLMChain instance configured to return data matching the schema.
|
|
21
21
|
*/
|
|
22
|
-
export declare function createExtractionChainFromZod(schema: z.ZodObject<any, any, any, any>, llm: BaseChatModel<BaseFunctionCallOptions>): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").
|
|
22
|
+
export declare function createExtractionChainFromZod(schema: z.ZodObject<any, any, any, any>, llm: BaseChatModel<BaseFunctionCallOptions>): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").AIMessageChunk>>;
|
|
@@ -55,6 +55,6 @@ export declare class FunctionCallStructuredOutputParser<T extends z.AnyZodObject
|
|
|
55
55
|
* as well as an additional required "outputSchema" JSON Schema object.
|
|
56
56
|
* @returns OpenAPIChain
|
|
57
57
|
*/
|
|
58
|
-
export declare function createStructuredOutputChain<T extends z.AnyZodObject = z.AnyZodObject>(input: StructuredOutputChainInput<T>): LLMChain<any, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").
|
|
58
|
+
export declare function createStructuredOutputChain<T extends z.AnyZodObject = z.AnyZodObject>(input: StructuredOutputChainInput<T>): LLMChain<any, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").AIMessageChunk> | ChatOpenAI<BaseFunctionCallOptions>>;
|
|
59
59
|
/** @deprecated Use {@link https://api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
|
|
60
|
-
export declare function createStructuredOutputChainFromZod<T extends z.AnyZodObject>(zodSchema: T, input: Omit<StructuredOutputChainInput<T>, "outputSchema">): LLMChain<any, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").
|
|
60
|
+
export declare function createStructuredOutputChainFromZod<T extends z.AnyZodObject>(zodSchema: T, input: Omit<StructuredOutputChainInput<T>, "outputSchema">): LLMChain<any, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").AIMessageChunk> | ChatOpenAI<BaseFunctionCallOptions>>;
|
|
@@ -23,7 +23,7 @@ export type TaggingChainOptions = {
|
|
|
23
23
|
* Switch to expression language: https://js.langchain.com/docs/expression_language/
|
|
24
24
|
* Will be removed in 0.2.0
|
|
25
25
|
*/
|
|
26
|
-
export declare function createTaggingChain(schema: FunctionParameters, llm: BaseChatModel<BaseFunctionCallOptions>, options?: TaggingChainOptions): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").
|
|
26
|
+
export declare function createTaggingChain(schema: FunctionParameters, llm: BaseChatModel<BaseFunctionCallOptions>, options?: TaggingChainOptions): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").AIMessageChunk>>;
|
|
27
27
|
/**
|
|
28
28
|
* Function that creates a tagging chain from a Zod schema. It converts
|
|
29
29
|
* the Zod schema to a JSON schema using the zodToJsonSchema function and
|
|
@@ -37,4 +37,4 @@ export declare function createTaggingChain(schema: FunctionParameters, llm: Base
|
|
|
37
37
|
* Switch to expression language: https://js.langchain.com/docs/expression_language/
|
|
38
38
|
* Will be removed in 0.2.0
|
|
39
39
|
*/
|
|
40
|
-
export declare function createTaggingChainFromZod(schema: z.ZodObject<any, any, any, any>, llm: BaseChatModel<BaseFunctionCallOptions>, options?: TaggingChainOptions): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").
|
|
40
|
+
export declare function createTaggingChainFromZod(schema: z.ZodObject<any, any, any, any>, llm: BaseChatModel<BaseFunctionCallOptions>, options?: TaggingChainOptions): LLMChain<object, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").AIMessageChunk>>;
|
|
@@ -69,4 +69,4 @@ export type QueryConstructorRunnableOptions = {
|
|
|
69
69
|
};
|
|
70
70
|
/** @deprecated */
|
|
71
71
|
export type QueryConstructorChainOptions = QueryConstructorRunnableOptions;
|
|
72
|
-
export declare function loadQueryConstructorRunnable(opts: QueryConstructorRunnableOptions): import("@langchain/core/runnables").Runnable<any, StructuredQuery, import("@langchain/core/runnables").RunnableConfig
|
|
72
|
+
export declare function loadQueryConstructorRunnable(opts: QueryConstructorRunnableOptions): import("@langchain/core/runnables").Runnable<any, StructuredQuery, import("@langchain/core/runnables").RunnableConfig<Record<string, any>>>;
|
|
@@ -60,7 +60,7 @@ declare class _ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseL
|
|
|
60
60
|
*/
|
|
61
61
|
_queuedMethodOperations: Record<string, any>;
|
|
62
62
|
constructor(fields: ConfigurableModelFields);
|
|
63
|
-
_model(config?: RunnableConfig): Promise<BaseChatModel<BaseChatModelCallOptions,
|
|
63
|
+
_model(config?: RunnableConfig): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk>>;
|
|
64
64
|
_generate(messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
65
65
|
bindTools(tools: BindToolsInput[], params?: Record<string, any>): _ConfigurableModel<RunInput, CallOptions>;
|
|
66
66
|
withStructuredOutput: BaseChatModel["withStructuredOutput"];
|
|
@@ -33,14 +33,18 @@ export declare class OpenAIAssistantRunnable<AsAgent extends boolean | undefined
|
|
|
33
33
|
* @link {https://platform.openai.com/docs/api-reference/assistants/deleteAssistant}
|
|
34
34
|
* @returns {Promise<AssistantDeleted>}
|
|
35
35
|
*/
|
|
36
|
-
deleteAssistant(): Promise<OpenAIClient.Beta.Assistants.AssistantDeleted
|
|
36
|
+
deleteAssistant(): Promise<OpenAIClient.Beta.Assistants.AssistantDeleted & {
|
|
37
|
+
_request_id?: string | null | undefined;
|
|
38
|
+
}>;
|
|
37
39
|
/**
|
|
38
40
|
* Retrieves an assistant.
|
|
39
41
|
*
|
|
40
42
|
* @link {https://platform.openai.com/docs/api-reference/assistants/getAssistant}
|
|
41
43
|
* @returns {Promise<OpenAIClient.Beta.Assistants.Assistant>}
|
|
42
44
|
*/
|
|
43
|
-
getAssistant(): Promise<OpenAIClient.Beta.Assistants.Assistant
|
|
45
|
+
getAssistant(): Promise<OpenAIClient.Beta.Assistants.Assistant & {
|
|
46
|
+
_request_id?: string | null | undefined;
|
|
47
|
+
}>;
|
|
44
48
|
/**
|
|
45
49
|
* Modifies an assistant.
|
|
46
50
|
*
|
|
@@ -52,7 +56,9 @@ export declare class OpenAIAssistantRunnable<AsAgent extends boolean | undefined
|
|
|
52
56
|
name?: string;
|
|
53
57
|
instructions?: string;
|
|
54
58
|
fileIds?: string[];
|
|
55
|
-
}): Promise<OpenAIClient.Beta.Assistants.Assistant
|
|
59
|
+
}): Promise<OpenAIClient.Beta.Assistants.Assistant & {
|
|
60
|
+
_request_id?: string | null | undefined;
|
|
61
|
+
}>;
|
|
56
62
|
private _parseStepsInput;
|
|
57
63
|
private _createRun;
|
|
58
64
|
private _createThreadAndRun;
|
|
@@ -22,7 +22,9 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
22
22
|
*/
|
|
23
23
|
createFile({ file, purpose, options, }: OpenAIClient.FileCreateParams & {
|
|
24
24
|
options?: OpenAIClient.RequestOptions;
|
|
25
|
-
}): Promise<OpenAIClient.Files.FileObject
|
|
25
|
+
}): Promise<OpenAIClient.Files.FileObject & {
|
|
26
|
+
_request_id?: string | null | undefined;
|
|
27
|
+
}>;
|
|
26
28
|
/**
|
|
27
29
|
* Delete a file.
|
|
28
30
|
*
|
|
@@ -34,7 +36,9 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
34
36
|
deleteFile({ fileId, options, }: {
|
|
35
37
|
fileId: string;
|
|
36
38
|
options?: OpenAIClient.RequestOptions;
|
|
37
|
-
}): Promise<OpenAIClient.Files.FileDeleted
|
|
39
|
+
}): Promise<OpenAIClient.Files.FileDeleted & {
|
|
40
|
+
_request_id?: string | null | undefined;
|
|
41
|
+
}>;
|
|
38
42
|
/**
|
|
39
43
|
* List files
|
|
40
44
|
* Returns a list of files that belong to the user's organization.
|
|
@@ -60,7 +64,9 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
60
64
|
retrieveFile({ fileId, options, }: {
|
|
61
65
|
fileId: string;
|
|
62
66
|
options?: OpenAIClient.RequestOptions;
|
|
63
|
-
}): Promise<OpenAIClient.Files.FileObject
|
|
67
|
+
}): Promise<OpenAIClient.Files.FileObject & {
|
|
68
|
+
_request_id?: string | null | undefined;
|
|
69
|
+
}>;
|
|
64
70
|
/**
|
|
65
71
|
* Retrieve file content
|
|
66
72
|
* Returns the contents of the specified file.
|
|
@@ -76,6 +76,7 @@ exports.JsonOutputToolsParser = JsonOutputToolsParser;
|
|
|
76
76
|
/**
|
|
77
77
|
* @deprecated Import from "@langchain/core/output_parsers/openai_tools"
|
|
78
78
|
*/
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
80
|
class JsonOutputKeyToolsParser extends output_parsers_1.BaseLLMOutputParser {
|
|
80
81
|
static lc_name() {
|
|
81
82
|
return "JsonOutputKeyToolsParser";
|
|
@@ -72,6 +72,7 @@ export class JsonOutputToolsParser extends BaseLLMOutputParser {
|
|
|
72
72
|
/**
|
|
73
73
|
* @deprecated Import from "@langchain/core/output_parsers/openai_tools"
|
|
74
74
|
*/
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
76
|
export class JsonOutputKeyToolsParser extends BaseLLMOutputParser {
|
|
76
77
|
static lc_name() {
|
|
77
78
|
return "JsonOutputKeyToolsParser";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
"js-tiktoken": "^1.0.12",
|
|
521
521
|
"js-yaml": "^4.1.0",
|
|
522
522
|
"jsonpointer": "^5.0.1",
|
|
523
|
-
"langsmith": "^0.1.56
|
|
523
|
+
"langsmith": "^0.1.56",
|
|
524
524
|
"openapi-types": "^12.1.3",
|
|
525
525
|
"p-retry": "4",
|
|
526
526
|
"uuid": "^10.0.0",
|