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

reader and queryengine update

parent a4265e2b
No related branches found
No related tags found
No related merge requests found
{
"name": "simple"
}
import { Response } from "./Response"; import { Response } from "./Response";
export class BaseQueryEngine { export class BaseQueryEngine {
query(q: string): Response { async aquery(q: string): Promise<Response> {
return new Response(); return new Response();
} }
aquery(q: string): Promise<Response> {
return new Promise<Response>((resolve, reject) => {
resolve(new Response());
});
}
} }
import { Document } from "./Document";
export interface BaseReader {
loadData(...args: any[]): Promise<Document>;
}
export class SimpleDirectoryReader implements BaseReader {
async loadData(options) {
return new Document("1", "");
}
}
export class PDFReader implements BaseReader {
async loadData(options) {
return new Document("1", "");
}
}
interface ServiceContext { interface ServiceContext {
llmPredictor?: any; llmPredictor?: any;
promptHelper: any; // promptHelper: any;
embedModel: any; embedModel: any;
nodeParser: any; nodeParser: any;
// llamaLogger: any; // llamaLogger: any;
......
...@@ -33,9 +33,14 @@ interface FunctionMessage { ...@@ -33,9 +33,14 @@ interface FunctionMessage {
export type Message = ChatMessage | FunctionMessage; export type Message = ChatMessage | FunctionMessage;
interface Function {
name: string;
}
export const getChatCompletions = async ( export const getChatCompletions = async (
messages: Message[], messages: Message[],
model = "gpt-3.5-turbo" model = "gpt-3.5-turbo",
functions: Function[] | null = null
) => { ) => {
return await fetch(OPENAI_CHAT_COMPLETIONS_URL, { return await fetch(OPENAI_CHAT_COMPLETIONS_URL, {
method: "POST", method: "POST",
......
{
"name": "core"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment