From 737928e861552097884a1bf340865a3a8588a0cc Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 9 Jan 2024 23:06:33 -0800 Subject: [PATCH] feat: better prompt gen template --- src/lib/apis/ollama/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/apis/ollama/index.ts b/src/lib/apis/ollama/index.ts index 4dbcd70de..653866067 100644 --- a/src/lib/apis/ollama/index.ts +++ b/src/lib/apis/ollama/index.ts @@ -171,7 +171,7 @@ export const generatePrompt = async (token: string = '', model: string, conversa let error = null; if (conversation === '') { - conversation = '[You need to start the conversation]'; + conversation = '[no existing conversation]'; } const res = await fetch(`${OLLAMA_API_BASE_URL}/generate`, { @@ -182,12 +182,11 @@ export const generatePrompt = async (token: string = '', model: string, conversa }, body: JSON.stringify({ model: model, - prompt: `Based on the following conversation, you are playing the role of 'USER.' Your task is to provide a thoughtful and appropriate response to the last message in the conversation, taking into account the context and tone of the discussion. - - Conversation: + prompt: `Conversation: ${conversation} - As USER, how would you respond to the latest message? If no previous conversation is provided, start a new conversation with a common, friendly greeting or a relevant question. If there is an existing conversation, continue it by providing a thoughtful, relevant, and engaging response. + As USER in the conversation above, your task is to continue the conversation. Remember, Your responses should be crafted as if you're a human conversing in a natural, realistic manner, keeping in mind the context and flow of the dialogue. Please generate a fitting response to the last message in the conversation, or if there is no existing conversation, initiate one as a normal person would. + Response: ` })