pub struct OpenAIProvider { /* private fields */ }Expand description
OpenAI provider for Chat Completions API
Converts Composio tools to OpenAI’s ChatCompletionToolParam format. Supports optional strict schema validation.
§Example
use composio_sdk::{ComposioClient, providers::OpenAIProvider};
// Default provider (no strict validation)
let provider = OpenAIProvider::new();
// With strict validation enabled
let provider = OpenAIProvider::new().with_strict(true);
let client = ComposioClient::with_provider(provider)
.api_key("your_key")
.build()?;Implementations§
Source§impl OpenAIProvider
impl OpenAIProvider
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new OpenAI provider with default settings
§Example
use composio_sdk::providers::OpenAIProvider;
let provider = OpenAIProvider::new();Sourcepub fn with_strict(self, strict: bool) -> Self
pub fn with_strict(self, strict: bool) -> Self
Enable or disable strict schema validation
When enabled, OpenAI will enforce strict schema validation on tool calls. This is an OpenAI-specific feature that ensures tool calls match the schema exactly.
§Arguments
strict- Whether to enable strict validation
§Example
use composio_sdk::providers::OpenAIProvider;
let provider = OpenAIProvider::new().with_strict(true);Trait Implementations§
Source§impl Clone for OpenAIProvider
impl Clone for OpenAIProvider
Source§fn clone(&self) -> OpenAIProvider
fn clone(&self) -> OpenAIProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenAIProvider
impl Debug for OpenAIProvider
Source§impl Default for OpenAIProvider
impl Default for OpenAIProvider
Source§impl Provider for OpenAIProvider
impl Provider for OpenAIProvider
Source§type Tool = ChatCompletionToolParam
type Tool = ChatCompletionToolParam
The individual tool type for this provider
Source§type ToolCollection = Vec<ChatCompletionToolParam>
type ToolCollection = Vec<ChatCompletionToolParam>
The collection type returned by wrap_tools
Source§fn wrap_tool(&self, tool: &ToolSchema) -> Self::Tool
fn wrap_tool(&self, tool: &ToolSchema) -> Self::Tool
Convert a single Composio tool to the provider’s format Read more
Source§fn wrap_tools(&self, tools: Vec<ToolSchema>) -> Self::ToolCollection
fn wrap_tools(&self, tools: Vec<ToolSchema>) -> Self::ToolCollection
Convert multiple Composio tools to the provider’s format Read more
Auto Trait Implementations§
impl Freeze for OpenAIProvider
impl RefUnwindSafe for OpenAIProvider
impl Send for OpenAIProvider
impl Sync for OpenAIProvider
impl Unpin for OpenAIProvider
impl UnsafeUnpin for OpenAIProvider
impl UnwindSafe for OpenAIProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more