Class EmbeddingMatch
-
- All Implemented Interfaces:
public class EmbeddingMatch<Embedded>
Represents a matched embedding along with its relevance score (derivative of cosine distance), ID, and original embedded content.
-
-
Constructor Summary
Constructors Constructor Description EmbeddingMatch(Double score, String embeddingId, Embedding embedding, Embedded embedded)
Creates a new instance.
-
Method Summary
Modifier and Type Method Description Double
score()
Returns the relevance score (derivative of cosine distance) of this embedding compared to a reference embedding during a search. String
embeddingId()
The ID of the embedding assigned when adding this embedding to the store. Embedding
embedding()
Returns the embedding that has been matched. Embedded
embedded()
Returns the original content that was embedded. boolean
equals(Object o)
int
hashCode()
String
toString()
-
-
Constructor Detail
-
EmbeddingMatch
EmbeddingMatch(Double score, String embeddingId, Embedding embedding, Embedded embedded)
Creates a new instance.- Parameters:
score
- The relevance score (derivative of cosine distance) of this embedding compared to a reference embedding during a search.embeddingId
- The ID of the embedding assigned when adding this embedding to the store.embedding
- The embedding that has been matched.embedded
- The original content that was embedded.
-
-
Method Detail
-
score
Double score()
Returns the relevance score (derivative of cosine distance) of this embedding compared to a reference embedding during a search. The current implementation assumes that the embedding store uses cosine distance when comparing embeddings.
- Returns:
Relevance score, ranging from 0 (not relevant) to 1 (highly relevant).
-
embeddingId
String embeddingId()
The ID of the embedding assigned when adding this embedding to the store.
- Returns:
The ID of the embedding assigned when adding this embedding to the store.
-
embedding
Embedding embedding()
Returns the embedding that has been matched.
- Returns:
The embedding that has been matched.
-
embedded
Embedded embedded()
Returns the original content that was embedded.
- Returns:
The original content that was embedded. Typically, this is a dev.langchain4j.data.segment.TextSegment.
-
hashCode
int hashCode()
-
-
-
-