agentscope.service.retrieval.similarity module
Similarity functions for retrieval
- agentscope.service.retrieval.similarity.cos_sim(a: list[Number], b: list[Number]) ServiceResponse [源代码]
Compute the cosine similarity between two different embeddings
- 参数:
a (Embedding) – Embedding
b (Embedding) – Embedding
- 返回:
A float.
- 返回类型:
ServiceResponse