pub struct OpenAiChat { /* private fields */ }
Expand description
Simple OpenAI Chat model implementation.
Implementations§
Source§impl OpenAiChat
impl OpenAiChat
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the base URL (e.g., http://192.168.3.40:8000/v1)
Sourcepub fn without_auth(self) -> Self
pub fn without_auth(self) -> Self
Disable authentication for local/open endpoints.
Trait Implementations§
Source§impl Model for OpenAiChat
impl Model for OpenAiChat
Source§fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends a chat completion request to the OpenAI API.
Source§fn get_response<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
&'life0 self,
system_instructions: Option<&'life1 str>,
input: &'life2 str,
_model_settings: Option<HashMap<String, String>>,
messages: Option<&'life3 [Value]>,
tools: Option<&'life4 [Value]>,
tool_choice: Option<Value>,
_output_schema: Option<&'life5 str>,
_handoffs: Option<&'life6 [String]>,
_tracing_enabled: bool,
_previous_response_id: Option<&'life7 str>,
_prompt_config: Option<&'life8 str>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
fn get_response<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
&'life0 self,
system_instructions: Option<&'life1 str>,
input: &'life2 str,
_model_settings: Option<HashMap<String, String>>,
messages: Option<&'life3 [Value]>,
tools: Option<&'life4 [Value]>,
tool_choice: Option<Value>,
_output_schema: Option<&'life5 str>,
_handoffs: Option<&'life6 [String]>,
_tracing_enabled: bool,
_previous_response_id: Option<&'life7 str>,
_prompt_config: Option<&'life8 str>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
Rich response with basic parsing of text and tool calls.
Auto Trait Implementations§
impl Freeze for OpenAiChat
impl !RefUnwindSafe for OpenAiChat
impl Send for OpenAiChat
impl Sync for OpenAiChat
impl Unpin for OpenAiChat
impl !UnwindSafe for OpenAiChat
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