mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-31 12:57:20 +02:00
feat(Functions Agent): use official langchain function executor/agent for better output handling (#538)
* style(FunctionsAgent.js): remove unnecessary comments and update PREFIX variable refactor(initializeFunctionsAgent.js): update to use initializeAgentExecutorWithOptions deps(package.json): update langchain to v0.0.95 refactor(askGPTPlugins.js): pass endpointOption to onStart function * fix(ChatAgent.js): handle undefined delta content in progressMessage.choices array
This commit is contained in:
parent
49e2cdf76c
commit
f84da37c9c
6 changed files with 47 additions and 28 deletions
|
|
@ -7,8 +7,7 @@ const {
|
|||
SystemMessagePromptTemplate,
|
||||
HumanMessagePromptTemplate
|
||||
} = require('langchain/prompts');
|
||||
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.`;
|
||||
const PREFIX = `You are a helpful AI assistant.`;
|
||||
|
||||
function parseOutput(message) {
|
||||
if (message.additional_kwargs.function_call) {
|
||||
|
|
@ -52,9 +51,9 @@ class FunctionsAgent extends Agent {
|
|||
|
||||
return ChatPromptTemplate.fromPromptMessages([
|
||||
SystemMessagePromptTemplate.fromTemplate(`Date: ${currentDateString}\n${prefix}`),
|
||||
HumanMessagePromptTemplate.fromTemplate(`{chat_history}
|
||||
Query: {input}`),
|
||||
new MessagesPlaceholder('agent_scratchpad')
|
||||
new MessagesPlaceholder('chat_history'),
|
||||
HumanMessagePromptTemplate.fromTemplate(`Query: {input}`),
|
||||
new MessagesPlaceholder('agent_scratchpad'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue