def validate_request()

in aidial_adapter_vertexai/embedding/text.py [0:0]


def validate_request(spec: ModelSpec, request: EmbeddingsRequest) -> None:
    if not spec.supports_dimensions and request.dimensions:
        raise ValidationError("Dimensions parameter is not supported")

    if request.custom_fields is not None:
        if (
            not spec.supports_instr
            and request.custom_fields.instruction is not None
        ):
            raise ValidationError("Instruction prompt is not supported")

        if not spec.supports_type and request.custom_fields.type is not None:
            raise ValidationError(
                "The embedding model does not support embedding types"
            )