FuzzyEmbeddingMatch.EmbeddedString
— TypeEmbeddedString{T,E}
A string content
with an embedding embedding
.
FuzzyEmbeddingMatch.MatchCandidate
— TypeMatchCandidate{T,E}
A candidate match between two strings content_a
and content_b
with embeddings embedding_a
and embedding_b
and a score score
.
Base.show
— MethodOverrides the show
function for EmbeddedString
to only show the content
of the string.
FuzzyEmbeddingMatch.allmatches
— Methodallmatches(
thing::AbstractString,
candidates::AbstractVector{<:AbstractString};
threshold=0.5
)
Return all the matches for thing
in candidates
by comparing the embedding of thing
to the embeddings of candidates
. The embeddings are computed using aiembed
from PromptingTools.jl.
FuzzyEmbeddingMatch.bestmatch
— Methodbestmatch(
thing::AbstractString,
candidates::AbstractVector{<:AbstractString};
threshold=0.5
)
Return the best match for thing
in candidates
by comparing the embedding of thing
to the embeddings of candidates
. The embeddings are computed using aiembed
from PromptingTools.jl.
FuzzyEmbeddingMatch.corpus
— Methodcorpus(things::AbstractVector{<:AbstractString})
Return the corpus of all the strings in things
. Used to cache the embeddings of all the strings in things
to reduce the number of API calls to aiembed
.
FuzzyEmbeddingMatch.cosinesimilarity
— Methodcosinesimilarity(a::AbstractVector, b::AbstractVector)
Compare the embeddings of a
and b
by computing the cosine similarity.
FuzzyEmbeddingMatch.embed
— Methodembed(x::AbstractString)
Return the embedding of x
using aiembed
from PromptingTools.jl. Memoized to reduce the number of API calls to aiembed
.
FuzzyEmbeddingMatch.getembeddings
— Methodgetembeddings(things::AbstractVector{<:AbstractString})
Return the embeddings of each string in things
.