Model Creation
config_path: Path to the model configuration directory (UTF-8 encoded)out: Pointer to store the created model
NULL on success, or OgaResult* containing error message on failureExample:OgaConfig object.Parameters:config: Configuration object to use for the modelout: Pointer to store the created model
NULL on success, or OgaResult* containing error message on failureconfig_path: Path to the model configuration directory (UTF-8 encoded)settings: Runtime settings to use for the modelout: Pointer to store the created model
NULL on success, or OgaResult* containing error message on failuremodel: The model to destroy
Model Properties
model: The model to queryout: Pointer to store the model type string
NULL on success, or OgaResult* containing error message on failureNote: The returned string must be destroyed with OgaDestroyString()Example:model: The model to queryout: Pointer to store the device type string
NULL on success, or OgaResult* containing error message on failureNote: The returned string must be destroyed with OgaDestroyString()Configuration Objects
OgaConfig
config_path: Path to the configuration directory (UTF-8 encoded)out: Pointer to store the created config
NULL on success, or OgaResult* containing error message on failureconfig: The config to destroy
config: The config to modifyjson: JSON string to overlay
NULL on success, or OgaResult* containing error message on failureExample:Provider Configuration
config: The config to modify
NULL on success, or OgaResult* containing error message on failureconfig: The config to modifyprovider: The provider name to add (e.g., “CPU”, “CUDA”, “DML”)
NULL on success, or OgaResult* containing error message on failureExample:config: The config to modifyprovider: The provider namekey: The option keyvalue: The option value
NULL on success, or OgaResult* containing error message on failureHardware Device Filtering
config: The config to modifyprovider: The provider namehardware_device_type: The hardware device type
NULL on success, or OgaResult* containing error message on failureconfig: The config to modifyprovider: The provider namehardware_device_id: The hardware device ID
NULL on success, or OgaResult* containing error message on failureconfig: The config to modifyprovider: The provider namehardware_vendor_id: The hardware vendor ID
NULL on success, or OgaResult* containing error message on failureModel Data from Memory
config: The config to modifymodel_filename: The name of the model file as defined in the configmodel_data: Pointer to the model data (must remain valid until model is created)model_data_length: Length of the model data in bytes
NULL on success, or OgaResult* containing error message on failureNote: The model data must remain valid at least until the model is created. If using session.use_ort_model_bytes_directly, the data must remain valid until the model is destroyed.config: The config to modifymodel_filename: The name of the model file to remove
NULL on success, or OgaResult* containing error message on failureRuntime Settings
out: Pointer to store the created runtime settings
NULL on success, or OgaResult* containing error message on failuresettings: The runtime settings to destroy
settings: The runtime settings to modifyhandle_name: The name of the handle to sethandle: Pointer to the handle value
NULL on success, or OgaResult* containing error message on failureComplete Example
See Also
C API Overview
Learn about memory management and error handling
Generator Functions
Generate text with your loaded model