Skip to content

Commit

Permalink
fix(rag): Fix CrossEncoderRanker bug of EmbeddingRetriever (#1504)
Browse files Browse the repository at this point in the history
Co-authored-by: aries_ckt <[email protected]>
  • Loading branch information
ivanzhu109 and Aries-ckt authored May 10, 2024
1 parent 87a67cc commit 8eb64d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dbgpt/rag/retriever/rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def rank(
rank_scores = self._model.predict(sentences=query_content_pairs)

for candidate, score in zip(candidates_with_scores, rank_scores):
candidate.score = score
candidate.score = float(score)

new_candidates_with_scores = sorted(
candidates_with_scores, key=lambda x: x.score, reverse=True
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/storage/vector_store/chroma_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self, vector_store_config: ChromaVectorConfig) -> None:
# client_settings=chroma_settings,
client=client,
collection_metadata=collection_metadata,
)
) # type: ignore

def similar_search(
self, text, topk, filters: Optional[MetadataFilters] = None
Expand Down
6 changes: 4 additions & 2 deletions dbgpt/storage/vector_store/pgvector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def load_document(self, chunks: List[Chunk]) -> List[str]:
List[str]: chunk ids.
"""
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):
"""Delete vector by name.
Expand All @@ -109,4 +110,5 @@ def delete_by_ids(self, ids: str):
Args:
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)

0 comments on commit 8eb64d7

Please sign in to comment.