chore: linting (#230)
This commit is contained in:
@@ -51,15 +51,21 @@ class InitConfig(BaseConfig):
|
|||||||
"""
|
"""
|
||||||
Sets embedding function to default (`text-embedding-ada-002`).
|
Sets embedding function to default (`text-embedding-ada-002`).
|
||||||
|
|
||||||
:raises ValueError: If the template is not valid as template should contain $context and $query
|
:raises ValueError: If the template is not valid as template should contain
|
||||||
|
$context and $query
|
||||||
"""
|
"""
|
||||||
if os.getenv("OPENAI_API_KEY") is None or os.getenv("OPENAI_ORGANIZATION") is None:
|
if (
|
||||||
raise ValueError("OPENAI_API_KEY or OPENAI_ORGANIZATION environment variables not provided")
|
os.getenv("OPENAI_API_KEY") is None
|
||||||
self.ef = embedding_functions.OpenAIEmbeddingFunction(
|
or os.getenv("OPENAI_ORGANIZATION") is None
|
||||||
api_key=os.getenv("OPENAI_API_KEY"),
|
):
|
||||||
organization_id=os.getenv("OPENAI_ORGANIZATION"),
|
raise ValueError(
|
||||||
model_name="text-embedding-ada-002"
|
"OPENAI_API_KEY or OPENAI_ORGANIZATION environment variables not provided" # noqa:E501
|
||||||
)
|
)
|
||||||
|
self.ef = embedding_functions.OpenAIEmbeddingFunction(
|
||||||
|
api_key=os.getenv("OPENAI_API_KEY"),
|
||||||
|
organization_id=os.getenv("OPENAI_ORGANIZATION"),
|
||||||
|
model_name="text-embedding-ada-002",
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _set_db(self, db):
|
def _set_db(self, db):
|
||||||
@@ -72,6 +78,7 @@ class InitConfig(BaseConfig):
|
|||||||
Sets database to default (`ChromaDb`).
|
Sets database to default (`ChromaDb`).
|
||||||
"""
|
"""
|
||||||
from embedchain.vectordb.chroma_db import ChromaDB
|
from embedchain.vectordb.chroma_db import ChromaDB
|
||||||
|
|
||||||
self.db = ChromaDB(ef=self.ef)
|
self.db = ChromaDB(ef=self.ef)
|
||||||
|
|
||||||
def _setup_logging(self, debug_level):
|
def _setup_logging(self, debug_level):
|
||||||
|
|||||||
@@ -360,9 +360,10 @@ class OpenSourceApp(EmbedChain):
|
|||||||
|
|
||||||
if not config.ef:
|
if not config.ef:
|
||||||
config._set_embedding_function(
|
config._set_embedding_function(
|
||||||
embedding_functions.SentenceTransformerEmbeddingFunction(
|
embedding_functions.SentenceTransformerEmbeddingFunction(
|
||||||
model_name="all-MiniLM-L6-v2"
|
model_name="all-MiniLM-L6-v2"
|
||||||
))
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not config.db:
|
if not config.db:
|
||||||
config._set_db_to_default()
|
config._set_db_to_default()
|
||||||
|
|||||||
Reference in New Issue
Block a user