File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
services/chatbot/src/chatbot Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 3232
3333
3434async 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
5555async 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 ()
You can’t perform that action at this time.
0 commit comments