UmweltDocs
Reference/Commands/embedding.put
embedding.putcommandsince 0.1

Stores vectors made by your model, or replaces them, in one transaction.

Request
umwelt call story.umw embedding.put '{
  "projectId": "ball",
  "spaceId": "demo",
  "items": [
    {
      "docType": "record",
      "docId": "maid-staff",
      "textHash": "04d718cba11bc4995d03fbe82412f2bd2d6156acb6dc27042c297ed94a4d01f2",
      "vector": [0.12, 0.84, 0.53]
    },
    {
      "docType": "record",
      "docId": "butler-staff",
      "textHash": "5502f404e90632e72e7395a6f6d15dc5837dee8e9dbbfea82020527e4fffea1c",
      "vector": [0.9, 0.1, 0.42]
    }
  ]
}'
Request
const result = await client.embeddingPut({
  projectId: 'ball',
  spaceId: 'demo',
  items: [
    {
      docType: 'record',
      docId: 'maid-staff',
      textHash: '04d718cba11bc4995d03fbe82412f2bd2d6156acb6dc27042c297ed94a4d01f2',
      vector: [0.12, 0.84, 0.53],
    },
    {
      docType: 'record',
      docId: 'butler-staff',
      textHash: '5502f404e90632e72e7395a6f6d15dc5837dee8e9dbbfea82020527e4fffea1c',
      vector: [0.9, 0.1, 0.42],
    },
  ],
});
Request
var result = engine.EmbeddingPut(new PutEmbeddingsInput
{
    ProjectId = "ball",
    SpaceId = "demo",
    Items = new()
    {
        new EmbeddingItem
        {
            DocType = "record",
            DocId = "maid-staff",
            TextHash = "04d718cba11bc4995d03fbe82412f2bd2d6156acb6dc27042c297ed94a4d01f2",
            Vector = new() { 0.12, 0.84, 0.53 },
        },
        new EmbeddingItem
        {
            DocType = "record",
            DocId = "butler-staff",
            TextHash = "5502f404e90632e72e7395a6f6d15dc5837dee8e9dbbfea82020527e4fffea1c",
            Vector = new() { 0.9, 0.1, 0.42 },
        },
    },
});
Response
{
  "stored": 2,
  "stale": 0
}

Payload

FieldTypeDescription
projectIdrequiredstringThe project to write to.
spaceIdrequiredstringThe embedding space.
itemsrequiredEmbeddingItem[]One per document: docType, docId, the textHash the vector was made from, and the vector.

Result

FieldTypeDescription
storedalwaysintegerVectors stored.
stalealwaysintegerVectors whose textHash is not the document’s: kept, and listed as pending until replaced.

Rules

Vectors are normalized. They must have the space’s dimensions, finite values, and not be all zeros. Search then gives the same order and scores on every platform.

A vector grants nothing. It only orders documents a read would see anyway.

Errors

VALIDATION_FAILEDA vector has the wrong dimensions or invalid values, or the document is not searchable (an Awareness, a Holding without text).
NOT_FOUNDThe project, the space or a document does not exist.
HANDSHAKE_REQUIREDOver the protocol, hello was not sent first.

Every code is listed in Errors.

See also

Was this page helpful?