fix: initialize embedding function manually (#205)
This commit is contained in:
@@ -297,6 +297,13 @@ class App(EmbedChain):
|
||||
"""
|
||||
if config is None:
|
||||
config = InitConfig()
|
||||
|
||||
if not config.ef:
|
||||
config._set_embedding_function_to_default()
|
||||
|
||||
if not config.db:
|
||||
config._set_db_to_default()
|
||||
|
||||
super().__init__(config)
|
||||
|
||||
def get_llm_model_answer(self, prompt, config: ChatConfig):
|
||||
@@ -345,17 +352,17 @@ class OpenSourceApp(EmbedChain):
|
||||
"Loading open source embedding model. This may take some time..."
|
||||
) # noqa:E501
|
||||
if not config:
|
||||
config = InitConfig(
|
||||
ef=embedding_functions.SentenceTransformerEmbeddingFunction(
|
||||
model_name="all-MiniLM-L6-v2"
|
||||
)
|
||||
)
|
||||
elif not config.ef:
|
||||
config = InitConfig()
|
||||
|
||||
if not config.ef:
|
||||
config._set_embedding_function(
|
||||
embedding_functions.SentenceTransformerEmbeddingFunction(
|
||||
model_name="all-MiniLM-L6-v2"
|
||||
)
|
||||
)
|
||||
embedding_functions.SentenceTransformerEmbeddingFunction(
|
||||
model_name="all-MiniLM-L6-v2"
|
||||
))
|
||||
|
||||
if not config.db:
|
||||
config._set_db_to_default()
|
||||
|
||||
print("Successfully loaded open source embedding model.")
|
||||
super().__init__(config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user