AgentSea. Embeddings
(agentsea_embeddings v0.1.0)
Copy Markdown
Ties an AgentSea.Embedder to an AgentSea.VectorStore: embed-and-index text
documents, then semantic-search by text.
Example
{:ok, store} = AgentSea.VectorStore.Memory.start_link()
handle =
AgentSea.Embeddings.new(
store_mod: AgentSea.VectorStore.Memory,
store: store,
embedder: AgentSea.Embedder.Hashing
)
AgentSea.Embeddings.index(handle, [
%{id: "a", text: "the cat sat on the mat"},
%{id: "b", text: "quarterly revenue grew 12%"}
])
[%{id: "a"} | _] = AgentSea.Embeddings.search(handle, "where is the cat", 1)
Summary
Functions
Embed each entry's text and upsert it into the store.
Build a handle bundling a store + embedder.
Embed the query text and return the k most similar records.
Types
Functions
Embed each entry's text and upsert it into the store.
Build a handle bundling a store + embedder.
@spec search(t(), String.t(), pos_integer(), keyword()) :: [AgentSea.VectorStore.hit()] | {:error, term()}
Embed the query text and return the k most similar records.