Skip to content
Snippets Groups Projects
Commit 29d04217 authored by Yi Ding's avatar Yi Ding
Browse files

initial work

parent bbf936e9
No related branches found
No related tags found
No related merge requests found
import {
BaseQuestionGenerator,
LLMQuestionGenerator,
} from "./QuestionGenerator";
import { Response } from "./Response";
import { ResponseSynthesizer } from "./ResponseSynthesizer";
import { BaseRetriever } from "./Retriever";
......@@ -6,7 +10,7 @@ export interface BaseQueryEngine {
aquery(query: string): Promise<Response>;
}
export class RetrieverQueryEngine {
export class RetrieverQueryEngine implements BaseQueryEngine {
retriever: BaseRetriever;
responseSynthesizer: ResponseSynthesizer;
......@@ -20,3 +24,19 @@ export class RetrieverQueryEngine {
return this.responseSynthesizer.asynthesize(query, nodes);
}
}
export class SubQuestionQueryEngine implements BaseQueryEngine {
responseSynthesizer: ResponseSynthesizer;
questionGenerator: BaseQuestionGenerator;
constructor(init?: Partial<SubQuestionQueryEngine>) {
this.responseSynthesizer =
init?.responseSynthesizer ?? new ResponseSynthesizer();
this.questionGenerator =
init?.questionGenerator ?? new LLMQuestionGenerator();
}
aquery(query: string): Promise<Response> {
throw new Error("Method not implemented.");
}
}
import { BaseLLMPredictor } from "./LLMPredictor";
import { SimplePrompt } from "./Prompt";
import { ToolMetadata } from "./Tool";
export interface BaseQuestionGenerator {
agenerate(tools: ToolMetadata[], query: string): Promise<SubQuestion[]>;
}
export class LLMQuestionGenerator implements BaseQuestionGenerator {
llmPredictor: BaseLLMPredictor;
prompt: SimplePrompt;
constructor(init?: Partial<LLMQuestionGenerator>) {
this.llmPredictor = init?.llmPredictor ?? new BaseLLMPredictor();
this.prompt = init?.prompt ?? new SimplePrompt();
}
async agenerate(
tools: ToolMetadata[],
query: string
): Promise<SubQuestion[]> {
throw new Error("Method not implemented.");
}
}
interface SubQuestion {
subQuestion: string;
toolName: string;
}
export interface ToolMetadata {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment