Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update import statements for OllamaEmbeddings #2584

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/models/settings.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions backend/modules/brain/integrations/GPT4/Brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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]}

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion backend/modules/brain/rags/quivr_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion backend/modules/chat/controller/chat_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down