@@ -97,15 +97,14 @@ def load_chat_model(model: str) -> BaseChatModel:
9797 "BAAI/bge-small-en-v1.5" ,
9898 # providers=["CUDAExecutionProvider"], # Replace the fastembed dependency with fastembed-gpu to use your GPUs
9999)
100- embedding_dimensions = 384
101100
102101collection_name = "sparql-docs"
103102vectordb = QdrantClient (path = "data/vectordb" )
104103# vectordb = QdrantClient(location=":memory:")
105104# vectordb = QdrantClient(host="localhost", prefer_grpc=True)
106105
107106
108- def index_endpoints ():
107+ def index_endpoints () -> None :
109108 """Index SPARQL endpoints metadata in the vector database."""
110109 docs : list [Document ] = []
111110 for endpoint in endpoints :
@@ -124,7 +123,7 @@ def index_endpoints():
124123 vectordb .delete_collection (collection_name )
125124 vectordb .create_collection (
126125 collection_name = collection_name ,
127- vectors_config = VectorParams (size = embedding_dimensions , distance = Distance .COSINE ),
126+ vectors_config = VectorParams (size = embedding_model . embedding_size , distance = Distance .COSINE ),
128127 )
129128
130129 embeddings = embedding_model .embed ([q .page_content for q in docs ])
@@ -223,7 +222,7 @@ def execute_query(last_msg: str) -> list[dict[str, str]]:
223222
224223
225224@cl .on_message
226- async def on_message (msg : cl .Message ):
225+ async def on_message (msg : cl .Message ) -> None :
227226 """Main function to handle when user send a message to the assistant."""
228227 retrieved_docs = retrieve_docs (msg .content )
229228 formatted_docs = "\n " .join (format_doc (doc ) for doc in retrieved_docs )
@@ -292,7 +291,7 @@ async def set_starters():
292291# uv run --env-file .env app.py
293292
294293
295- async def main ():
294+ async def main () -> None :
296295 question = "What are the rat orthologs of human TP53?"
297296
298297 logging .info ("\n \n ###### 🙉 Without context retrieval ########\n \n " )
0 commit comments