fix(backend): add embed_query method to EmbeddingFunctionWrapper for ChromaDB query
ChromaDB 1.5.8 calls embed_query() during collection.query(), but the wrapper only implemented __call__ (used by collection.add()). Added embed_query() as alias and refactored to shared _embed() method. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
b48c23001e
commit
5dcb71369c
|
|
@ -14,6 +14,12 @@ class _EmbeddingFunctionWrapper:
|
|||
return "custom_embedding_wrapper"
|
||||
|
||||
def __call__(self, input):
|
||||
return self._embed(input)
|
||||
|
||||
def embed_query(self, input):
|
||||
return self._embed(input)
|
||||
|
||||
def _embed(self, texts):
|
||||
from app.services.embedding_client import EmbeddingClient
|
||||
import asyncio
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
|
@ -28,7 +34,7 @@ class _EmbeddingFunctionWrapper:
|
|||
loop.close()
|
||||
|
||||
with ThreadPoolExecutor(max_workers=1) as executor:
|
||||
return executor.submit(_run_in_thread, input).result()
|
||||
return executor.submit(_run_in_thread, texts).result()
|
||||
|
||||
|
||||
def get_embedding_function_settings(settings):
|
||||
|
|
|
|||
Loading…
Reference in New Issue