Embeddings
Embeddings
Overview
An embedding turns a piece of text into a fixed-size numeric vector, so that Zilla can compare two pieces of text by their meaning instead of by their exact wording. Embeddings are registered under a namespace-scoped embeddings map, the same way catalogs, vaults, and stores are registered, and are referenced by name from wherever a semantic comparison is needed.
embeddings:
moderator0:
type: gloveProviders
| Type | Purpose |
|---|---|
glove | Averages pre-trained GloVe word vectors. Runs in-process, no external service. [Incubator] |
openai | Resolves text to a vector via OpenAI's embeddings API, or a self-hosted OpenAI-compatible server. [Plus] |
aws-bedrock | Resolves text to a vector via a managed AWS Bedrock embedding model (Titan or Cohere). [Plus] |
ibm-watsonx-ai | Resolves text to a vector via an IBM watsonx.ai-hosted embedding model (SaaS or CP4D). [Plus] |
For a hosted alternative backed by IBM watsonx.ai's text-embeddings models, see ibm-watsonx-ai.
Comparing embeddings
Two embeddings are compared using cosine similarity: a value from -1 to 1 describing how closely their meanings align, independent of vector magnitude or shared vocabulary. A higher similarity means the two pieces of text mean something closer to the same thing.
Semantic message moderation
The vector model references a named embedding to reject a message value whose meaning is close enough to one of a configured set of example phrases, even when the message shares no vocabulary at all with those phrases.
embeddings:
moderator0:
type: glove
bindings:
north_echo_server:
type: echo
kind: server
options:
value:
model: vector
embedding: moderator0
reject:
- "You will never believe what happened next."
threshold: 0.94
