Utilities

Constants

FORMATS

class belso.utils.FORMATS[source]

Bases: object

A class that provides constants for supported schema providers. This allows for more readable code when specifying providers in the convert method.

ANTHROPIC = 'anthropic'
BELSO = 'belso'
GOOGLE = 'google'
HUGGINGFACE = 'huggingface'
JSON = 'json'
LANGCHAIN = 'langchain'
MISTRAL = 'mistral'
OLLAMA = 'ollama'
OPENAI = 'openai'
XML = 'xml'
YAML = 'yaml'
classmethod get_all_formats()[source]

Get a list of all supported providers.

Returns

  • list: a list of all provider constants.

Logging

belso.utils.get_logger(name=None)[source]

Get a logger instance for a specific module within belso.

Args

  • name (str): the name of the module (will be prefixed with ‘belso.’).

Returns

  • logging.Logger: the logger instance.

belso.utils.configure_logger(level=20, log_file=None, log_format=None, propagate=True, handler_config=None)[source]

Configure the belso logger without affecting parent loggers.

Args

  • level (int): the logging level. Defaults to logging.INFO.

  • log_file (Optional[str]): the path to the log file. Defaults to None.

  • log_format (Optional[str]): the log format. Defaults to None.

  • propagate (bool): whether to propagate logs to parent loggers. Defaults to true.

  • handler_config (Optional[Dict[str, Any]]): additional configuration for handlers. Defaults to None.