pub struct RegisteredProvider {
pub provider_id: String,
pub base_url: String,
pub api_style: String,
pub request_fn: ProviderRequestFn,
pub plugin_free_string: FreeStringFn,
pub user_data: *mut c_void,
}Expand description
A registered custom provider (B5c). The host wraps request_fn in a
PluggableProvider impl of rpi_ai::Provider;
its stream_simple drives request_fn on spawn_blocking (the sync fn
can’t own a chunked stream), reads the plugin-owned out JSON (a full
assistant message), reclaims it via plugin_free_string, parses it to an
AssistantMessage, and emits it as one
terminal Done chunk (v1 one-shot, documented divergence from pi’s async
streaming). provider_id/base_url/api_style carry the provider’s
identity (copied from the borrowed StbStringRefs at registration); the fn
pointers + user_data live as long as the plugin (keepalive-mapped).
user_data is the plugin’s opaque context, passed back on every
request_fn call.
SAFETY: the plugin warrants request_fn is callable from any thread (the
host calls it from a spawn_blocking pool thread) and user_data is valid
for the plugin’s lifetime; the host never frees user_data.
Fields§
§provider_id: String§base_url: String§api_style: String§request_fn: ProviderRequestFn§plugin_free_string: FreeStringFn§user_data: *mut c_void