Skip to content

pixano.app.routers.embeddings

create_embedding(dataset_id, table, id, embedding, settings) async

Update an embedding in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the embedding.

required
embedding EmbeddingModel

Embedding to update.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
EmbeddingModel

The embedding updated.

Source code in pixano/app/routers/embeddings.py
@router.post("/{dataset_id}/{table}/{id}", response_model=EmbeddingModel)
async def create_embedding(
    dataset_id: str,
    table: str,
    id: str,
    embedding: EmbeddingModel,
    settings: Annotated[Settings, Depends(get_settings)],
) -> EmbeddingModel:
    """Update an embedding in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the embedding.
        embedding: Embedding to update.
        settings: App settings.

    Returns:
        The embedding updated.
    """
    return await create_row_handler(dataset_id, SchemaGroup.EMBEDDING, table, id, embedding, settings)

create_embeddings(dataset_id, table, embeddings, settings) async

Add embeddings in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
embeddings list[EmbeddingModel]

Embeddings to add.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
list[EmbeddingModel]

List of embeddings added.

Source code in pixano/app/routers/embeddings.py
@router.post("/{dataset_id}/{table}/", response_model=list[EmbeddingModel])
async def create_embeddings(
    dataset_id: str,
    table: str,
    embeddings: list[EmbeddingModel],
    settings: Annotated[Settings, Depends(get_settings)],
) -> list[EmbeddingModel]:
    """Add embeddings in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        embeddings: Embeddings to add.
        settings: App settings.

    Returns:
        List of embeddings added.
    """
    return await create_rows_handler(dataset_id, SchemaGroup.EMBEDDING, table, embeddings, settings)

delete_embedding(dataset_id, table, id, settings) async

Delete an embedding from a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the embedding to delete.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required
Source code in pixano/app/routers/embeddings.py
@router.delete("/{dataset_id}/{table}/{id}")
async def delete_embedding(
    dataset_id: str, table: str, id: str, settings: Annotated[Settings, Depends(get_settings)]
) -> None:
    """Delete an embedding from a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the embedding to delete.
        settings: App settings.
    """
    return await delete_row_handler(dataset_id, SchemaGroup.EMBEDDING, table, id, settings)

delete_embeddings(dataset_id, table, ids, settings) async

Delete embeddings from a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
ids Annotated[list[str], Query()]

IDs of the embeddings to delete.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required
Source code in pixano/app/routers/embeddings.py
@router.delete("/{dataset_id}/{table}/")
async def delete_embeddings(
    dataset_id: str,
    table: str,
    ids: Annotated[list[str], Query()],
    settings: Annotated[Settings, Depends(get_settings)],
) -> None:
    """Delete embeddings from a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        ids: IDs of the embeddings to delete.
        settings: App settings.
    """
    return await delete_rows_handler(dataset_id, SchemaGroup.EMBEDDING, table, ids, settings)

get_embedding(dataset_id, table, id, settings) async

Get an embedding from a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the embedding.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
EmbeddingModel

The embedding.

Source code in pixano/app/routers/embeddings.py
@router.get("/{dataset_id}/{table}/{id}", response_model=EmbeddingModel)
async def get_embedding(
    dataset_id: str, table: str, id: str, settings: Annotated[Settings, Depends(get_settings)]
) -> EmbeddingModel:
    """Get an embedding from a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the embedding.
        settings: App settings.

    Returns:
        The embedding.
    """
    return await get_row_handler(dataset_id, SchemaGroup.EMBEDDING, table, id, settings)

get_embeddings(dataset_id, table, settings, ids=Query(None), limit=None, skip=0, where=None, item_ids=Query(None)) async

Get embeddings from a table of a dataset.

They can be filtered by IDs, item IDs, a where clause or paginated.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required
ids list[str] | None

IDs of the embeddings.

Query(None)
limit int | None

Limit number of embeddings.

None
skip int

Skip number of embeddings.

0
where str | None

Where clause.

None
item_ids list[str] | None

Item IDs.

Query(None)

Returns:

Type Description
list[EmbeddingModel]

List of embeddings.

Source code in pixano/app/routers/embeddings.py
@router.get("/{dataset_id}/{table}/", response_model=list[EmbeddingModel])
async def get_embeddings(
    dataset_id: str,
    table: str,
    settings: Annotated[Settings, Depends(get_settings)],
    ids: list[str] | None = Query(None),
    limit: int | None = None,
    skip: int = 0,
    where: str | None = None,
    item_ids: list[str] | None = Query(None),
) -> list[EmbeddingModel]:
    """Get embeddings from a table of a dataset.

    They can be filtered by IDs, item IDs, a where clause or paginated.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        settings: App settings.
        ids: IDs of the embeddings.
        limit: Limit number of embeddings.
        skip: Skip number of embeddings.
        where: Where clause.
        item_ids: Item IDs.

    Returns:
        List of embeddings.
    """
    return await get_rows_handler(
        dataset_id=dataset_id,
        group=SchemaGroup.EMBEDDING,
        table=table,
        settings=settings,
        where=where,
        ids=ids,
        item_ids=item_ids,
        limit=limit,
        skip=skip,
    )

update_embedding(dataset_id, table, id, embedding, settings) async

Update an embedding in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the embedding.

required
embedding EmbeddingModel

Embedding to update.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
EmbeddingModel

The embedding updated.

Source code in pixano/app/routers/embeddings.py
@router.put("/{dataset_id}/{table}/{id}", response_model=EmbeddingModel)
async def update_embedding(
    dataset_id: str,
    table: str,
    id: str,
    embedding: EmbeddingModel,
    settings: Annotated[Settings, Depends(get_settings)],
) -> EmbeddingModel:
    """Update an embedding in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the embedding.
        embedding: Embedding to update.
        settings: App settings.

    Returns:
        The embedding updated.
    """
    return await update_row_handler(dataset_id, SchemaGroup.EMBEDDING, table, id, embedding, settings)

update_embeddings(dataset_id, table, embeddings, settings) async

Update embeddings in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
embeddings list[EmbeddingModel]

Embeddings to update.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
list[EmbeddingModel]

List of embeddings updated.

Source code in pixano/app/routers/embeddings.py
@router.put("/{dataset_id}/{table}/", response_model=list[EmbeddingModel])
async def update_embeddings(
    dataset_id: str,
    table: str,
    embeddings: list[EmbeddingModel],
    settings: Annotated[Settings, Depends(get_settings)],
) -> list[EmbeddingModel]:
    """Update embeddings in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        embeddings: Embeddings to update.
        settings: App settings.

    Returns:
        List of embeddings updated.
    """
    return await update_rows_handler(dataset_id, SchemaGroup.EMBEDDING, table, embeddings, settings)