mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-29 14:57:35 +00:00
fix(rag): Fix CrossEncoderRanker bug of EmbeddingRetriever (#1504)
Co-authored-by: aries_ckt <916701291@qq.com>
This commit is contained in:
parent
87a67cce7d
commit
8eb64d7311
@ -219,7 +219,7 @@ class CrossEncoderRanker(Ranker):
|
|||||||
rank_scores = self._model.predict(sentences=query_content_pairs)
|
rank_scores = self._model.predict(sentences=query_content_pairs)
|
||||||
|
|
||||||
for candidate, score in zip(candidates_with_scores, rank_scores):
|
for candidate, score in zip(candidates_with_scores, rank_scores):
|
||||||
candidate.score = score
|
candidate.score = float(score)
|
||||||
|
|
||||||
new_candidates_with_scores = sorted(
|
new_candidates_with_scores = sorted(
|
||||||
candidates_with_scores, key=lambda x: x.score, reverse=True
|
candidates_with_scores, key=lambda x: x.score, reverse=True
|
||||||
|
@ -82,7 +82,7 @@ class ChromaStore(VectorStoreBase):
|
|||||||
# client_settings=chroma_settings,
|
# client_settings=chroma_settings,
|
||||||
client=client,
|
client=client,
|
||||||
collection_metadata=collection_metadata,
|
collection_metadata=collection_metadata,
|
||||||
)
|
) # type: ignore
|
||||||
|
|
||||||
def similar_search(
|
def similar_search(
|
||||||
self, text, topk, filters: Optional[MetadataFilters] = None
|
self, text, topk, filters: Optional[MetadataFilters] = None
|
||||||
|
@ -93,7 +93,8 @@ class PGVectorStore(VectorStoreBase):
|
|||||||
List[str]: chunk ids.
|
List[str]: chunk ids.
|
||||||
"""
|
"""
|
||||||
lc_documents = [Chunk.chunk2langchain(chunk) for chunk in chunks]
|
lc_documents = [Chunk.chunk2langchain(chunk) for chunk in chunks]
|
||||||
return self.vector_store_client.from_documents(lc_documents)
|
self.vector_store_client.from_documents(lc_documents)
|
||||||
|
return [str(chunk.chunk_id) for chunk in lc_documents]
|
||||||
|
|
||||||
def delete_vector_name(self, vector_name: str):
|
def delete_vector_name(self, vector_name: str):
|
||||||
"""Delete vector by name.
|
"""Delete vector by name.
|
||||||
@ -109,4 +110,5 @@ class PGVectorStore(VectorStoreBase):
|
|||||||
Args:
|
Args:
|
||||||
ids(str): vector ids, separated by comma.
|
ids(str): vector ids, separated by comma.
|
||||||
"""
|
"""
|
||||||
return self.vector_store_client.delete(ids)
|
delete_ids = ids.split(",")
|
||||||
|
return self.vector_store_client.delete(delete_ids)
|
||||||
|
Loading…
Reference in New Issue
Block a user