mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
update chroma chat
This commit is contained in:
@ -4,6 +4,9 @@ from fastapi import Request, Response, status
|
|||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
from .blackbox import Blackbox
|
from .blackbox import Blackbox
|
||||||
|
|
||||||
|
from ..utils import chroma_setting
|
||||||
|
DEFAULT_COLLECTION_ID = "123"
|
||||||
|
|
||||||
from injector import singleton
|
from injector import singleton
|
||||||
@singleton
|
@singleton
|
||||||
class ChromaChat(Blackbox):
|
class ChromaChat(Blackbox):
|
||||||
@ -19,13 +22,13 @@ class ChromaChat(Blackbox):
|
|||||||
data = args[0]
|
data = args[0]
|
||||||
return isinstance(data, list)
|
return isinstance(data, list)
|
||||||
|
|
||||||
def processing(self, question, context) -> str:
|
def processing(self, question, setting: chroma_setting) -> str:
|
||||||
|
|
||||||
# load or create collection
|
# load or create collection
|
||||||
if context is None:
|
if setting is None:
|
||||||
collection_id = "123"
|
collection_id = DEFAULT_COLLECTION_ID
|
||||||
else:
|
else:
|
||||||
collection_id = context["collections"][0]
|
collection_id = setting.ChromaSetting.collection_ids[0]
|
||||||
# query it
|
# query it
|
||||||
chroma_result = self.chroma_query(question, collection_id)
|
chroma_result = self.chroma_query(question, collection_id)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user