use gpt-4o again, responses are considerably better.

This commit is contained in:
Dhravya 2024-06-24 22:11:05 -05:00
parent 672a0fec00
commit dcf5cffdf0
3 changed files with 9 additions and 10 deletions

View file

@ -188,18 +188,13 @@ app.post(
const { store, model } = await initQuery(c);
// we're creating another instance of the model here because we want to use a cheaper model for this.
const openai = createOpenAI({
apiKey: c.env.OPENAI_API_KEY,
});
let task: "add" | "chat" = "chat";
let thingToAdd: "page" | "image" | "text" | undefined = undefined;
let addContent: string | undefined = undefined;
// This is a "router". this finds out if the user wants to add a document, or chat with the AI to get a response.
const routerQuery = await generateText({
model: openai.chat("gpt-3.5-turbo"),
model: model,
system: `You are Supermemory chatbot. You can either add a document to the supermemory database, or return a chat response. Based on this query,
You must determine what to do. Basically if it feels like a "question", then you should intiate a chat. If it feels like a "command" or feels like something that could be forwarded to the AI, then you should add a document.
You must also extract the "thing" to add and what type of thing it is.`,

View file

@ -107,3 +107,7 @@ bot.on("message", async (ctx) => {
});
export const POST = webhookCallback(bot, "std/http");
export const GET = async () => {
return new Response("OK", { status: 200 });
};

View file

@ -14,8 +14,8 @@ bucket_name = "dev-r2-anycontext"
[[d1_databases]]
binding = "DATABASE"
# database_name = "prod-d1-supermemory"
# database_id = "f527a727-c472-41d4-8eaf-3d7ba0f2f395"
database_name = "prod-d1-supermemory"
database_id = "f527a727-c472-41d4-8eaf-3d7ba0f2f395"
database_name = "dev-d1-anycontext"
database_id = "fc562605-157a-4f60-b439-2a24ffed5b4c"
# database_name = "dev-d1-anycontext"
# database_id = "fc562605-157a-4f60-b439-2a24ffed5b4c"