Providers
OpenAI
- belso.providers.to_openai(schema)
Converts a belso Schema to a Pydantic model.
Args
schema (
Type[Schema]): the belso schema.
Returns
Type[BaseModel]: the Pydantic model.
- belso.providers.from_openai(schema, schema_name='Schema')
Converts a Pydantic model back to a belso Schema.
Args
schema (
Type[BaseModel]): the Pydantic model.schema_name (
str): base name of the resulting belso schema.
Returns
Type[Schema]: the belso schema.
Anthropic
- belso.providers.to_anthropic(schema)
Converts a belso schema into JSON Schema format for the given provider.
Args
schema (
Type[Schema]): belso schema to convert.
Returns
Dict[str, Any]: JSON Schema representation.
- belso.providers.from_anthropic(schema, schema_name='Schema')
Converts a JSON Schema dict into a belso schema.
Args
schema (
Dict[str, Any]): JSON schema dictionary.schema_name (
str): optional name for the resulting Schema class.
Returns
Type[Schema]: reconstructed belso schema.
Google
- belso.providers.to_google(schema)[source]
Convert a belso schema to Google Gemini format.
Args
schema (
Type[Schema])
Returns
content.Schema: the converted schema.
- belso.providers.from_google(schema, schema_name='Schema')[source]
Convert a Google Gemini schema to belso format.
Args
schema (
content.Schema): the Google schema.schema_name(str, optional): the prefix to add to the schema name. Defaults to “Schema”.
Returns
Type[Schema]: the converted belso schema.
Mistral
- belso.providers.to_mistral(schema)
Converts a belso schema into JSON Schema format for the given provider.
Args
schema (
Type[Schema]): belso schema to convert.
Returns
Dict[str, Any]: JSON Schema representation.
- belso.providers.from_mistral(schema, schema_name='Schema')
Converts a JSON Schema dict into a belso schema.
Args
schema (
Dict[str, Any]): JSON schema dictionary.schema_name (
str): optional name for the resulting Schema class.
Returns
Type[Schema]: reconstructed belso schema.
Ollama
- belso.providers.to_ollama(schema)
Converts a belso schema into JSON Schema format for the given provider.
Args
schema (
Type[Schema]): belso schema to convert.
Returns
Dict[str, Any]: JSON Schema representation.
- belso.providers.from_ollama(schema, schema_name='Schema')
Converts a JSON Schema dict into a belso schema.
Args
schema (
Dict[str, Any]): JSON schema dictionary.schema_name (
str): optional name for the resulting Schema class.
Returns
Type[Schema]: reconstructed belso schema.
HuggingFace
- belso.providers.to_huggingface(schema)
Converts a belso schema into JSON Schema format for the given provider.
Args
schema (
Type[Schema]): belso schema to convert.
Returns
Dict[str, Any]: JSON Schema representation.
- belso.providers.from_huggingface(schema, schema_name='Schema')
Converts a JSON Schema dict into a belso schema.
Args
schema (
Dict[str, Any]): JSON schema dictionary.schema_name (
str): optional name for the resulting Schema class.
Returns
Type[Schema]: reconstructed belso schema.
LangChain
- belso.providers.to_langchain(schema)
Converts a belso Schema to a Pydantic model.
Args
schema (
Type[Schema]): the belso schema.
Returns
Type[BaseModel]: the Pydantic model.
- belso.providers.from_langchain(schema, schema_name='Schema')
Converts a Pydantic model back to a belso Schema.
Args
schema (
Type[BaseModel]): the Pydantic model.schema_name (
str): base name of the resulting belso schema.
Returns
Type[Schema]: the belso schema.