langchain 0.2.15 → 0.2.16
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/agents/chat/index.cjs +1 -1
- package/dist/agents/chat/index.d.ts +1 -1
- package/dist/agents/chat/index.js +1 -1
- package/dist/agents/chat_convo/index.cjs +1 -1
- package/dist/agents/chat_convo/index.d.ts +1 -1
- package/dist/agents/chat_convo/index.js +1 -1
- package/dist/agents/mrkl/index.cjs +1 -1
- package/dist/agents/mrkl/index.d.ts +1 -1
- package/dist/agents/mrkl/index.js +1 -1
- package/dist/agents/openai_functions/index.cjs +1 -1
- package/dist/agents/openai_functions/index.d.ts +1 -1
- package/dist/agents/openai_functions/index.js +1 -1
- package/dist/agents/structured_chat/index.cjs +1 -1
- package/dist/agents/structured_chat/index.d.ts +1 -1
- package/dist/agents/structured_chat/index.js +1 -1
- package/dist/agents/xml/index.cjs +1 -1
- package/dist/agents/xml/index.d.ts +1 -1
- package/dist/agents/xml/index.js +1 -1
- package/dist/chains/load.cjs +1 -1
- package/dist/chains/load.d.ts +1 -1
- package/dist/chains/load.js +1 -1
- package/dist/chains/openai_functions/structured_output.cjs +2 -2
- package/dist/chains/openai_functions/structured_output.d.ts +2 -2
- package/dist/chains/openai_functions/structured_output.js +2 -2
- package/dist/chains/serde.d.ts +12 -12
- package/dist/retrievers/self_query/functional.d.ts +1 -1
- package/dist/retrievers/self_query/index.cjs +10 -2
- package/dist/retrievers/self_query/index.js +10 -2
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ const DEFAULT_HUMAN_MESSAGE_TEMPLATE = "{input}\n\n{agent_scratchpad}";
|
|
|
11
11
|
* Agent for the MRKL chain.
|
|
12
12
|
* @augments Agent
|
|
13
13
|
*
|
|
14
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
14
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
15
15
|
*/
|
|
16
16
|
class ChatAgent extends agent_js_1.Agent {
|
|
17
17
|
static lc_name() {
|
|
@@ -33,7 +33,7 @@ export type ChatAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
33
33
|
* Agent for the MRKL chain.
|
|
34
34
|
* @augments Agent
|
|
35
35
|
*
|
|
36
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
36
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
37
37
|
*/
|
|
38
38
|
export declare class ChatAgent extends Agent {
|
|
39
39
|
static lc_name(): string;
|
|
@@ -8,7 +8,7 @@ const DEFAULT_HUMAN_MESSAGE_TEMPLATE = "{input}\n\n{agent_scratchpad}";
|
|
|
8
8
|
* Agent for the MRKL chain.
|
|
9
9
|
* @augments Agent
|
|
10
10
|
*
|
|
11
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
11
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
12
12
|
*/
|
|
13
13
|
export class ChatAgent extends Agent {
|
|
14
14
|
static lc_name() {
|
|
@@ -11,7 +11,7 @@ const prompt_js_1 = require("./prompt.cjs");
|
|
|
11
11
|
* Agent for the MRKL chain.
|
|
12
12
|
* @augments Agent
|
|
13
13
|
*
|
|
14
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
14
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
15
15
|
*/
|
|
16
16
|
class ChatConversationalAgent extends agent_js_1.Agent {
|
|
17
17
|
static lc_name() {
|
|
@@ -30,7 +30,7 @@ export type ChatConversationalAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
30
30
|
* Agent for the MRKL chain.
|
|
31
31
|
* @augments Agent
|
|
32
32
|
*
|
|
33
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
33
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
34
34
|
*/
|
|
35
35
|
export declare class ChatConversationalAgent extends Agent {
|
|
36
36
|
static lc_name(): string;
|
|
@@ -8,7 +8,7 @@ import { PREFIX_END, DEFAULT_PREFIX, DEFAULT_SUFFIX, TEMPLATE_TOOL_RESPONSE, } f
|
|
|
8
8
|
* Agent for the MRKL chain.
|
|
9
9
|
* @augments Agent
|
|
10
10
|
*
|
|
11
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
11
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
12
12
|
*/
|
|
13
13
|
export class ChatConversationalAgent extends Agent {
|
|
14
14
|
static lc_name() {
|
|
@@ -32,7 +32,7 @@ const prompt_js_1 = require("./prompt.cjs");
|
|
|
32
32
|
* });
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
35
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createReactAgent.html | createReactAgent method instead}.
|
|
36
36
|
*/
|
|
37
37
|
class ZeroShotAgent extends agent_js_1.Agent {
|
|
38
38
|
static lc_name() {
|
|
@@ -46,7 +46,7 @@ export type ZeroShotAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
46
46
|
* });
|
|
47
47
|
* ```
|
|
48
48
|
*
|
|
49
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
49
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createReactAgent.html | createReactAgent method instead}.
|
|
50
50
|
*/
|
|
51
51
|
export declare class ZeroShotAgent extends Agent {
|
|
52
52
|
static lc_name(): string;
|
|
@@ -29,7 +29,7 @@ import { FORMAT_INSTRUCTIONS, PREFIX, SUFFIX } from "./prompt.js";
|
|
|
29
29
|
* });
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
32
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createReactAgent.html | createReactAgent method instead}.
|
|
33
33
|
*/
|
|
34
34
|
export class ZeroShotAgent extends Agent {
|
|
35
35
|
static lc_name() {
|
|
@@ -35,7 +35,7 @@ exports._formatIntermediateSteps = _formatIntermediateSteps;
|
|
|
35
35
|
* extends the Agent class and provides additional functionality specific
|
|
36
36
|
* to the OpenAIAgent type.
|
|
37
37
|
*
|
|
38
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
38
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createOpenAIFunctionsAgent.html | createOpenAIFunctionsAgent method instead}.
|
|
39
39
|
*/
|
|
40
40
|
class OpenAIAgent extends agent_js_1.Agent {
|
|
41
41
|
static lc_name() {
|
|
@@ -29,7 +29,7 @@ export interface OpenAIAgentCreatePromptArgs {
|
|
|
29
29
|
* extends the Agent class and provides additional functionality specific
|
|
30
30
|
* to the OpenAIAgent type.
|
|
31
31
|
*
|
|
32
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
32
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createOpenAIFunctionsAgent.html | createOpenAIFunctionsAgent method instead}.
|
|
33
33
|
*/
|
|
34
34
|
export declare class OpenAIAgent extends Agent {
|
|
35
35
|
static lc_name(): string;
|
|
@@ -31,7 +31,7 @@ export function _formatIntermediateSteps(intermediateSteps) {
|
|
|
31
31
|
* extends the Agent class and provides additional functionality specific
|
|
32
32
|
* to the OpenAIAgent type.
|
|
33
33
|
*
|
|
34
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
34
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createOpenAIFunctionsAgent.html | createOpenAIFunctionsAgent method instead}.
|
|
35
35
|
*/
|
|
36
36
|
export class OpenAIAgent extends Agent {
|
|
37
37
|
static lc_name() {
|
|
@@ -15,7 +15,7 @@ const log_js_1 = require("../format_scratchpad/log.cjs");
|
|
|
15
15
|
/**
|
|
16
16
|
* Agent that interoperates with Structured Tools using React logic.
|
|
17
17
|
* @augments Agent
|
|
18
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
18
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
19
19
|
*/
|
|
20
20
|
class StructuredChatAgent extends agent_js_1.Agent {
|
|
21
21
|
static lc_name() {
|
|
@@ -31,7 +31,7 @@ export type StructuredChatAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
31
31
|
/**
|
|
32
32
|
* Agent that interoperates with Structured Tools using React logic.
|
|
33
33
|
* @augments Agent
|
|
34
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
34
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
35
35
|
*/
|
|
36
36
|
export declare class StructuredChatAgent extends Agent {
|
|
37
37
|
static lc_name(): string;
|
|
@@ -12,7 +12,7 @@ import { formatLogToString } from "../format_scratchpad/log.js";
|
|
|
12
12
|
/**
|
|
13
13
|
* Agent that interoperates with Structured Tools using React logic.
|
|
14
14
|
* @augments Agent
|
|
15
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
15
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createStructuredChatAgent.html | createStructuredChatAgent method instead}.
|
|
16
16
|
*/
|
|
17
17
|
export class StructuredChatAgent extends Agent {
|
|
18
18
|
static lc_name() {
|
|
@@ -12,7 +12,7 @@ const xml_js_1 = require("../format_scratchpad/xml.cjs");
|
|
|
12
12
|
/**
|
|
13
13
|
* Class that represents an agent that uses XML tags.
|
|
14
14
|
*
|
|
15
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
15
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createXmlAgent.html | createXmlAgent method instead}.
|
|
16
16
|
*/
|
|
17
17
|
class XMLAgent extends agent_js_1.BaseSingleActionAgent {
|
|
18
18
|
static lc_name() {
|
|
@@ -18,7 +18,7 @@ export interface XMLAgentInput {
|
|
|
18
18
|
/**
|
|
19
19
|
* Class that represents an agent that uses XML tags.
|
|
20
20
|
*
|
|
21
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
21
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createXmlAgent.html | createXmlAgent method instead}.
|
|
22
22
|
*/
|
|
23
23
|
export declare class XMLAgent extends BaseSingleActionAgent implements XMLAgentInput {
|
|
24
24
|
static lc_name(): string;
|
package/dist/agents/xml/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { formatXml } from "../format_scratchpad/xml.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* Class that represents an agent that uses XML tags.
|
|
11
11
|
*
|
|
12
|
-
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/
|
|
12
|
+
* @deprecated Use the {@link https://v02.api.js.langchain.com/functions/langchain.agents.createXmlAgent.html | createXmlAgent method instead}.
|
|
13
13
|
*/
|
|
14
14
|
export class XMLAgent extends BaseSingleActionAgent {
|
|
15
15
|
static lc_name() {
|
package/dist/chains/load.cjs
CHANGED
|
@@ -27,7 +27,7 @@ const loadChainFromFile = async (file, path, values = {}) => {
|
|
|
27
27
|
* const chain = await loadChain("/path/to/chain.json");
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
30
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | load method}.
|
|
31
31
|
*/
|
|
32
32
|
const loadChain = async (uri, values = {}) => {
|
|
33
33
|
const hubResult = await (0, hub_js_1.loadFromHub)(uri, loadChainFromFile, "chains", new Set(["json", "yaml"]), values);
|
package/dist/chains/load.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ import { LoadValues } from "../util/load.js";
|
|
|
18
18
|
* const chain = await loadChain("/path/to/chain.json");
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
21
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | load method}.
|
|
22
22
|
*/
|
|
23
23
|
export declare const loadChain: (uri: string, values?: LoadValues) => Promise<BaseChain>;
|
package/dist/chains/load.js
CHANGED
|
@@ -24,7 +24,7 @@ const loadChainFromFile = async (file, path, values = {}) => {
|
|
|
24
24
|
* const chain = await loadChain("/path/to/chain.json");
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
27
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | load method}.
|
|
28
28
|
*/
|
|
29
29
|
export const loadChain = async (uri, values = {}) => {
|
|
30
30
|
const hubResult = await loadFromHub(uri, loadChainFromFile, "chains", new Set(["json", "yaml"]), values);
|
|
@@ -102,7 +102,7 @@ class FunctionCallStructuredOutputParser extends output_parsers_1.BaseLLMOutputP
|
|
|
102
102
|
}
|
|
103
103
|
exports.FunctionCallStructuredOutputParser = FunctionCallStructuredOutputParser;
|
|
104
104
|
/**
|
|
105
|
-
* @deprecated Use {@link https://v02.api.js.langchain.com/functions/
|
|
105
|
+
* @deprecated Use {@link https://v02.api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead
|
|
106
106
|
* Create a chain that returns output matching a JSON Schema.
|
|
107
107
|
* @param input Object that includes all LLMChainInput fields except "outputParser"
|
|
108
108
|
* as well as an additional required "outputSchema" JSON Schema object.
|
|
@@ -138,7 +138,7 @@ function createStructuredOutputChain(input) {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
exports.createStructuredOutputChain = createStructuredOutputChain;
|
|
141
|
-
/** @deprecated Use {@link https://v02.api.js.langchain.com/functions/
|
|
141
|
+
/** @deprecated Use {@link https://v02.api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
|
|
142
142
|
function createStructuredOutputChainFromZod(zodSchema, input) {
|
|
143
143
|
return createStructuredOutputChain({
|
|
144
144
|
...input,
|
|
@@ -49,12 +49,12 @@ export declare class FunctionCallStructuredOutputParser<T extends z.AnyZodObject
|
|
|
49
49
|
parseResult(generations: ChatGeneration[]): Promise<any>;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* @deprecated Use {@link https://v02.api.js.langchain.com/functions/
|
|
52
|
+
* @deprecated Use {@link https://v02.api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead
|
|
53
53
|
* Create a chain that returns output matching a JSON Schema.
|
|
54
54
|
* @param input Object that includes all LLMChainInput fields except "outputParser"
|
|
55
55
|
* as well as an additional required "outputSchema" JSON Schema object.
|
|
56
56
|
* @returns OpenAPIChain
|
|
57
57
|
*/
|
|
58
58
|
export declare function createStructuredOutputChain<T extends z.AnyZodObject = z.AnyZodObject>(input: StructuredOutputChainInput<T>): LLMChain<any, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").BaseMessageChunk> | ChatOpenAI<BaseFunctionCallOptions>>;
|
|
59
|
-
/** @deprecated Use {@link https://v02.api.js.langchain.com/functions/
|
|
59
|
+
/** @deprecated Use {@link https://v02.api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
|
|
60
60
|
export declare function createStructuredOutputChainFromZod<T extends z.AnyZodObject>(zodSchema: T, input: Omit<StructuredOutputChainInput<T>, "outputSchema">): LLMChain<any, BaseChatModel<BaseFunctionCallOptions, import("@langchain/core/messages").BaseMessageChunk> | ChatOpenAI<BaseFunctionCallOptions>>;
|
|
@@ -98,7 +98,7 @@ export class FunctionCallStructuredOutputParser extends BaseLLMOutputParser {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* @deprecated Use {@link https://v02.api.js.langchain.com/functions/
|
|
101
|
+
* @deprecated Use {@link https://v02.api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead
|
|
102
102
|
* Create a chain that returns output matching a JSON Schema.
|
|
103
103
|
* @param input Object that includes all LLMChainInput fields except "outputParser"
|
|
104
104
|
* as well as an additional required "outputSchema" JSON Schema object.
|
|
@@ -133,7 +133,7 @@ export function createStructuredOutputChain(input) {
|
|
|
133
133
|
...rest,
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
/** @deprecated Use {@link https://v02.api.js.langchain.com/functions/
|
|
136
|
+
/** @deprecated Use {@link https://v02.api.js.langchain.com/functions/langchain.chains_openai_functions.createStructuredOutputRunnable.html | createStructuredOutputRunnable} instead */
|
|
137
137
|
export function createStructuredOutputChainFromZod(zodSchema, input) {
|
|
138
138
|
return createStructuredOutputChain({
|
|
139
139
|
...input,
|
package/dist/chains/serde.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { SerializedBasePromptTemplate } from "@langchain/core/prompts";
|
|
|
4
4
|
* Represents the serialized form of an LLMChain. It includes properties
|
|
5
5
|
* such as `_type`, `llm`, and `prompt`.
|
|
6
6
|
*
|
|
7
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
7
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
8
8
|
*/
|
|
9
9
|
export type SerializedLLMChain = {
|
|
10
10
|
_type: "llm_chain";
|
|
@@ -16,7 +16,7 @@ export type SerializedLLMChain = {
|
|
|
16
16
|
* properties such as `_type`, `input_variables`, `output_variables`, and
|
|
17
17
|
* `chains`.
|
|
18
18
|
*
|
|
19
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
19
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
20
20
|
*/
|
|
21
21
|
export type SerializedSequentialChain = {
|
|
22
22
|
_type: "sequential_chain";
|
|
@@ -28,7 +28,7 @@ export type SerializedSequentialChain = {
|
|
|
28
28
|
* Represents the serialized form of a SimpleSequentialChain. It includes
|
|
29
29
|
* properties such as `_type` and `chains`.
|
|
30
30
|
*
|
|
31
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
31
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
32
32
|
*/
|
|
33
33
|
export type SerializedSimpleSequentialChain = {
|
|
34
34
|
_type: "simple_sequential_chain";
|
|
@@ -38,7 +38,7 @@ export type SerializedSimpleSequentialChain = {
|
|
|
38
38
|
* Represents the serialized form of a VectorDBQAChain. It includes
|
|
39
39
|
* properties such as `_type`, `k`, and `combine_documents_chain`.
|
|
40
40
|
*
|
|
41
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
41
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
42
42
|
*/
|
|
43
43
|
export type SerializedVectorDBQAChain = {
|
|
44
44
|
_type: "vector_db_qa";
|
|
@@ -50,7 +50,7 @@ export type SerializedVectorDBQAChain = {
|
|
|
50
50
|
* such as `_type`, `api_request_chain`, `api_answer_chain`, and
|
|
51
51
|
* `api_docs`.
|
|
52
52
|
*
|
|
53
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
53
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
54
54
|
*/
|
|
55
55
|
export type SerializedAPIChain = {
|
|
56
56
|
_type: "api_chain";
|
|
@@ -62,7 +62,7 @@ export type SerializedAPIChain = {
|
|
|
62
62
|
* Represents the serialized form of a StuffDocumentsChain. It includes
|
|
63
63
|
* properties such as `_type` and `llm_chain`.
|
|
64
64
|
*
|
|
65
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
65
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
66
66
|
*/
|
|
67
67
|
export type SerializedStuffDocumentsChain = {
|
|
68
68
|
_type: "stuff_documents_chain";
|
|
@@ -73,7 +73,7 @@ export type SerializedStuffDocumentsChain = {
|
|
|
73
73
|
* properties such as `_type`, `k`, `combine_documents_chain`, and
|
|
74
74
|
* `question_generator`.
|
|
75
75
|
*
|
|
76
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
76
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
77
77
|
*/
|
|
78
78
|
export type SerializedChatVectorDBQAChain = {
|
|
79
79
|
_type: "chat-vector-db";
|
|
@@ -86,7 +86,7 @@ export type SerializedChatVectorDBQAChain = {
|
|
|
86
86
|
* includes properties such as `_type`, `llm_chain`, and
|
|
87
87
|
* `combine_document_chain`.
|
|
88
88
|
*
|
|
89
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
89
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
90
90
|
*/
|
|
91
91
|
export type SerializedMapReduceDocumentsChain = {
|
|
92
92
|
_type: "map_reduce_documents_chain";
|
|
@@ -97,7 +97,7 @@ export type SerializedMapReduceDocumentsChain = {
|
|
|
97
97
|
* Represents the serialized form of a RefineDocumentsChain. It includes
|
|
98
98
|
* properties such as `_type`, `llm_chain`, and `refine_llm_chain`.
|
|
99
99
|
*
|
|
100
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
100
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
101
101
|
*/
|
|
102
102
|
export type SerializedRefineDocumentsChain = {
|
|
103
103
|
_type: "refine_documents_chain";
|
|
@@ -108,7 +108,7 @@ export type SerializedRefineDocumentsChain = {
|
|
|
108
108
|
* Represents the serialized form of an AnalyzeDocumentChain. It includes
|
|
109
109
|
* properties such as `_type` and `combine_document_chain`.
|
|
110
110
|
*
|
|
111
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
111
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
112
112
|
*/
|
|
113
113
|
export type SerializedAnalyzeDocumentChain = {
|
|
114
114
|
_type: "analyze_document_chain";
|
|
@@ -119,7 +119,7 @@ export type SerializedAnalyzeDocumentChain = {
|
|
|
119
119
|
* includes properties such as `_type`, `critiqueRequest`,
|
|
120
120
|
* `revisionRequest`, and `name`.
|
|
121
121
|
*
|
|
122
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
122
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
123
123
|
*/
|
|
124
124
|
export type SerializedConstitutionalPrinciple = {
|
|
125
125
|
_type: "constitutional_principle";
|
|
@@ -145,6 +145,6 @@ export type SerializedConstitutionalChain = {
|
|
|
145
145
|
* Represents the serialized form of a BaseChain. It can be one of the
|
|
146
146
|
* above serialized chain types.
|
|
147
147
|
*
|
|
148
|
-
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/
|
|
148
|
+
* @deprecated Use newer {@link https://v02.api.js.langchain.com/functions/langchain.load.load.html | serialization methods}.
|
|
149
149
|
*/
|
|
150
150
|
export type SerializedBaseChain = SerializedLLMChain | SerializedSequentialChain | SerializedSimpleSequentialChain | SerializedVectorDBQAChain | SerializedAPIChain | SerializedStuffDocumentsChain | SerializedChatVectorDBQAChain | SerializedMapReduceDocumentsChain | SerializedAnalyzeDocumentChain | SerializedRefineDocumentsChain | SerializedConstitutionalChain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FunctionFilter, FunctionalTranslator, } from "@langchain/core/structured_query";
|
|
1
|
+
export { type FunctionFilter, FunctionalTranslator, } from "@langchain/core/structured_query";
|
|
@@ -78,7 +78,10 @@ class SelfQueryRetriever extends retrievers_1.BaseRetriever {
|
|
|
78
78
|
this.structuredQueryTranslator = options.structuredQueryTranslator;
|
|
79
79
|
}
|
|
80
80
|
async _getRelevantDocuments(query, runManager) {
|
|
81
|
-
const generatedStructuredQuery = await this.queryConstructor.invoke({ query },
|
|
81
|
+
const generatedStructuredQuery = await this.queryConstructor.invoke({ query }, {
|
|
82
|
+
callbacks: runManager?.getChild("query_constructor"),
|
|
83
|
+
runName: "query_constructor",
|
|
84
|
+
});
|
|
82
85
|
const nextArg = this.structuredQueryTranslator.visitStructuredQuery(generatedStructuredQuery);
|
|
83
86
|
const filter = this.structuredQueryTranslator.mergeFilters(this.searchParams?.filter, nextArg.filter, this.searchParams?.mergeFiltersOperator, this.searchParams?.forceDefaultFilter);
|
|
84
87
|
const generatedQuery = generatedStructuredQuery.query;
|
|
@@ -86,7 +89,12 @@ class SelfQueryRetriever extends retrievers_1.BaseRetriever {
|
|
|
86
89
|
if (!this.useOriginalQuery && generatedQuery && generatedQuery.length > 0) {
|
|
87
90
|
myQuery = generatedQuery;
|
|
88
91
|
}
|
|
89
|
-
return this.vectorStore
|
|
92
|
+
return this.vectorStore
|
|
93
|
+
.asRetriever({
|
|
94
|
+
k: this.searchParams?.k,
|
|
95
|
+
filter,
|
|
96
|
+
})
|
|
97
|
+
.invoke(myQuery, { callbacks: runManager?.getChild("retriever") });
|
|
90
98
|
}
|
|
91
99
|
/**
|
|
92
100
|
* Static method to create a new SelfQueryRetriever instance from a
|
|
@@ -73,7 +73,10 @@ export class SelfQueryRetriever extends BaseRetriever {
|
|
|
73
73
|
this.structuredQueryTranslator = options.structuredQueryTranslator;
|
|
74
74
|
}
|
|
75
75
|
async _getRelevantDocuments(query, runManager) {
|
|
76
|
-
const generatedStructuredQuery = await this.queryConstructor.invoke({ query },
|
|
76
|
+
const generatedStructuredQuery = await this.queryConstructor.invoke({ query }, {
|
|
77
|
+
callbacks: runManager?.getChild("query_constructor"),
|
|
78
|
+
runName: "query_constructor",
|
|
79
|
+
});
|
|
77
80
|
const nextArg = this.structuredQueryTranslator.visitStructuredQuery(generatedStructuredQuery);
|
|
78
81
|
const filter = this.structuredQueryTranslator.mergeFilters(this.searchParams?.filter, nextArg.filter, this.searchParams?.mergeFiltersOperator, this.searchParams?.forceDefaultFilter);
|
|
79
82
|
const generatedQuery = generatedStructuredQuery.query;
|
|
@@ -81,7 +84,12 @@ export class SelfQueryRetriever extends BaseRetriever {
|
|
|
81
84
|
if (!this.useOriginalQuery && generatedQuery && generatedQuery.length > 0) {
|
|
82
85
|
myQuery = generatedQuery;
|
|
83
86
|
}
|
|
84
|
-
return this.vectorStore
|
|
87
|
+
return this.vectorStore
|
|
88
|
+
.asRetriever({
|
|
89
|
+
k: this.searchParams?.k,
|
|
90
|
+
filter,
|
|
91
|
+
})
|
|
92
|
+
.invoke(myQuery, { callbacks: runManager?.getChild("retriever") });
|
|
85
93
|
}
|
|
86
94
|
/**
|
|
87
95
|
* Static method to create a new SelfQueryRetriever instance from a
|