Skip to content

Helpers

Helpers

any_llm.verify_kwargs(provider_name, **kwargs)

Check if the provider supports the kwargs.

For example, if the provider does not yet support streaming, it will raise an error.

This does not verify that the provider supports the model or that the model supports the kwargs. In order to determine that info you will need to refer to the provider documentation.

Parameters:

Name Type Description Default
provider_name str

The name of the provider to check

required
**kwargs Any

The kwargs to check

{}

Returns:

Type Description
None

None

Raises:

Type Description
UnsupportedParameterError

If the provider does not support the kwargs.

Source code in src/any_llm/api.py
def verify_kwargs(provider_name: str, **kwargs: Any) -> None:
    """Check if the provider supports the kwargs.

    For example, if the provider does not yet support streaming, it will raise an error.

    This does not verify that the provider supports the model or that the model supports the kwargs.
    In order to determine that info you will need to refer to the provider documentation.

    Args:
        provider_name: The name of the provider to check
        **kwargs: The kwargs to check

    Returns:
        None

    Raises:
        UnsupportedParameterError: If the provider does not support the kwargs.
    """
    provider_key = ProviderFactory.get_provider_enum(provider_name)
    provider = ProviderFactory.create_provider(provider_key, ApiConfig())
    provider.verify_kwargs(kwargs)