Skip to content

Commit eb33102

Browse files
committed
Fix async calls
1 parent 2be6e74 commit eb33102

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

services/chatbot/src/chatbot/retrieverutils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
async def get_chroma_collection(api_key):
35-
chroma_client = chromadb.AsyncHttpClient(
35+
chroma_client = await chromadb.AsyncHttpClient(
3636
host=Config.CHROMA_HOST,
3737
port=Config.CHROMA_PORT,
3838
ssl=False,
@@ -42,7 +42,7 @@ async def get_chroma_collection(api_key):
4242
database=DEFAULT_DATABASE,
4343
)
4444

45-
collection = chroma_client.get_or_create_collection(
45+
collection = await chroma_client.get_or_create_collection(
4646
name="chats",
4747
embedding_function=OpenAIEmbeddingFunction(
4848
api_key=api_key,
@@ -54,7 +54,7 @@ async def get_chroma_collection(api_key):
5454

5555
async def add_to_chroma_collection(api_key, session_id, new_messages):
5656
collection = await get_chroma_collection(api_key)
57-
collection.add(
57+
res = await collection.add(
5858
documents=[
5959
{"content": content, "metadata": {"session_id": session_id, "role": role}}
6060
for role, content in new_messages.items()

0 commit comments

Comments
 (0)