Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ultmaster committed Jan 12, 2024
1 parent 9f4b4d4 commit 65f06bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion coml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ def _select_examples(self, query: str, fewshots: list[_Type]) -> list[_Type]:
if self.example_ranking is not None:
documents = [cast(Any, shot).get("request", "N/A") for shot in fewshots]
embeddings = self.example_ranking.embed_documents(documents)
query_embedding = self.example_ranking.embed_query(query)
# Use embed_documents instead of embed_query because the latter has cache
query_embedding = self.example_ranking.embed_documents([query])[0]
similarities = [
(cosine_distance(query_embedding, embedding), shot)
for embedding, shot in zip(embeddings, fewshots)
Expand Down

0 comments on commit 65f06bf

Please sign in to comment.