feat(agents): replace LLMs with chat LLMs

This commit is contained in:
ItzCrazyKns 2024-04-18 18:15:17 +05:30
parent f9ab543bcf
commit dd1ce4e324
No known key found for this signature in database
GPG key ID: 8162927C7CCE3065
7 changed files with 19 additions and 44 deletions

View file

@ -17,16 +17,11 @@ import type { StreamEvent } from '@langchain/core/tracers/log_stream';
import formatChatHistoryAsString from '../utils/formatHistory';
import eventEmitter from 'events';
const chatLLM = new ChatOpenAI({
const llm = new ChatOpenAI({
modelName: process.env.MODEL_NAME,
temperature: 0.7,
});
const llm = new OpenAI({
temperature: 0,
modelName: process.env.MODEL_NAME,
});
const basicWolframAlphaSearchRetrieverPrompt = `
You will be given a conversation below and a follow up question. You need to rephrase the follow-up question if needed so it is a standalone question that can be used by the LLM to search the web for information.
If it is a writing task or a simple hi, hello rather than a question, you need to return \`not_needed\` as the response.
@ -169,7 +164,7 @@ const basicWolframAlphaSearchAnsweringChain = RunnableSequence.from([
new MessagesPlaceholder('chat_history'),
['user', '{query}'],
]),
chatLLM,
llm,
strParser,
]).withConfig({
runName: 'FinalResponseGenerator',