UmweltDocs
Reference/Commands/embedding.defineSpace
embedding.defineSpacecommandsince 0.1

Declares an embedding space: where the vectors of one model live.

Request
umwelt call story.umw embedding.defineSpace '{
  "projectId": "ball",
  "space": { "id": "demo", "dimensions": 3, "model": "example-3d" }
}'
Request
const result = await client.embeddingDefineSpace({
  projectId: 'ball',
  space: { id: 'demo', dimensions: 3, model: 'example-3d' },
});
Request
var result = engine.EmbeddingDefineSpace(new DefineEmbeddingSpaceInput
{
    ProjectId = "ball",
    Space = new EmbeddingSpace { Id = "demo", Dimensions = 3, Model = "example-3d" },
});
Response
{
  "id": "demo",
  "dimensions": 3,
  "model": "example-3d"
}

Payload

FieldTypeDescription
projectIdrequiredstringThe project to write to.
spacerequiredEmbeddingSpaceThe space: id, dimensions (1 to 4096) and model, which documents the model and is never read.

Result

FieldTypeDescription
idalwaysstringThe space’s id.
dimensionsalwaysintegerThe length of every vector in it, from 1 to 4096.
modelalwaysstringThe model that makes its vectors. The engine never reads it.

Rules

One space per model. Vectors are comparable only within a model. Changing models means a new space, filled at any pace, then dropping the old one.

Defining it again is a no-op. The same definition returns it; a different one is a CONFLICT.

Errors

VALIDATION_FAILEDThe payload is malformed, the id begins with umwelt:, or the dimensions are outside 1 to 4096.
CONFLICTThe space exists with another definition.
NOT_FOUNDThe project does not exist.
HANDSHAKE_REQUIREDOver the protocol, hello was not sent first.

Every code is listed in Errors.

See also

Was this page helpful?