diff --git a/backend/models/settings.py b/backend/models/settings.py index 6d8f45f07fd3..37fee856154d 100644 --- a/backend/models/settings.py +++ b/backend/models/settings.py @@ -1,7 +1,7 @@ from typing import Optional from uuid import UUID -from langchain.embeddings.ollama import OllamaEmbeddings +from langchain_community.embeddings import OllamaEmbeddings from langchain_openai import OpenAIEmbeddings from logger import get_logger from models.databases.supabase.supabase import SupabaseDB diff --git a/backend/modules/brain/integrations/GPT4/Brain.py b/backend/modules/brain/integrations/GPT4/Brain.py index 1ba63c2b8154..cba3af5f84f9 100644 --- a/backend/modules/brain/integrations/GPT4/Brain.py +++ b/backend/modules/brain/integrations/GPT4/Brain.py @@ -35,13 +35,13 @@ class AgentState(TypedDict): class GPT4Brain(KnowledgeBrainQA): """ GPT4Brain integrates with GPT-4 to provide real-time answers and supports various tools to enhance its capabilities. - + Available Tools: - WebSearchTool: Performs web searches to find relevant information. - ImageGeneratorTool: Generates images based on textual descriptions. - URLReaderTool: Reads and summarizes content from URLs. - EmailSenderTool: Sends emails with specified content. - + Use Cases: - WebSearchTool can be used to find the latest news articles on a specific topic or to gather information from various websites. - ImageGeneratorTool is useful for creating visual content based on textual prompts, such as generating a company logo based on a description. @@ -51,7 +51,7 @@ class GPT4Brain(KnowledgeBrainQA): tools: Optional[List[BaseTool]] = None tool_executor: Optional[ToolExecutor] = None - model_function: ChatOpenAI = None + function_model: ChatOpenAI = None def __init__( self, @@ -90,7 +90,7 @@ def should_continue(self, state): # Define the function that calls the model def call_model(self, state): messages = state["messages"] - response = self.model_function.invoke(messages) + response = self.function_model.invoke(messages) # We return a list, because this will get added to the existing list return {"messages": [response]} @@ -166,11 +166,11 @@ def create_graph(self): return app def get_chain(self): - self.model_function = ChatOpenAI( + self.function_model = ChatOpenAI( model="gpt-4-turbo", temperature=0, streaming=True ) - self.model_function = self.model_function.bind_tools(self.tools) + self.function_model = self.function_model.bind_tools(self.tools) graph = self.create_graph() diff --git a/backend/modules/brain/rags/quivr_rag.py b/backend/modules/brain/rags/quivr_rag.py index 2e981e43ddc8..59d590156de4 100644 --- a/backend/modules/brain/rags/quivr_rag.py +++ b/backend/modules/brain/rags/quivr_rag.py @@ -4,7 +4,7 @@ from uuid import UUID from langchain.chains import ConversationalRetrievalChain -from langchain.embeddings.ollama import OllamaEmbeddings +from langchain_community.embeddings import OllamaEmbeddings from langchain.llms.base import BaseLLM from langchain.prompts import HumanMessagePromptTemplate, SystemMessagePromptTemplate from langchain.retrievers import ContextualCompressionRetriever diff --git a/backend/modules/chat/controller/chat_routes.py b/backend/modules/chat/controller/chat_routes.py index 64442c2a079e..b226ed02c1b3 100644 --- a/backend/modules/chat/controller/chat_routes.py +++ b/backend/modules/chat/controller/chat_routes.py @@ -3,7 +3,7 @@ from fastapi import APIRouter, Depends, HTTPException, Query, Request from fastapi.responses import StreamingResponse -from langchain.embeddings.ollama import OllamaEmbeddings +from langchain_community.embeddings import OllamaEmbeddings from langchain_openai import OpenAIEmbeddings from logger import get_logger from middlewares.auth import AuthBearer, get_current_user