pub struct OpenApiToolset { /* private fields */ }Expand description
A set of tools generated from an OpenAPI specification.
Each operation in the spec becomes a tool that can be registered with a rig agent. The toolset is designed to be parsed once and reused across requests.
Implementations§
Source§impl OpenApiToolset
impl OpenApiToolset
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Parse an OpenAPI spec from a YAML or JSON file.
Sourcepub fn from_spec_str(spec_str: &str) -> Result<Self>
pub fn from_spec_str(spec_str: &str) -> Result<Self>
Parse an OpenAPI spec from a YAML or JSON string.
Sourcepub fn builder(spec_str: &str) -> OpenApiToolsetBuilder
pub fn builder(spec_str: &str) -> OpenApiToolsetBuilder
Start building a toolset from a YAML or JSON string with configuration options.
Sourcepub fn builder_from_file(
path: impl AsRef<Path>,
) -> Result<OpenApiToolsetBuilder>
pub fn builder_from_file( path: impl AsRef<Path>, ) -> Result<OpenApiToolsetBuilder>
Start building a toolset from a file with configuration options.
Sourcepub fn into_tools(self) -> Vec<Box<dyn ToolDyn>>
pub fn into_tools(self) -> Vec<Box<dyn ToolDyn>>
Consume the toolset and return tools for use with rig’s AgentBuilder::tools().
Sourcepub fn tools_with_context(
&self,
context: &HashMap<String, String>,
) -> Vec<Box<dyn ToolDyn>>
pub fn tools_with_context( &self, context: &HashMap<String, String>, ) -> Vec<Box<dyn ToolDyn>>
Clone the tools with per-request context injected as hidden parameters. The LLM will not see these parameters in tool schemas, but they will be auto-injected into every tool call at execution time.
This is the primary way to add per-request state (user ID, session info, etc.) while reusing the parsed toolset across requests.