venice_ai.utils.models
Model filtering and ID building helpers.
Exports:
* :func:get_filtered_models — filter a list of models by capabilities
* :func:_apply_model_filters — internal filter implementation
* :func:build_model_id — construct a Venice model ID with feature suffixes
get_filtered_models
def get_filtered_models(models: Sequence[ModelDetails],
model_type: str | None = None,
supports_vision: bool | None = None,
supports_reasoning: bool | None = None,
supports_function_calling: bool | None = None,
supports_web_search: bool | None = None,
supports_log_probs: bool | None = None,
optimized_for_code: bool | None = None,
quantization: str | None = None,
is_beta: bool | None = None,
has_trait: str | None = None) -> list[ModelDetails]
Filters a list of models based on various capabilities.
Arguments:
models: A list of model details objects to filter.model_type: Optional. Filter for model type.supports_vision: Optional. Filter by vision support.supports_reasoning: Optional. Filter by reasoning support.supports_function_calling: Optional. Filter by function calling support.supports_web_search: Optional. Filter by web search support.supports_log_probs: Optional. Filter by log probability support.optimized_for_code: Optional. Filter by code optimization.quantization: Optional. Filter by quantization type (e.g., "fp16", "fp8").is_beta: Optional. Filter by beta status.has_trait: Optional. Filter by a specific model trait.
Returns:
A new list of model details objects that match the filters.
build_model_id
def build_model_id(model: str, **params: str | int | float | bool) -> str
Build a Venice model ID with feature suffixes.
The Venice API supports model feature suffixes in the format:
model_id:param=value¶m2=value2
Arguments:
model: Base model ID (e.g.,"llama-3.3-70b").**params: Feature parameters (e.g.,reasoning_effort="high").
Raises:
ValueError: If model is empty or contains a':'character (i.e., it already has a suffix).
Returns:
Model ID with feature suffix, or just the base model ID if no params are provided.