-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
- Loading branch information
1 parent
c6d4566
commit e1cde0f
Showing
10 changed files
with
144 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
from langchain.embeddings.openai import OpenAIEmbeddings | ||
from models.databases.supabase.supabase import SupabaseDB | ||
from pydantic import BaseSettings | ||
from supabase.client import Client, create_client | ||
from vectorstore.supabase import SupabaseVectorStore | ||
from langchain.embeddings.ollama import OllamaEmbeddings | ||
from langchain.embeddings.openai import OpenAIEmbeddings | ||
|
||
from logger import get_logger | ||
|
||
logger = get_logger(__name__) | ||
|
||
class BrainRateLimiting(BaseSettings): | ||
max_brain_per_user: int = 5 | ||
|
@@ -15,6 +19,7 @@ class BrainSettings(BaseSettings): | |
supabase_service_key: str | ||
resend_api_key: str = "null" | ||
resend_email_address: str = "[email protected]" | ||
ollama_api_base_url: str = None | ||
|
||
|
||
class ContactsSettings(BaseSettings): | ||
|
@@ -39,11 +44,14 @@ def get_supabase_db() -> SupabaseDB: | |
return SupabaseDB(supabase_client) | ||
|
||
|
||
def get_embeddings() -> OpenAIEmbeddings: | ||
def get_embeddings(): | ||
settings = BrainSettings() # pyright: ignore reportPrivateUsage=none | ||
embeddings = OpenAIEmbeddings( | ||
openai_api_key=settings.openai_api_key | ||
) # pyright: ignore reportPrivateUsage=none | ||
if settings.ollama_api_base_url: | ||
embeddings = OllamaEmbeddings( | ||
base_url=settings.ollama_api_base_url, | ||
) # pyright: ignore reportPrivateUsage=none | ||
else: | ||
embeddings = OpenAIEmbeddings() # pyright: ignore reportPrivateUsage=none | ||
return embeddings | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.