mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
feat(FunctionsAgent): improve LLM instructions for more reliable results
This commit is contained in:
parent
9f930ecf7d
commit
7053d76f48
3 changed files with 10 additions and 5 deletions
|
|
@ -837,8 +837,13 @@ Only respond with your conversational reply to the following User Message:
|
|||
return [instructionsPayload, messagePayload];
|
||||
}
|
||||
|
||||
const result = [messagePayload, instructionsPayload];
|
||||
|
||||
if (this.functionsAgent && !this.isGpt3 && !completionMode) {
|
||||
result[1].content = `${result[1].content}\nSure thing! Here is the output you requested:\n`;
|
||||
}
|
||||
|
||||
if (isChatGptModel) {
|
||||
const result = [messagePayload, instructionsPayload];
|
||||
return result.filter((message) => message.content.length > 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ const {
|
|||
SystemMessagePromptTemplate,
|
||||
HumanMessagePromptTemplate
|
||||
} = require('langchain/prompts');
|
||||
const PREFIX = `You are a helpful AI assistant. Objective: Understand the human's query with available functions.
|
||||
The user is expecting a function response to the query; if only part of the query involves a function, prioritize the function response.`;
|
||||
const PREFIX = `You are a helpful AI assistant. Objective: Resolve the user's query with provided functions.
|
||||
The user is demanding a function response to the query; if any part of the query requires a function, respond with the function call first since you won't get to later`;
|
||||
|
||||
function parseOutput(message) {
|
||||
if (message.additional_kwargs.function_call) {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ Guidelines:
|
|||
"negative_prompt":"semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, out of frame, low quality, ugly, mutation, deformed"
|
||||
- Generate images only once per human query unless explicitly requested by the user`;
|
||||
this.schema = z.object({
|
||||
prompt: z.string().describe("Detailed keywords to describe the subject, use at minimum but not limited to 5, separated by comma"),
|
||||
negative_prompt: z.string().describe("Keywords we want to exclude from the final image, use at minimum but not limited to 5, separated by comma")
|
||||
prompt: z.string().describe("Detailed keywords to describe the subject, using at least 7 keywords to accurately describe the image, separated by comma"),
|
||||
negative_prompt: z.string().describe("Keywords we want to exclude from the final image, using at least 7 keywords to accurately describe the image, separated by comma")
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue