From 4ab8d6c83492c7cb0e2c83b4d8b97a34a41c3d9f Mon Sep 17 00:00:00 2001 From: ItzCrazyKns Date: Tue, 16 Apr 2024 21:05:57 +0530 Subject: [PATCH] feat(agents): Use LLM name from env --- .env.example | 3 ++- src/agents/academicSearchAgent.ts | 4 ++-- src/agents/imageSearchAgent.ts | 2 +- src/agents/redditSearchAgent.ts | 4 ++-- src/agents/webSearchAgent.ts | 4 ++-- src/agents/wolframAlphaSearchAgent.ts | 4 ++-- src/agents/writingAssistant.ts | 2 +- src/agents/youtubeSearchAgent.ts | 4 ++-- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index 1df483a..bc67919 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ PORT=3001 OPENAI_API_KEY= SIMILARITY_MEASURE=cosine # cosine or dot -SEARXNG_API_URL= # no need to fill this if using docker \ No newline at end of file +SEARXNG_API_URL= # no need to fill this if using docker +MODEL_NAME=gpt-3.5-turbo \ No newline at end of file diff --git a/src/agents/academicSearchAgent.ts b/src/agents/academicSearchAgent.ts index 94e1801..7c3d448 100644 --- a/src/agents/academicSearchAgent.ts +++ b/src/agents/academicSearchAgent.ts @@ -19,13 +19,13 @@ import eventEmitter from 'events'; import computeSimilarity from '../utils/computeSimilarity'; const chatLLM = new ChatOpenAI({ - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, temperature: 0.7, }); const llm = new OpenAI({ temperature: 0, - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, }); const embeddings = new OpenAIEmbeddings({ diff --git a/src/agents/imageSearchAgent.ts b/src/agents/imageSearchAgent.ts index 37ac186..3a2c9db 100644 --- a/src/agents/imageSearchAgent.ts +++ b/src/agents/imageSearchAgent.ts @@ -12,7 +12,7 @@ import { searchSearxng } from '../core/searxng'; const llm = new OpenAI({ temperature: 0, - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, }); const imageSearchChainPrompt = ` diff --git a/src/agents/redditSearchAgent.ts b/src/agents/redditSearchAgent.ts index d304fcb..77f293e 100644 --- a/src/agents/redditSearchAgent.ts +++ b/src/agents/redditSearchAgent.ts @@ -19,13 +19,13 @@ import eventEmitter from 'events'; import computeSimilarity from '../utils/computeSimilarity'; const chatLLM = new ChatOpenAI({ - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, temperature: 0.7, }); const llm = new OpenAI({ temperature: 0, - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, }); const embeddings = new OpenAIEmbeddings({ diff --git a/src/agents/webSearchAgent.ts b/src/agents/webSearchAgent.ts index 3241021..f5799e3 100644 --- a/src/agents/webSearchAgent.ts +++ b/src/agents/webSearchAgent.ts @@ -19,13 +19,13 @@ import eventEmitter from 'events'; import computeSimilarity from '../utils/computeSimilarity'; const chatLLM = new ChatOpenAI({ - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, temperature: 0.7, }); const llm = new OpenAI({ temperature: 0, - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, }); const embeddings = new OpenAIEmbeddings({ diff --git a/src/agents/wolframAlphaSearchAgent.ts b/src/agents/wolframAlphaSearchAgent.ts index 672a91c..4f233af 100644 --- a/src/agents/wolframAlphaSearchAgent.ts +++ b/src/agents/wolframAlphaSearchAgent.ts @@ -19,13 +19,13 @@ import eventEmitter from 'events'; import computeSimilarity from '../utils/computeSimilarity'; const chatLLM = new ChatOpenAI({ - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, temperature: 0.7, }); const llm = new OpenAI({ temperature: 0, - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, }); const embeddings = new OpenAIEmbeddings({ diff --git a/src/agents/writingAssistant.ts b/src/agents/writingAssistant.ts index 8c2e1b9..2c8d66e 100644 --- a/src/agents/writingAssistant.ts +++ b/src/agents/writingAssistant.ts @@ -10,7 +10,7 @@ import type { StreamEvent } from '@langchain/core/tracers/log_stream'; import eventEmitter from 'events'; const chatLLM = new ChatOpenAI({ - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, temperature: 0.7, }); diff --git a/src/agents/youtubeSearchAgent.ts b/src/agents/youtubeSearchAgent.ts index d0745b2..9ab5ed8 100644 --- a/src/agents/youtubeSearchAgent.ts +++ b/src/agents/youtubeSearchAgent.ts @@ -19,13 +19,13 @@ import eventEmitter from 'events'; import computeSimilarity from '../utils/computeSimilarity'; const chatLLM = new ChatOpenAI({ - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, temperature: 0.7, }); const llm = new OpenAI({ temperature: 0, - modelName: 'gpt-3.5-turbo', + modelName: process.env.MODEL_NAME, }); const embeddings = new OpenAIEmbeddings({