belso.utils package
Submodules
belso.utils.classes module
- class belso.utils.classes.PROVIDERS[source]
Bases:
object
A class that provides constants for supported schema providers. This allows for more readable code when specifying providers in the translate method.
- ANTHROPIC = 'anthropic'
- AZURE_OPENAI = 'azure_openai'
- BELSO = 'belso'
- GOOGLE = 'google'
- HUGGINGFACE = 'huggingface'
- JSON = 'json'
- LANGCHAIN = 'langchain'
- MISTRAL = 'mistral'
- OLLAMA = 'ollama'
- OPENAI = 'openai'
- XML = 'xml'
belso.utils.logging module
- belso.utils.logging.configure_logger(level=20, log_file=None, log_format=None, propagate=True, handler_config=None)[source]
Configure the belso logger without affecting parent loggers.
- Return type:
None
Args
- param level:
the logging level.
- type level:
int
- param log_file:
the path to the log file.
- type log_file:
str
- param log_format:
the log format.
- type log_format:
str
- param propagate:
whether to propagate logs to parent loggers.
- type propagate:
bool
- param handler_config:
additional configuration for handlers.
- type handler_config:
Dict[str, Any]
- belso.utils.logging.get_logger(name=None)[source]
Get a logger instance for a specific module within belso.
- Return type:
Logger
Args
- param name:
the name of the module (will be prefixed with ‘belso.’).
- type name:
str
Returns
logging.Logger: the logger instance.
belso.utils.schema_helpers module
- belso.utils.schema_helpers.build_properties_dict(schema)[source]
Build a properties dictionary from a schema for JSON Schema formats.
- Return type:
Dict
[str
,Dict
[str
,Any
]]
Args
- param schema:
the schema to build the properties dictionary from.
- type schema:
Type[Schema]
Returns
Dict[str, Dict[str, Any]]: the properties dictionary.
- belso.utils.schema_helpers.create_fallback_schema()[source]
Create a standard fallback schema when conversion fails.
- Return type:
Type
[Schema
]
Returns
Type[Schema]: the fallback schema.
- belso.utils.schema_helpers.is_schema_supported(schema, provider)[source]
Check if a schema is supported by a provider.
- Return type:
bool
Args
- param schema:
the schema to check.
- type schema:
Type[Schema]
- param provider:
the provider to check against.
- type provider:
str
Returns
bool: True if the schema is supported, False otherwise.
Module contents
- class belso.utils.PROVIDERS[source]
Bases:
object
A class that provides constants for supported schema providers. This allows for more readable code when specifying providers in the translate method.
- ANTHROPIC = 'anthropic'
- AZURE_OPENAI = 'azure_openai'
- BELSO = 'belso'
- GOOGLE = 'google'
- HUGGINGFACE = 'huggingface'
- JSON = 'json'
- LANGCHAIN = 'langchain'
- MISTRAL = 'mistral'
- OLLAMA = 'ollama'
- OPENAI = 'openai'
- XML = 'xml'