langchain 0.0.209 → 0.0.211
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/agent.d.ts +8 -8
- package/dist/agents/chat/index.cjs +1 -1
- package/dist/agents/chat/index.d.ts +7 -7
- package/dist/agents/chat/index.js +1 -1
- package/dist/agents/chat_convo/index.d.ts +6 -6
- package/dist/agents/chat_convo/outputParser.cjs +3 -3
- package/dist/agents/chat_convo/outputParser.d.ts +5 -5
- package/dist/agents/chat_convo/outputParser.js +3 -3
- package/dist/agents/executor.cjs +6 -6
- package/dist/agents/executor.d.ts +5 -5
- package/dist/agents/executor.js +1 -1
- package/dist/agents/helpers.d.ts +3 -3
- package/dist/agents/initialize.d.ts +5 -5
- package/dist/agents/load.d.ts +4 -4
- package/dist/agents/mrkl/index.d.ts +8 -8
- package/dist/agents/openai/index.d.ts +6 -6
- package/dist/agents/structured_chat/index.d.ts +6 -6
- package/dist/agents/structured_chat/outputParser.d.ts +2 -2
- package/dist/agents/toolkits/aws_sfn.d.ts +2 -2
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.ts +2 -2
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +2 -2
- package/dist/agents/toolkits/json/json.d.ts +4 -4
- package/dist/agents/toolkits/openapi/openapi.d.ts +5 -5
- package/dist/agents/toolkits/sql/sql.d.ts +5 -5
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +12 -12
- package/dist/agents/toolkits/zapier/zapier.d.ts +2 -2
- package/dist/agents/xml/index.d.ts +5 -5
- package/dist/base_language/index.d.ts +1 -1
- package/dist/chains/api/api_chain.d.ts +2 -2
- package/dist/chains/chat_vector_db_chain.d.ts +5 -5
- package/dist/chains/combine_docs_chain.d.ts +1 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +2 -2
- package/dist/chains/conversational_retrieval_chain.cjs +2 -2
- package/dist/chains/conversational_retrieval_chain.d.ts +8 -8
- package/dist/chains/conversational_retrieval_chain.js +2 -2
- package/dist/chains/graph_qa/cypher.d.ts +4 -4
- package/dist/chains/llm_chain.cjs +2 -2
- package/dist/chains/llm_chain.d.ts +8 -5
- package/dist/chains/llm_chain.js +1 -1
- package/dist/chains/query_constructor/index.d.ts +3 -3
- package/dist/chains/question_answering/load.d.ts +7 -7
- package/dist/chains/retrieval_qa.d.ts +5 -5
- package/dist/chains/router/llm_router.d.ts +2 -2
- package/dist/chains/router/multi_prompt.d.ts +3 -3
- package/dist/chains/router/multi_retrieval_qa.cjs +1 -1
- package/dist/chains/router/multi_retrieval_qa.d.ts +7 -7
- package/dist/chains/router/multi_retrieval_qa.js +1 -1
- package/dist/chains/sql_db/sql_db_chain.d.ts +3 -3
- package/dist/chains/summarization/load.d.ts +4 -4
- package/dist/chains/vector_db_qa.d.ts +5 -5
- package/dist/document_loaders/fs/docx.cjs +1 -2
- package/dist/document_loaders/fs/docx.js +1 -2
- package/dist/embeddings/cache_backed.cjs +2 -2
- package/dist/embeddings/cache_backed.d.ts +4 -4
- package/dist/embeddings/cache_backed.js +1 -1
- package/dist/evaluation/agents/trajectory.d.ts +4 -4
- package/dist/evaluation/base.d.ts +4 -4
- package/dist/evaluation/comparison/pairwise.d.ts +4 -4
- package/dist/evaluation/criteria/criteria.d.ts +4 -4
- package/dist/evaluation/embedding_distance/base.d.ts +4 -4
- package/dist/evaluation/loader.d.ts +4 -4
- package/dist/evaluation/qa/eval_chain.d.ts +2 -2
- package/dist/experimental/autogpt/agent.d.ts +3 -3
- package/dist/experimental/autogpt/prompt.d.ts +2 -2
- package/dist/experimental/babyagi/agent.d.ts +5 -5
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.ts +4 -4
- package/dist/experimental/chat_models/anthropic_functions.d.ts +2 -2
- package/dist/experimental/generative_agents/generative_agent.d.ts +3 -3
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +5 -5
- package/dist/experimental/hubs/makersuite/googlemakersuitehub.d.ts +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.d.ts +4 -4
- package/dist/llms/load.cjs +2 -2
- package/dist/llms/load.d.ts +1 -1
- package/dist/llms/load.js +1 -1
- package/dist/memory/buffer_token_memory.d.ts +3 -3
- package/dist/memory/entity_memory.d.ts +3 -3
- package/dist/memory/summary.d.ts +3 -3
- package/dist/memory/vector_store.d.ts +3 -3
- package/dist/output_parsers/fix.d.ts +2 -2
- package/dist/retrievers/contextual_compression.cjs +2 -2
- package/dist/retrievers/contextual_compression.d.ts +5 -5
- package/dist/retrievers/contextual_compression.js +1 -1
- package/dist/retrievers/document_compressors/chain_extract.cjs +2 -2
- package/dist/retrievers/document_compressors/chain_extract.d.ts +6 -6
- package/dist/retrievers/document_compressors/chain_extract.js +1 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +5 -5
- package/dist/retrievers/document_compressors/index.d.ts +3 -3
- package/dist/retrievers/hyde.d.ts +3 -3
- package/dist/retrievers/multi_query.cjs +2 -2
- package/dist/retrievers/multi_query.d.ts +4 -4
- package/dist/retrievers/multi_query.js +1 -1
- package/dist/retrievers/multi_vector.cjs +2 -2
- package/dist/retrievers/multi_vector.d.ts +4 -4
- package/dist/retrievers/multi_vector.js +1 -1
- package/dist/retrievers/parent_document.d.ts +4 -4
- package/dist/retrievers/remote/base.cjs +2 -2
- package/dist/retrievers/remote/base.d.ts +1 -1
- package/dist/retrievers/remote/base.js +1 -1
- package/dist/retrievers/self_query/index.cjs +2 -2
- package/dist/retrievers/self_query/index.d.ts +1 -1
- package/dist/retrievers/self_query/index.js +1 -1
- package/dist/retrievers/time_weighted.cjs +2 -2
- package/dist/retrievers/time_weighted.d.ts +9 -9
- package/dist/retrievers/time_weighted.js +1 -1
- package/dist/schema/runnable/base.d.ts +1 -1
- package/dist/tools/convert_to_openai.d.ts +4 -4
- package/dist/tools/render.d.ts +3 -3
- package/dist/tools/sql.d.ts +2 -2
- package/dist/tools/vectorstore.d.ts +6 -6
- package/dist/tools/webbrowser.cjs +4 -4
- package/dist/tools/webbrowser.d.ts +4 -4
- package/dist/tools/webbrowser.js +1 -1
- package/dist/util/googlevertexai-connection.d.ts +1 -1
- package/dist/vectorstores/memory.d.ts +5 -5
- package/dist/vectorstores/mongo.d.ts +4 -4
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { ToolInterface } from "@langchain/core/tools";
|
|
2
3
|
import { Toolkit } from "../base.js";
|
|
3
|
-
import { BaseLanguageModel } from "../../../base_language/index.js";
|
|
4
4
|
import { ZeroShotCreatePromptArgs } from "../../mrkl/index.js";
|
|
5
5
|
import { AgentExecutor } from "../../executor.js";
|
|
6
6
|
import { SqlDatabase } from "../../../sql_db.js";
|
|
@@ -25,9 +25,9 @@ export interface SqlCreatePromptArgs extends ZeroShotCreatePromptArgs {
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export declare class SqlToolkit extends Toolkit {
|
|
28
|
-
tools:
|
|
28
|
+
tools: ToolInterface[];
|
|
29
29
|
db: SqlDatabase;
|
|
30
30
|
dialect: string;
|
|
31
|
-
constructor(db: SqlDatabase, llm?:
|
|
31
|
+
constructor(db: SqlDatabase, llm?: BaseLanguageModelInterface);
|
|
32
32
|
}
|
|
33
|
-
export declare function createSqlAgent(llm:
|
|
33
|
+
export declare function createSqlAgent(llm: BaseLanguageModelInterface, toolkit: SqlToolkit, args?: SqlCreatePromptArgs): AgentExecutor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { VectorStoreInterface } from "@langchain/core/vectorstores";
|
|
3
|
+
import { ToolInterface } from "@langchain/core/tools";
|
|
3
4
|
import { Toolkit } from "../base.js";
|
|
4
|
-
import { BaseLanguageModel } from "../../../base_language/index.js";
|
|
5
5
|
import { ZeroShotCreatePromptArgs } from "../../mrkl/index.js";
|
|
6
6
|
import { AgentExecutor } from "../../executor.js";
|
|
7
7
|
/**
|
|
@@ -9,7 +9,7 @@ import { AgentExecutor } from "../../executor.js";
|
|
|
9
9
|
* the vector store itself, its name, and description.
|
|
10
10
|
*/
|
|
11
11
|
export interface VectorStoreInfo {
|
|
12
|
-
vectorStore:
|
|
12
|
+
vectorStore: VectorStoreInterface;
|
|
13
13
|
name: string;
|
|
14
14
|
description: string;
|
|
15
15
|
}
|
|
@@ -35,9 +35,9 @@ export interface VectorStoreInfo {
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export declare class VectorStoreToolkit extends Toolkit {
|
|
38
|
-
tools:
|
|
39
|
-
llm:
|
|
40
|
-
constructor(vectorStoreInfo: VectorStoreInfo, llm:
|
|
38
|
+
tools: ToolInterface[];
|
|
39
|
+
llm: BaseLanguageModelInterface;
|
|
40
|
+
constructor(vectorStoreInfo: VectorStoreInfo, llm: BaseLanguageModelInterface);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Class representing a toolkit for working with multiple vector stores.
|
|
@@ -45,10 +45,10 @@ export declare class VectorStoreToolkit extends Toolkit {
|
|
|
45
45
|
* vector store information and language model.
|
|
46
46
|
*/
|
|
47
47
|
export declare class VectorStoreRouterToolkit extends Toolkit {
|
|
48
|
-
tools:
|
|
48
|
+
tools: ToolInterface[];
|
|
49
49
|
vectorStoreInfos: VectorStoreInfo[];
|
|
50
|
-
llm:
|
|
51
|
-
constructor(vectorStoreInfos: VectorStoreInfo[], llm:
|
|
50
|
+
llm: BaseLanguageModelInterface;
|
|
51
|
+
constructor(vectorStoreInfos: VectorStoreInfo[], llm: BaseLanguageModelInterface);
|
|
52
52
|
}
|
|
53
|
-
export declare function createVectorStoreAgent(llm:
|
|
54
|
-
export declare function createVectorStoreRouterAgent(llm:
|
|
53
|
+
export declare function createVectorStoreAgent(llm: BaseLanguageModelInterface, toolkit: VectorStoreToolkit, args?: ZeroShotCreatePromptArgs): AgentExecutor;
|
|
54
|
+
export declare function createVectorStoreRouterAgent(llm: BaseLanguageModelInterface, toolkit: VectorStoreRouterToolkit, args?: ZeroShotCreatePromptArgs): AgentExecutor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ToolInterface } from "@langchain/core/tools";
|
|
1
2
|
import { Toolkit } from "../base.js";
|
|
2
|
-
import { Tool } from "../../../tools/base.js";
|
|
3
3
|
import { ZapierNLAWrapper } from "../../../tools/zapier.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a toolkit for working with Zapier actions. It extends the
|
|
@@ -16,7 +16,7 @@ import { ZapierNLAWrapper } from "../../../tools/zapier.js";
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
export declare class ZapierToolKit extends Toolkit {
|
|
19
|
-
tools:
|
|
19
|
+
tools: ToolInterface[];
|
|
20
20
|
/**
|
|
21
21
|
* Creates a ZapierToolKit instance based on a ZapierNLAWrapper instance.
|
|
22
22
|
* It retrieves the list of available actions from the ZapierNLAWrapper
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { ToolInterface } from "@langchain/core/tools";
|
|
2
3
|
import { LLMChain } from "../../chains/llm_chain.js";
|
|
3
4
|
import { AgentStep, AgentAction, AgentFinish, ChainValues } from "../../schema/index.js";
|
|
4
5
|
import { ChatPromptTemplate } from "../../prompts/chat.js";
|
|
5
6
|
import { AgentArgs, BaseSingleActionAgent } from "../agent.js";
|
|
6
7
|
import { CallbackManager } from "../../callbacks/manager.js";
|
|
7
|
-
import { BaseLanguageModel } from "../../base_language/index.js";
|
|
8
8
|
import { XMLAgentOutputParser } from "./output_parser.js";
|
|
9
9
|
/**
|
|
10
10
|
* Interface for the input to the XMLAgent class.
|
|
11
11
|
*/
|
|
12
12
|
export interface XMLAgentInput {
|
|
13
|
-
tools:
|
|
13
|
+
tools: ToolInterface[];
|
|
14
14
|
llmChain: LLMChain;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export interface XMLAgentInput {
|
|
|
19
19
|
export declare class XMLAgent extends BaseSingleActionAgent implements XMLAgentInput {
|
|
20
20
|
static lc_name(): string;
|
|
21
21
|
lc_namespace: string[];
|
|
22
|
-
tools:
|
|
22
|
+
tools: ToolInterface[];
|
|
23
23
|
llmChain: LLMChain;
|
|
24
24
|
outputParser: XMLAgentOutputParser;
|
|
25
25
|
_agentType(): "xml";
|
|
@@ -42,5 +42,5 @@ export declare class XMLAgent extends BaseSingleActionAgent implements XMLAgentI
|
|
|
42
42
|
* @param args Optional arguments for creating the agent.
|
|
43
43
|
* @returns An instance of XMLAgent.
|
|
44
44
|
*/
|
|
45
|
-
static fromLLMAndTools(llm:
|
|
45
|
+
static fromLLMAndTools(llm: BaseLanguageModelInterface, tools: ToolInterface[], args?: XMLAgentInput & Pick<AgentArgs, "callbacks">): XMLAgent;
|
|
46
46
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { type SerializedLLM, type BaseLangChainParams, BaseLangChain, type BaseLanguageModelParams, type BaseLanguageModelCallOptions, type BaseFunctionCallOptions, type BaseLanguageModelInput, BaseLanguageModel, } from "@langchain/core/language_models/base";
|
|
1
|
+
export { type SerializedLLM, type BaseLangChainParams, BaseLangChain, type BaseLanguageModelParams, type BaseLanguageModelCallOptions, type BaseFunctionCallOptions, type BaseLanguageModelInput, type BaseLanguageModelInterface, BaseLanguageModel, } from "@langchain/core/language_models/base";
|
|
2
2
|
export { calculateMaxTokens, getModelContextSize } from "./count_tokens.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
1
2
|
import { BaseChain, ChainInputs } from "../base.js";
|
|
2
3
|
import { SerializedAPIChain } from "../serde.js";
|
|
3
4
|
import { LLMChain } from "../llm_chain.js";
|
|
4
|
-
import { BaseLanguageModel } from "../../base_language/index.js";
|
|
5
5
|
import { CallbackManagerForChainRun } from "../../callbacks/manager.js";
|
|
6
6
|
import { ChainValues } from "../../schema/index.js";
|
|
7
7
|
import { BasePromptTemplate } from "../../prompts/base.js";
|
|
@@ -53,5 +53,5 @@ export declare class APIChain extends BaseChain implements APIChainInput {
|
|
|
53
53
|
* @param options Optional configuration options for the APIChain.
|
|
54
54
|
* @returns New APIChain instance.
|
|
55
55
|
*/
|
|
56
|
-
static fromLLMAndAPIDocs(llm:
|
|
56
|
+
static fromLLMAndAPIDocs(llm: BaseLanguageModelInterface, apiDocs: string, options?: APIChainOptions & Omit<APIChainInput, "apiAnswerChain" | "apiRequestChain" | "apiDocs">): APIChain;
|
|
57
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { VectorStoreInterface } from "@langchain/core/vectorstores";
|
|
3
3
|
import { SerializedChatVectorDBQAChain } from "./serde.js";
|
|
4
4
|
import { ChainValues } from "../schema/index.js";
|
|
5
5
|
import { BaseChain, ChainInputs } from "./base.js";
|
|
@@ -10,7 +10,7 @@ export type LoadValues = Record<string, any>;
|
|
|
10
10
|
* Interface for the input parameters of the ChatVectorDBQAChain class.
|
|
11
11
|
*/
|
|
12
12
|
export interface ChatVectorDBQAChainInput extends ChainInputs {
|
|
13
|
-
vectorstore:
|
|
13
|
+
vectorstore: VectorStoreInterface;
|
|
14
14
|
combineDocumentsChain: BaseChain;
|
|
15
15
|
questionGeneratorChain: LLMChain;
|
|
16
16
|
returnSourceDocuments?: boolean;
|
|
@@ -26,7 +26,7 @@ export declare class ChatVectorDBQAChain extends BaseChain implements ChatVector
|
|
|
26
26
|
get inputKeys(): string[];
|
|
27
27
|
outputKey: string;
|
|
28
28
|
get outputKeys(): string[];
|
|
29
|
-
vectorstore:
|
|
29
|
+
vectorstore: VectorStoreInterface;
|
|
30
30
|
combineDocumentsChain: BaseChain;
|
|
31
31
|
questionGeneratorChain: LLMChain;
|
|
32
32
|
returnSourceDocuments: boolean;
|
|
@@ -44,7 +44,7 @@ export declare class ChatVectorDBQAChain extends BaseChain implements ChatVector
|
|
|
44
44
|
* @param options (Optional) Additional options for creating the ChatVectorDBQAChain instance.
|
|
45
45
|
* @returns New instance of ChatVectorDBQAChain.
|
|
46
46
|
*/
|
|
47
|
-
static fromLLM(llm:
|
|
47
|
+
static fromLLM(llm: BaseLanguageModelInterface, vectorstore: VectorStoreInterface, options?: {
|
|
48
48
|
inputKey?: string;
|
|
49
49
|
outputKey?: string;
|
|
50
50
|
k?: number;
|
|
@@ -100,7 +100,7 @@ export declare class RefineDocumentsChain extends BaseChain implements RefineDoc
|
|
|
100
100
|
initialResponseName: string;
|
|
101
101
|
refineLLMChain: LLMChain;
|
|
102
102
|
get defaultDocumentPrompt(): BasePromptTemplate;
|
|
103
|
-
documentPrompt: BasePromptTemplate<any, import("
|
|
103
|
+
documentPrompt: BasePromptTemplate<any, import("@langchain/core/prompt_values").BasePromptValueInterface, any>;
|
|
104
104
|
get inputKeys(): string[];
|
|
105
105
|
get outputKeys(): string[];
|
|
106
106
|
constructor(fields: RefineDocumentsChainInput);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
2
|
import { CallbackManagerForChainRun } from "../../callbacks/manager.js";
|
|
3
3
|
import { ChainValues } from "../../schema/index.js";
|
|
4
4
|
import { BaseChain, ChainInputs } from "../base.js";
|
|
@@ -63,7 +63,7 @@ export declare class ConstitutionalChain extends BaseChain implements Constituti
|
|
|
63
63
|
* @param options Options for the ConstitutionalChain.
|
|
64
64
|
* @returns New instance of ConstitutionalChain
|
|
65
65
|
*/
|
|
66
|
-
static fromLLM(llm:
|
|
66
|
+
static fromLLM(llm: BaseLanguageModelInterface, options: Omit<ConstitutionalChainInput, "critiqueChain" | "revisionChain"> & {
|
|
67
67
|
critiqueChain?: LLMChain;
|
|
68
68
|
revisionChain?: LLMChain;
|
|
69
69
|
}): ConstitutionalChain;
|
|
@@ -207,8 +207,8 @@ class ConversationalRetrievalQAChain extends base_js_1.BaseChain {
|
|
|
207
207
|
/**
|
|
208
208
|
* Static method to create a new ConversationalRetrievalQAChain from a
|
|
209
209
|
* BaseLanguageModel and a BaseRetriever.
|
|
210
|
-
* @param llm {@link
|
|
211
|
-
* @param retriever {@link
|
|
210
|
+
* @param llm {@link BaseLanguageModelInterface} instance used to generate a new question.
|
|
211
|
+
* @param retriever {@link BaseRetrieverInterface} instance used to retrieve relevant documents.
|
|
212
212
|
* @param options.returnSourceDocuments Whether to return source documents in the final output
|
|
213
213
|
* @param options.questionGeneratorChainOptions Options to initialize the standalone question generation chain used as the first internal step
|
|
214
214
|
* @param options.qaChainOptions {@link QAChainParams} used to initialize the QA chain used as the second internal step
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
|
|
2
3
|
import { SerializedChatVectorDBQAChain } from "./serde.js";
|
|
3
4
|
import { ChainValues, BaseMessage } from "../schema/index.js";
|
|
4
|
-
import { BaseRetriever } from "../schema/retriever.js";
|
|
5
5
|
import { BaseChain, ChainInputs } from "./base.js";
|
|
6
6
|
import { LLMChain } from "./llm_chain.js";
|
|
7
7
|
import { QAChainParams } from "./question_answering/load.js";
|
|
@@ -12,7 +12,7 @@ export type LoadValues = Record<string, any>;
|
|
|
12
12
|
* ConversationalRetrievalQAChain class.
|
|
13
13
|
*/
|
|
14
14
|
export interface ConversationalRetrievalQAChainInput extends ChainInputs {
|
|
15
|
-
retriever:
|
|
15
|
+
retriever: BaseRetrieverInterface;
|
|
16
16
|
combineDocumentsChain: BaseChain;
|
|
17
17
|
questionGeneratorChain: LLMChain;
|
|
18
18
|
returnSourceDocuments?: boolean;
|
|
@@ -59,7 +59,7 @@ export declare class ConversationalRetrievalQAChain extends BaseChain implements
|
|
|
59
59
|
chatHistoryKey: string;
|
|
60
60
|
get inputKeys(): string[];
|
|
61
61
|
get outputKeys(): string[];
|
|
62
|
-
retriever:
|
|
62
|
+
retriever: BaseRetrieverInterface;
|
|
63
63
|
combineDocumentsChain: BaseChain;
|
|
64
64
|
questionGeneratorChain: LLMChain;
|
|
65
65
|
returnSourceDocuments: boolean;
|
|
@@ -80,14 +80,14 @@ export declare class ConversationalRetrievalQAChain extends BaseChain implements
|
|
|
80
80
|
/**
|
|
81
81
|
* Static method to create a new ConversationalRetrievalQAChain from a
|
|
82
82
|
* BaseLanguageModel and a BaseRetriever.
|
|
83
|
-
* @param llm {@link
|
|
84
|
-
* @param retriever {@link
|
|
83
|
+
* @param llm {@link BaseLanguageModelInterface} instance used to generate a new question.
|
|
84
|
+
* @param retriever {@link BaseRetrieverInterface} instance used to retrieve relevant documents.
|
|
85
85
|
* @param options.returnSourceDocuments Whether to return source documents in the final output
|
|
86
86
|
* @param options.questionGeneratorChainOptions Options to initialize the standalone question generation chain used as the first internal step
|
|
87
87
|
* @param options.qaChainOptions {@link QAChainParams} used to initialize the QA chain used as the second internal step
|
|
88
88
|
* @returns A new instance of ConversationalRetrievalQAChain.
|
|
89
89
|
*/
|
|
90
|
-
static fromLLM(llm:
|
|
90
|
+
static fromLLM(llm: BaseLanguageModelInterface, retriever: BaseRetrieverInterface, options?: {
|
|
91
91
|
outputKey?: string;
|
|
92
92
|
returnSourceDocuments?: boolean;
|
|
93
93
|
/** @deprecated Pass in questionGeneratorChainOptions.template instead */
|
|
@@ -95,7 +95,7 @@ export declare class ConversationalRetrievalQAChain extends BaseChain implements
|
|
|
95
95
|
/** @deprecated Pass in qaChainOptions.prompt instead */
|
|
96
96
|
qaTemplate?: string;
|
|
97
97
|
questionGeneratorChainOptions?: {
|
|
98
|
-
llm?:
|
|
98
|
+
llm?: BaseLanguageModelInterface;
|
|
99
99
|
template?: string;
|
|
100
100
|
};
|
|
101
101
|
qaChainOptions?: QAChainParams;
|
|
@@ -204,8 +204,8 @@ export class ConversationalRetrievalQAChain extends BaseChain {
|
|
|
204
204
|
/**
|
|
205
205
|
* Static method to create a new ConversationalRetrievalQAChain from a
|
|
206
206
|
* BaseLanguageModel and a BaseRetriever.
|
|
207
|
-
* @param llm {@link
|
|
208
|
-
* @param retriever {@link
|
|
207
|
+
* @param llm {@link BaseLanguageModelInterface} instance used to generate a new question.
|
|
208
|
+
* @param retriever {@link BaseRetrieverInterface} instance used to retrieve relevant documents.
|
|
209
209
|
* @param options.returnSourceDocuments Whether to return source documents in the final output
|
|
210
210
|
* @param options.questionGeneratorChainOptions Options to initialize the standalone question generation chain used as the first internal step
|
|
211
211
|
* @param options.qaChainOptions {@link QAChainParams} used to initialize the QA chain used as the second internal step
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
1
2
|
import { LLMChain } from "../../chains/llm_chain.js";
|
|
2
3
|
import { ChainValues } from "../../schema/index.js";
|
|
3
4
|
import { BasePromptTemplate } from "../../prompts/base.js";
|
|
4
5
|
import { BaseChain, ChainInputs } from "../base.js";
|
|
5
|
-
import { BaseLanguageModel } from "../../base_language/index.js";
|
|
6
6
|
import { CallbackManagerForChainRun } from "../../callbacks/manager.js";
|
|
7
7
|
import { Neo4jGraph } from "../../graphs/neo4j_graph.js";
|
|
8
8
|
export declare const INTERMEDIATE_STEPS_KEY = "intermediateSteps";
|
|
@@ -18,9 +18,9 @@ export interface GraphCypherQAChainInput extends ChainInputs {
|
|
|
18
18
|
}
|
|
19
19
|
export interface FromLLMInput {
|
|
20
20
|
graph: Neo4jGraph;
|
|
21
|
-
llm?:
|
|
22
|
-
cypherLLM?:
|
|
23
|
-
qaLLM?:
|
|
21
|
+
llm?: BaseLanguageModelInterface;
|
|
22
|
+
cypherLLM?: BaseLanguageModelInterface;
|
|
23
|
+
qaLLM?: BaseLanguageModelInterface;
|
|
24
24
|
qaPrompt?: BasePromptTemplate;
|
|
25
25
|
cypherPrompt?: BasePromptTemplate;
|
|
26
26
|
returnIntermediateSteps?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LLMChain = void 0;
|
|
4
|
+
const base_1 = require("@langchain/core/language_models/base");
|
|
4
5
|
const base_js_1 = require("./base.cjs");
|
|
5
6
|
const base_js_2 = require("../prompts/base.cjs");
|
|
6
|
-
const index_js_1 = require("../base_language/index.cjs");
|
|
7
7
|
const noop_js_1 = require("../output_parsers/noop.cjs");
|
|
8
8
|
const base_js_3 = require("../schema/runnable/base.cjs");
|
|
9
9
|
function isBaseLanguageModel(llmLike) {
|
|
@@ -195,7 +195,7 @@ class LLMChain extends base_js_1.BaseChain {
|
|
|
195
195
|
throw new Error("LLMChain must have prompt");
|
|
196
196
|
}
|
|
197
197
|
return new LLMChain({
|
|
198
|
-
llm: await
|
|
198
|
+
llm: await base_1.BaseLanguageModel.deserialize(llm),
|
|
199
199
|
prompt: await base_js_2.BasePromptTemplate.deserialize(prompt),
|
|
200
200
|
});
|
|
201
201
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { BaseLanguageModel, BaseLanguageModelInterface, BaseLanguageModelInput } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { ChainValues } from "@langchain/core/utils/types";
|
|
3
|
+
import type { Generation } from "@langchain/core/outputs";
|
|
4
|
+
import type { BaseMessage } from "@langchain/core/messages";
|
|
5
|
+
import type { BasePromptValueInterface } from "@langchain/core/prompt_values";
|
|
1
6
|
import { BaseChain, ChainInputs } from "./base.js";
|
|
2
7
|
import { BasePromptTemplate } from "../prompts/base.js";
|
|
3
|
-
import { BaseLanguageModel, BaseLanguageModelInput } from "../base_language/index.js";
|
|
4
|
-
import { ChainValues, Generation, BasePromptValue, BaseMessage } from "../schema/index.js";
|
|
5
8
|
import { BaseLLMOutputParser } from "../schema/output_parser.js";
|
|
6
9
|
import { SerializedLLMChain } from "./serde.js";
|
|
7
10
|
import { CallbackManager } from "../callbacks/index.js";
|
|
8
11
|
import { BaseCallbackConfig, CallbackManagerForChainRun, Callbacks } from "../callbacks/manager.js";
|
|
9
12
|
import { Runnable } from "../schema/runnable/base.js";
|
|
10
|
-
type LLMType =
|
|
13
|
+
type LLMType = BaseLanguageModelInterface | Runnable<BaseLanguageModelInput, string> | Runnable<BaseLanguageModelInput, BaseMessage>;
|
|
11
14
|
type CallOptionsIfAvailable<T> = T extends {
|
|
12
15
|
CallOptions: infer CO;
|
|
13
16
|
} ? CO : any;
|
|
@@ -54,7 +57,7 @@ export declare class LLMChain<T extends string | object = string, Model extends
|
|
|
54
57
|
/** @ignore */
|
|
55
58
|
_selectMemoryInputs(values: ChainValues): ChainValues;
|
|
56
59
|
/** @ignore */
|
|
57
|
-
_getFinalOutput(generations: Generation[], promptValue:
|
|
60
|
+
_getFinalOutput(generations: Generation[], promptValue: BasePromptValueInterface, runManager?: CallbackManagerForChainRun): Promise<unknown>;
|
|
58
61
|
/**
|
|
59
62
|
* Run the core logic of this chain and add to output if desired.
|
|
60
63
|
*
|
|
@@ -77,7 +80,7 @@ export declare class LLMChain<T extends string | object = string, Model extends
|
|
|
77
80
|
*/
|
|
78
81
|
predict(values: ChainValues & CallOptionsIfAvailable<Model>, callbackManager?: CallbackManager): Promise<T>;
|
|
79
82
|
_chainType(): "llm";
|
|
80
|
-
static deserialize(data: SerializedLLMChain): Promise<LLMChain<string, BaseLanguageModel<any, import("
|
|
83
|
+
static deserialize(data: SerializedLLMChain): Promise<LLMChain<string, BaseLanguageModel<any, import("@langchain/core/language_models/base").BaseLanguageModelCallOptions>>>;
|
|
81
84
|
/** @deprecated */
|
|
82
85
|
serialize(): SerializedLLMChain;
|
|
83
86
|
_getNumTokens(text: string): Promise<number>;
|
package/dist/chains/llm_chain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { BaseLanguageModel, } from "@langchain/core/language_models/base";
|
|
1
2
|
import { BaseChain } from "./base.js";
|
|
2
3
|
import { BasePromptTemplate } from "../prompts/base.js";
|
|
3
|
-
import { BaseLanguageModel, } from "../base_language/index.js";
|
|
4
4
|
import { NoOpOutputParser } from "../output_parsers/noop.js";
|
|
5
5
|
import { Runnable } from "../schema/runnable/base.js";
|
|
6
6
|
function isBaseLanguageModel(llmLike) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { QueryTransformer, TraverseType } from "./parser.js";
|
|
3
4
|
import { Comparator, Operator, StructuredQuery } from "./ir.js";
|
|
4
5
|
import { InputValues } from "../../schema/index.js";
|
|
5
6
|
import { DEFAULT_EXAMPLES, DEFAULT_PREFIX, DEFAULT_SCHEMA, DEFAULT_SUFFIX, EXAMPLE_PROMPT } from "./prompt.js";
|
|
6
7
|
import { LLMChain } from "../llm_chain.js";
|
|
7
|
-
import { BaseLanguageModel } from "../../base_language/index.js";
|
|
8
8
|
import { AsymmetricStructuredOutputParser } from "../../output_parsers/structured.js";
|
|
9
9
|
import { AttributeInfo } from "../../schema/query_constructor.js";
|
|
10
10
|
export { QueryTransformer, type TraverseType };
|
|
@@ -51,11 +51,11 @@ export declare function formatAttributeInfo(info: AttributeInfo[]): string;
|
|
|
51
51
|
* A type that represents options for the query constructor chain.
|
|
52
52
|
*/
|
|
53
53
|
export type QueryConstructorChainOptions = {
|
|
54
|
-
llm:
|
|
54
|
+
llm: BaseLanguageModelInterface;
|
|
55
55
|
documentContents: string;
|
|
56
56
|
attributeInfo: AttributeInfo[];
|
|
57
57
|
examples?: InputValues[];
|
|
58
58
|
allowedComparators?: Comparator[];
|
|
59
59
|
allowedOperators?: Operator[];
|
|
60
60
|
};
|
|
61
|
-
export declare function loadQueryConstructorChain(opts: QueryConstructorChainOptions): LLMChain<string,
|
|
61
|
+
export declare function loadQueryConstructorChain(opts: QueryConstructorChainOptions): LLMChain<string, BaseLanguageModelInterface<any, import("@langchain/core/language_models/base").BaseLanguageModelCallOptions>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
1
2
|
import { BasePromptTemplate } from "../../prompts/base.js";
|
|
2
3
|
import { StuffDocumentsChain, MapReduceDocumentsChain, RefineDocumentsChain, MapReduceDocumentsChainInput } from "../combine_docs_chain.js";
|
|
3
|
-
import { BaseLanguageModel } from "../../base_language/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents the parameters for creating a QAChain. It can be of three
|
|
6
6
|
* types: "stuff", "map_reduce", or "refine".
|
|
@@ -12,7 +12,7 @@ export type QAChainParams = ({
|
|
|
12
12
|
} & MapReduceQAChainParams) | ({
|
|
13
13
|
type?: "refine";
|
|
14
14
|
} & RefineQAChainParams);
|
|
15
|
-
export declare const loadQAChain: (llm:
|
|
15
|
+
export declare const loadQAChain: (llm: BaseLanguageModelInterface, params?: QAChainParams) => StuffDocumentsChain | MapReduceDocumentsChain | RefineDocumentsChain;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the parameters for creating a StuffQAChain.
|
|
18
18
|
*/
|
|
@@ -27,7 +27,7 @@ export interface StuffQAChainParams {
|
|
|
27
27
|
* @param params Parameters for creating a StuffQAChain.
|
|
28
28
|
* @returns A StuffQAChain instance.
|
|
29
29
|
*/
|
|
30
|
-
export declare function loadQAStuffChain(llm:
|
|
30
|
+
export declare function loadQAStuffChain(llm: BaseLanguageModelInterface, params?: StuffQAChainParams): StuffDocumentsChain;
|
|
31
31
|
/**
|
|
32
32
|
* Represents the parameters for creating a MapReduceQAChain.
|
|
33
33
|
*/
|
|
@@ -35,7 +35,7 @@ export interface MapReduceQAChainParams {
|
|
|
35
35
|
returnIntermediateSteps?: MapReduceDocumentsChainInput["returnIntermediateSteps"];
|
|
36
36
|
combineMapPrompt?: BasePromptTemplate;
|
|
37
37
|
combinePrompt?: BasePromptTemplate;
|
|
38
|
-
combineLLM?:
|
|
38
|
+
combineLLM?: BaseLanguageModelInterface;
|
|
39
39
|
verbose?: boolean;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -45,14 +45,14 @@ export interface MapReduceQAChainParams {
|
|
|
45
45
|
* @param params Parameters for creating a MapReduceQAChain.
|
|
46
46
|
* @returns A MapReduceQAChain instance.
|
|
47
47
|
*/
|
|
48
|
-
export declare function loadQAMapReduceChain(llm:
|
|
48
|
+
export declare function loadQAMapReduceChain(llm: BaseLanguageModelInterface, params?: MapReduceQAChainParams): MapReduceDocumentsChain;
|
|
49
49
|
/**
|
|
50
50
|
* Represents the parameters for creating a RefineQAChain.
|
|
51
51
|
*/
|
|
52
52
|
export interface RefineQAChainParams {
|
|
53
53
|
questionPrompt?: BasePromptTemplate;
|
|
54
54
|
refinePrompt?: BasePromptTemplate;
|
|
55
|
-
refineLLM?:
|
|
55
|
+
refineLLM?: BaseLanguageModelInterface;
|
|
56
56
|
verbose?: boolean;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -62,4 +62,4 @@ export interface RefineQAChainParams {
|
|
|
62
62
|
* @param params Parameters for creating a RefineQAChain.
|
|
63
63
|
* @returns A RefineQAChain instance.
|
|
64
64
|
*/
|
|
65
|
-
export declare function loadQARefineChain(llm:
|
|
65
|
+
export declare function loadQARefineChain(llm: BaseLanguageModelInterface, params?: RefineQAChainParams): RefineDocumentsChain;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
|
|
1
3
|
import { BaseChain, ChainInputs } from "./base.js";
|
|
2
|
-
import { BaseLanguageModel } from "../base_language/index.js";
|
|
3
4
|
import { SerializedVectorDBQAChain } from "./serde.js";
|
|
4
5
|
import { ChainValues } from "../schema/index.js";
|
|
5
|
-
import { BaseRetriever } from "../schema/retriever.js";
|
|
6
6
|
import { StuffQAChainParams } from "./question_answering/load.js";
|
|
7
7
|
import { CallbackManagerForChainRun } from "../callbacks/manager.js";
|
|
8
8
|
export type LoadValues = Record<string, any>;
|
|
@@ -10,7 +10,7 @@ export type LoadValues = Record<string, any>;
|
|
|
10
10
|
* Interface for the input parameters of the RetrievalQAChain class.
|
|
11
11
|
*/
|
|
12
12
|
export interface RetrievalQAChainInput extends Omit<ChainInputs, "memory"> {
|
|
13
|
-
retriever:
|
|
13
|
+
retriever: BaseRetrieverInterface;
|
|
14
14
|
combineDocumentsChain: BaseChain;
|
|
15
15
|
inputKey?: string;
|
|
16
16
|
returnSourceDocuments?: boolean;
|
|
@@ -45,7 +45,7 @@ export declare class RetrievalQAChain extends BaseChain implements RetrievalQACh
|
|
|
45
45
|
inputKey: string;
|
|
46
46
|
get inputKeys(): string[];
|
|
47
47
|
get outputKeys(): string[];
|
|
48
|
-
retriever:
|
|
48
|
+
retriever: BaseRetrieverInterface;
|
|
49
49
|
combineDocumentsChain: BaseChain;
|
|
50
50
|
returnSourceDocuments: boolean;
|
|
51
51
|
constructor(fields: RetrievalQAChainInput);
|
|
@@ -62,5 +62,5 @@ export declare class RetrievalQAChain extends BaseChain implements RetrievalQACh
|
|
|
62
62
|
* @param options Optional parameters for the RetrievalQAChain.
|
|
63
63
|
* @returns A new instance of RetrievalQAChain.
|
|
64
64
|
*/
|
|
65
|
-
static fromLLM(llm:
|
|
65
|
+
static fromLLM(llm: BaseLanguageModelInterface, retriever: BaseRetrieverInterface, options?: Partial<Omit<RetrievalQAChainInput, "retriever" | "combineDocumentsChain" | "index">> & StuffQAChainParams): RetrievalQAChain;
|
|
66
66
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
1
2
|
import { BasePromptTemplate } from "../../prompts/base.js";
|
|
2
3
|
import { LLMChain } from "../../chains/llm_chain.js";
|
|
3
4
|
import { RouterChain } from "./multi_route.js";
|
|
4
5
|
import { CallbackManagerForChainRun } from "../../callbacks/manager.js";
|
|
5
6
|
import { ChainValues } from "../../schema/index.js";
|
|
6
|
-
import { BaseLanguageModel } from "../../base_language/index.js";
|
|
7
7
|
import { ChainInputs } from "../../chains/base.js";
|
|
8
8
|
/**
|
|
9
9
|
* A type that represents the output schema of a router chain. It defines
|
|
@@ -44,5 +44,5 @@ export declare class LLMRouterChain extends RouterChain implements LLMRouterChai
|
|
|
44
44
|
* @param options Optional LLMRouterChainInput object, excluding "llmChain".
|
|
45
45
|
* @returns An instance of LLMRouterChain.
|
|
46
46
|
*/
|
|
47
|
-
static fromLLM(llm:
|
|
47
|
+
static fromLLM(llm: BaseLanguageModelInterface, prompt: BasePromptTemplate, options?: Omit<LLMRouterChainInput, "llmChain">): LLMRouterChain;
|
|
48
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
2
|
import { MultiRouteChain, MultiRouteChainInput } from "./multi_route.js";
|
|
3
3
|
import { BaseChain } from "../../chains/base.js";
|
|
4
4
|
import { LLMChainInput } from "../../chains/llm_chain.js";
|
|
@@ -31,7 +31,7 @@ export declare class MultiPromptChain extends MultiRouteChain {
|
|
|
31
31
|
/**
|
|
32
32
|
* @deprecated Use `fromLLMAndPrompts` instead
|
|
33
33
|
*/
|
|
34
|
-
static fromPrompts(llm:
|
|
34
|
+
static fromPrompts(llm: BaseLanguageModelInterface, promptNames: string[], promptDescriptions: string[], promptTemplates: string[] | PromptTemplate[], defaultChain?: BaseChain, options?: Omit<MultiRouteChainInput, "defaultChain">): MultiPromptChain;
|
|
35
35
|
/**
|
|
36
36
|
* A static method that creates an instance of MultiPromptChain from a
|
|
37
37
|
* BaseLanguageModel and a set of prompts. It takes in optional parameters
|
|
@@ -46,7 +46,7 @@ export declare class MultiPromptChain extends MultiRouteChain {
|
|
|
46
46
|
* @param multiRouteChainOpts Optional parameters for the MultiRouteChainInput, excluding 'defaultChain'.
|
|
47
47
|
* @returns An instance of MultiPromptChain.
|
|
48
48
|
*/
|
|
49
|
-
static fromLLMAndPrompts(llm:
|
|
49
|
+
static fromLLMAndPrompts(llm: BaseLanguageModelInterface, { promptNames, promptDescriptions, promptTemplates, defaultChain, llmChainOpts, conversationChainOpts, multiRouteChainOpts, }: {
|
|
50
50
|
promptNames: string[];
|
|
51
51
|
promptDescriptions: string[];
|
|
52
52
|
promptTemplates: string[] | PromptTemplate[];
|
|
@@ -72,7 +72,7 @@ class MultiRetrievalQAChain extends multi_route_js_1.MultiRouteChain {
|
|
|
72
72
|
* @param llm A BaseLanguageModel instance.
|
|
73
73
|
* @param retrieverNames An array of retriever names.
|
|
74
74
|
* @param retrieverDescriptions An array of retriever descriptions.
|
|
75
|
-
* @param retrievers An array of
|
|
75
|
+
* @param retrievers An array of BaseRetrieverInterface instances.
|
|
76
76
|
* @param retrieverPrompts An optional array of PromptTemplate instances for the retrievers.
|
|
77
77
|
* @param defaults An optional MultiRetrievalDefaults instance.
|
|
78
78
|
* @param multiRetrievalChainOpts Additional optional parameters for the multi-retrieval chain.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
2
|
+
import type { BaseRetrieverInterface } from "@langchain/core/retrievers";
|
|
2
3
|
import { MultiRouteChain, MultiRouteChainInput } from "./multi_route.js";
|
|
3
4
|
import { BaseChain } from "../../chains/base.js";
|
|
4
5
|
import { PromptTemplate } from "../../prompts/prompt.js";
|
|
5
|
-
import { BaseRetriever } from "../../schema/retriever.js";
|
|
6
6
|
import { RetrievalQAChainInput } from "../../chains/retrieval_qa.js";
|
|
7
7
|
/**
|
|
8
8
|
* A type that represents the default values for the MultiRetrievalQAChain
|
|
@@ -10,7 +10,7 @@ import { RetrievalQAChainInput } from "../../chains/retrieval_qa.js";
|
|
|
10
10
|
* default prompt, and default chain.
|
|
11
11
|
*/
|
|
12
12
|
export type MultiRetrievalDefaults = {
|
|
13
|
-
defaultRetriever?:
|
|
13
|
+
defaultRetriever?: BaseRetrieverInterface;
|
|
14
14
|
defaultPrompt?: PromptTemplate;
|
|
15
15
|
defaultChain?: BaseChain;
|
|
16
16
|
};
|
|
@@ -54,7 +54,7 @@ export declare class MultiRetrievalQAChain extends MultiRouteChain {
|
|
|
54
54
|
/**
|
|
55
55
|
* @deprecated Use `fromRetrieversAndPrompts` instead
|
|
56
56
|
*/
|
|
57
|
-
static fromRetrievers(llm:
|
|
57
|
+
static fromRetrievers(llm: BaseLanguageModelInterface, retrieverNames: string[], retrieverDescriptions: string[], retrievers: BaseRetrieverInterface[], retrieverPrompts?: PromptTemplate[], defaults?: MultiRetrievalDefaults, options?: Omit<MultiRouteChainInput, "defaultChain">): MultiRetrievalQAChain;
|
|
58
58
|
/**
|
|
59
59
|
* A static method that creates an instance of MultiRetrievalQAChain from
|
|
60
60
|
* a BaseLanguageModel and a set of retrievers. It takes in optional
|
|
@@ -64,17 +64,17 @@ export declare class MultiRetrievalQAChain extends MultiRouteChain {
|
|
|
64
64
|
* @param llm A BaseLanguageModel instance.
|
|
65
65
|
* @param retrieverNames An array of retriever names.
|
|
66
66
|
* @param retrieverDescriptions An array of retriever descriptions.
|
|
67
|
-
* @param retrievers An array of
|
|
67
|
+
* @param retrievers An array of BaseRetrieverInterface instances.
|
|
68
68
|
* @param retrieverPrompts An optional array of PromptTemplate instances for the retrievers.
|
|
69
69
|
* @param defaults An optional MultiRetrievalDefaults instance.
|
|
70
70
|
* @param multiRetrievalChainOpts Additional optional parameters for the multi-retrieval chain.
|
|
71
71
|
* @param retrievalQAChainOpts Additional optional parameters for the retrieval QA chain.
|
|
72
72
|
* @returns A new instance of MultiRetrievalQAChain.
|
|
73
73
|
*/
|
|
74
|
-
static fromLLMAndRetrievers(llm:
|
|
74
|
+
static fromLLMAndRetrievers(llm: BaseLanguageModelInterface, { retrieverNames, retrieverDescriptions, retrievers, retrieverPrompts, defaults, multiRetrievalChainOpts, retrievalQAChainOpts, }: {
|
|
75
75
|
retrieverNames: string[];
|
|
76
76
|
retrieverDescriptions: string[];
|
|
77
|
-
retrievers:
|
|
77
|
+
retrievers: BaseRetrieverInterface[];
|
|
78
78
|
retrieverPrompts?: PromptTemplate[];
|
|
79
79
|
defaults?: MultiRetrievalDefaults;
|
|
80
80
|
multiRetrievalChainOpts?: Omit<MultiRouteChainInput, "defaultChain">;
|
|
@@ -69,7 +69,7 @@ export class MultiRetrievalQAChain extends MultiRouteChain {
|
|
|
69
69
|
* @param llm A BaseLanguageModel instance.
|
|
70
70
|
* @param retrieverNames An array of retriever names.
|
|
71
71
|
* @param retrieverDescriptions An array of retriever descriptions.
|
|
72
|
-
* @param retrievers An array of
|
|
72
|
+
* @param retrievers An array of BaseRetrieverInterface instances.
|
|
73
73
|
* @param retrieverPrompts An optional array of PromptTemplate instances for the retrievers.
|
|
74
74
|
* @param defaults An optional MultiRetrievalDefaults instance.
|
|
75
75
|
* @param multiRetrievalChainOpts Additional optional parameters for the multi-retrieval chain.
|