Files
lancedb/docs/src/js/namespaces/embedding/functions/LanceSchema.md
Will Jones e05c0cd87e ci(node): check docs in CI (#2084)
* Make `npm run docs` fail if there are any warnings. This will catch
items missing from the API reference.
* Add a check in our CI to make sure `npm run dos` runs without warnings
and doesn't generate any new files (indicating it might be out-of-date.
* Hide constructors that aren't user facing.
* Remove unused enum `WriteMode`.

Closes #2068
2025-01-30 16:06:06 -08:00

951 B

@lancedb/lancedbDocs


@lancedb/lancedb / embedding / LanceSchema

Function: LanceSchema()

function LanceSchema(fields): Schema

Create a schema with embedding functions.

Parameters

Returns

Schema

Schema

Example

class MyEmbeddingFunction extends EmbeddingFunction {
// ...
}
const func = new MyEmbeddingFunction();
const schema = LanceSchema({
  id: new Int32(),
  text: func.sourceField(new Utf8()),
  vector: func.vectorField(),
  // optional: specify the datatype and/or dimensions
  vector2: func.vectorField({ datatype: new Float32(), dims: 3}),
});

const table = await db.createTable("my_table", data, { schema });