Liking cljdoc? Tell your friends :D

hive-milvus.embedder

BOUNDARY: re-embed an entry's content via the injected embedding port. Record-shape conversion stays pure in hive-milvus.store.schema; the provider lookup + remote embed live behind hive-milvus.embed.port.

embed-for-entry policy (port-agnostic): blank content => (r/ok []), then dim-guarded no-embed type => (r/ok zero-vector) sized to the type's routed dim otherwise => port/embed-entry, then dim-guarded.

The dim guard turns an empty or nil vector bound for a collection of known dimension into :embedder/empty-vector, so an empty vector never reaches a Milvus write as a success.

Returns (r/ok vec) or one of :embedder/no-provider :embedder/embed-failed :embedder/dim-mismatch :embedder/empty-vector.

BOUNDARY: re-embed an entry's content via the injected embedding port.
Record-shape conversion stays pure in `hive-milvus.store.schema`; the
provider lookup + remote embed live behind `hive-milvus.embed.port`.

`embed-for-entry` policy (port-agnostic):
  blank content => (r/ok []), then dim-guarded
  no-embed type => (r/ok zero-vector) sized to the type's routed dim
  otherwise     => `port/embed-entry`, then dim-guarded.

The dim guard turns an empty or nil vector bound for a collection of
known dimension into :embedder/empty-vector, so an empty vector never
reaches a Milvus write as a success.

Returns (r/ok vec) or one of
  :embedder/no-provider  :embedder/embed-failed  :embedder/dim-mismatch
  :embedder/empty-vector.
raw docstring

embed-for-entriesclj

(embed-for-entries entries collection-name)

Batch form of embed-for-entry for ENTRIES all bound to COLLECTION-NAME. Blank content and no-embed types are answered locally exactly as embed-for-entry answers them; every other entry goes through ONE port/embed-entries call (a single provider round-trip when the embedder is batch-capable). Each vector is dim-guarded. Returns a vector of Results in input order; one entry's error never displaces another's.

Batch form of `embed-for-entry` for ENTRIES all bound to COLLECTION-NAME.
Blank content and no-embed types are answered locally exactly as
`embed-for-entry` answers them; every other entry goes through ONE
`port/embed-entries` call (a single provider round-trip when the
embedder is batch-capable). Each vector is dim-guarded. Returns a vector
of Results in input order; one entry's error never displaces another's.
sourceraw docstring

embed-for-entryclj

(embed-for-entry entry collection-name)

Re-embed entry's content for collection-name via the injected port.

Returns: (r/ok embedding-vec) on success (r/err :embedder/no-provider {…}) when neither type nor coll resolves (r/err :embedder/embed-failed {…}) when the embed call throws (r/err :embedder/dim-mismatch {…}) when the vector's width is not the one collection-name holds (r/err :embedder/empty-vector {…}) when the vector is empty or nil and collection-name's dimension is known (blank content included)

Side-effect: one provider HTTP call (inside the port). Caller passes the resulting vector to schema/entry->record.

Re-embed `entry`'s content for `collection-name` via the injected port.

Returns:
  (r/ok embedding-vec)                on success
  (r/err :embedder/no-provider {…})   when neither type nor coll resolves
  (r/err :embedder/embed-failed {…})  when the embed call throws
  (r/err :embedder/dim-mismatch {…})  when the vector's width is not the
                                      one `collection-name` holds
  (r/err :embedder/empty-vector {…})  when the vector is empty or nil and
                                      `collection-name`'s dimension is
                                      known (blank content included)

Side-effect: one provider HTTP call (inside the port). Caller passes the
resulting vector to `schema/entry->record`.
sourceraw docstring

embed-for-entry-or-throwclj

(embed-for-entry-or-throw entry collection-name)

Convenience for legacy call sites that expect an embedding vector (or a throw). Prefer embed-for-entry in new code so errors stay railway-tracked.

Convenience for legacy call sites that expect an embedding vector (or a
throw). Prefer `embed-for-entry` in new code so errors stay railway-tracked.
sourceraw docstring

text-to-embedclj

(text-to-embed entry)

The text to embed for entry: its transient :embed-text when a caller supplied one (a store decorator whose :content is ciphertext), else :content coerced to a string, maps JSON-encoded. :embed-text is never written to the record. Pure: two entries with equal text get equal vectors in one collection, which is what lets an update keep the stored one.

The text to embed for `entry`: its transient `:embed-text` when a caller
supplied one (a store decorator whose `:content` is ciphertext), else
`:content` coerced to a string, maps JSON-encoded. `:embed-text` is never
written to the record. Pure: two entries with equal text get equal vectors
in one collection, which is what lets an update keep the stored one.
sourceraw docstring

usable-embeddingclj

(usable-embedding res collection-name entry)

res unchanged when it is an err or an ok holding a non-empty vector; an ok holding an empty or nil vector becomes (r/err :embedder/empty-vector {:collection :type}). The write-path check that does not depend on the collection's dimension being readable from its name: guard-dim already answers the err when it is, and this keeps an empty vector from ever becoming a record when it is not.

`res` unchanged when it is an err or an ok holding a non-empty vector; an
ok holding an empty or nil vector becomes (r/err :embedder/empty-vector
{:collection :type}). The write-path check that does not depend on the
collection's dimension being readable from its name: `guard-dim` already
answers the err when it is, and this keeps an empty vector from ever
becoming a record when it is not.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close