This commit is contained in:
Timothy J. Baek 2024-10-09 12:05:16 -07:00
parent 451f1bae15
commit c157004e07

View File

@ -271,17 +271,12 @@ def get_embedding_function(
if embedding_engine == "": if embedding_engine == "":
return lambda query: embedding_function.encode(query).tolist() return lambda query: embedding_function.encode(query).tolist()
elif embedding_engine in ["ollama", "openai"]: elif embedding_engine in ["ollama", "openai"]:
if embedding_engine == "ollama":
func = lambda query: generate_embeddings( func = lambda query: generate_embeddings(
engine=embedding_engine,
model=embedding_model, model=embedding_model,
text=query, text=query,
) key=openai_key if embedding_engine == "openai" else "",
elif embedding_engine == "openai": url=openai_url if embedding_engine == "openai" else "",
func = lambda query: generate_embeddings(
model=embedding_model,
text=query,
key=openai_key,
url=openai_url,
) )
def generate_multiple(query, func): def generate_multiple(query, func):