microsoft/semantic-kernel · error · VectorStoreModelException

Vector property type '{field.type_}' is not supported by Azu

Error message

Vector property type '{field.type_}' is not supported by Azure Cosmos DB NoSQL.

What it means

The NoSQL vector embedding policy builder rejects vector fields whose Python type annotation (field.type_) is not in the allowed type map. Allowed types map to float32 or int32 Cosmos datatypes. The check is skipped when type_ is falsy, but any non-empty unsupported string value triggers the exception.

Source

Thrown at python/semantic_kernel/connectors/azure_cosmos_db.py:182

        definition (VectorStoreRecordDefinition): The definition of the data model.

    Returns:
        dict[str, Any]: The vector embedding policy.

    Raises:
        VectorStoreModelException: If the datatype or distance function is not supported by Azure Cosmos DB NoSQL.

    """
    vector_embedding_policy: dict[str, Any] = {"vectorEmbeddings": []}

    for field in definition.fields:
        if field.field_type == FieldTypes.VECTOR:
            if field.distance_function not in DISTANCE_FUNCTION_MAP_NOSQL:
                raise VectorStoreModelException(
                    f"Distance function '{field.distance_function}' is not supported by Azure Cosmos DB NoSQL."
                )
            if field.type_ and field.type_ not in VECTOR_DATATYPES_MAP:
                raise VectorStoreModelException(
                    f"Vector property type '{field.type_}' is not supported by Azure Cosmos DB NoSQL."
                )

            vector_embedding_policy["vectorEmbeddings"].append({
                "path": f'/"{field.storage_name or field.name}"',
                "dataType": VECTOR_DATATYPES_MAP[field.type_ or "default"],
                "distanceFunction": DISTANCE_FUNCTION_MAP_NOSQL[field.distance_function],
                "dimensions": field.dimensions,
            })

    return vector_embedding_policy


def _get_key(key: str | CosmosNoSqlCompositeKey) -> str:
    """Gets the key value from the key."""
    if isinstance(key, CosmosNoSqlCompositeKey):
        return key.key
    return key

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Annotate the vector field as list[float], list[int], float, or int so it maps to float32/int32.
  2. Remove an explicit unsupported type_ override and let it default to float32.
  3. If you need a different precision, store as float32/int32 and cast on the application side.

Example fix

// before
VectorStoreRecordVectorField(name="embedding", dimensions=1536, type="numpy.ndarray")
// after
VectorStoreRecordVectorField(name="embedding", dimensions=1536, type="list[float]")
Defensive patterns

Strategy: validation

Validate before calling

from semantic_kernel.connectors.azure_cosmos_db import VECTOR_DATATYPES_MAP

bad = [f for f in definition.vector_fields if f.type_ and f.type_ not in VECTOR_DATATYPES_MAP]
if bad:
    raise ValueError(f"Unsupported vector types: {[(f.name, f.type_) for f in bad]}")

Type guard

def is_supported_vector_type(type_: str | None) -> bool:
    return not type_ or type_ in VECTOR_DATATYPES_MAP

Prevention

When it happens

Trigger: Raised in _get_vector_embedding_policy when field.field_type == VECTOR, field.type_ is truthy, and field.type_ not in VECTOR_DATATYPES_MAP. Happens on collection creation/policy build for a vector field annotated with an unsupported type such as 'list[str]', 'numpy.ndarray', 'float16', or a custom class name.

Common situations: Annotating the vector field with a non-standard type (e.g. a numpy type, a TypedDict, a bare 'list' without parameterization). Copying a model from a connector that accepts a broader type vocabulary. Forgetting that Cosmos NoSQL only stores float32 and int32 vectors.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/eef1042490ac095f. Report an issue: GitHub.