add multi retrieval qa chain

This commit is contained in:
Henry
2023-05-25 13:50:11 +01:00
parent 2802ee0142
commit 769b4ea567
7 changed files with 1023 additions and 1 deletions
+19
View File
@@ -95,6 +95,7 @@ export interface IMessage {
*/
import { PromptTemplate as LangchainPromptTemplate, PromptTemplateInput } from 'langchain/prompts'
import { VectorStore } from 'langchain/vectorstores/base'
export class PromptTemplate extends LangchainPromptTemplate {
promptValues: ICommonObject
@@ -124,3 +125,21 @@ export class PromptRetriever {
this.systemMessage = `${fields.systemMessage}\n${fixedTemplate}`
}
}
export interface VectorStoreRetrieverInput {
name: string
description: string
vectorStore: VectorStore
}
export class VectorStoreRetriever {
name: string
description: string
vectorStore: VectorStore
constructor(fields: VectorStoreRetrieverInput) {
this.name = fields.name
this.description = fields.description
this.vectorStore = fields.vectorStore
}
}