feat: get float in filtred to threshold
This commit is contained in:
		
							parent
							
								
									07c6fe9889
								
							
						
					
					
						commit
						d7429cda09
					
				
							
								
								
									
										15
									
								
								main.py
								
								
								
								
							
							
						
						
									
										15
									
								
								main.py
								
								
								
								
							|  | @ -132,7 +132,7 @@ db2=makeFaissdb(documents2,"Intencionality3",emb2) | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| def FinderDbs(query,dbs,filtred=False,th=1.2): | ||||
| def FinderDbs(query,dbs,filtred=1.2): | ||||
|     AllData={} | ||||
|     for dbt in dbs: | ||||
|         Sal = dbt.similarity_search_with_score(query,4) | ||||
|  | @ -144,10 +144,10 @@ def FinderDbs(query,dbs,filtred=False,th=1.2): | |||
|     #for item in AllData.items(): | ||||
|     #    print(item) | ||||
|      | ||||
|     if filtred: | ||||
|     if filtred>0: | ||||
|         filtredData={} | ||||
|         for row in AllData.keys(): | ||||
|             if AllData[row]["d"]<th: | ||||
|             if AllData[row]["d"]<filtred: | ||||
|                 filtredData[row]=AllData[row] | ||||
|         filtredData=dict(sorted(filtredData.items(), key=lambda item: item[1]["d"])) | ||||
|         return  filtredData,filtredData.keys() | ||||
|  | @ -165,7 +165,7 @@ def read_main(): | |||
| 
 | ||||
| class Response(BaseModel): | ||||
|     query: str | ||||
|     filtred : Optional[int] = 0 | ||||
|     filtred : Optional[float] = -9.0 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -175,11 +175,8 @@ def calculate_api(response: Response): | |||
|     try: | ||||
|         filtred = response.filtred | ||||
|     except: | ||||
|         filtred = 0 | ||||
|     if filtred==1: | ||||
|         filtred=True | ||||
|     else: | ||||
|         filtred=False | ||||
|         filtred = -9.0 | ||||
|      | ||||
|     AllData=FinderDbs(query,[db2],filtred) | ||||
|     versionL="_".join([model,entrenamiento]) | ||||
|     if AllData: | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue