Skip to content

Commit

Permalink
Use a better model for specific people (#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin authored Dec 23, 2024
2 parents e8c4a86 + 1d49a3f commit 5042cce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion personas-open-source/src/app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export async function POST(req: Request) {
const { message, botId, conversationHistory } = await req.json();

var chatPrompt;
var isInfluencer = false;

if (!botId) return NextResponse.json({ message: "Bad param" }, { status: 400 });

Expand All @@ -26,6 +27,7 @@ export async function POST(req: Request) {
if (botDoc.exists()) {
const bot = botDoc.data();
chatPrompt = bot.chat_prompt;
isInfluencer = bot.is_influencer ?? false;
}
} catch (error) {
console.error('Error fetching bot data:', error);
Expand Down Expand Up @@ -54,8 +56,15 @@ export async function POST(req: Request) {

console.log('Formatted messages:', formattedMessages);


// LLM model, use a better model for specific people
var llmModel = "google/gemini-flash-1.5-8b";
if (isInfluencer) {
llmModel = "anthropic/claude-3.5-sonnet";
}

const stream = await openai.chat.completions.create({
model: "google/gemini-flash-1.5-8b",
model: llmModel,
messages: formattedMessages,
stream: true,
temperature: 0.8,
Expand Down

0 comments on commit 5042cce

Please sign in to comment.