Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rag): Fix CrossEncoderRanker bug of EmbeddingRetriever #1504

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading