pub struct OpenAiToolRegistry { /* private fields */ }Expand description
Collection of OpenAiTool entries keyed by OpenAI tool name.
Implementations§
Source§impl OpenAiToolRegistry
impl OpenAiToolRegistry
Sourcepub fn from_request(object: &Map<String, Value>) -> Result<Self>
pub fn from_request(object: &Map<String, Value>) -> Result<Self>
Builds a registry from the tools array of an OpenAI request object;
a missing or null tools field yields an empty registry.
Sourcepub fn insert(&mut self, tool: OpenAiTool) -> Result<()>
pub fn insert(&mut self, tool: OpenAiTool) -> Result<()>
Inserts a tool, erroring if its OpenAI name is already registered.
Sourcepub fn get(&self, name: &str) -> Option<&OpenAiTool>
pub fn get(&self, name: &str) -> Option<&OpenAiTool>
Looks up a tool by its OpenAI name.
Sourcepub fn descriptor_json(&self) -> Value
pub fn descriptor_json(&self) -> Value
Renders the registry as a JSON array of OpenAI tool descriptors.
Trait Implementations§
Source§impl Clone for OpenAiToolRegistry
impl Clone for OpenAiToolRegistry
Source§fn clone(&self) -> OpenAiToolRegistry
fn clone(&self) -> OpenAiToolRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 OpenAiToolRegistry
impl Debug for OpenAiToolRegistry
Source§impl Default for OpenAiToolRegistry
impl Default for OpenAiToolRegistry
Source§fn default() -> OpenAiToolRegistry
fn default() -> OpenAiToolRegistry
Returns the “default value” for a type. Read more
Source§impl PartialEq for OpenAiToolRegistry
impl PartialEq for OpenAiToolRegistry
Source§fn eq(&self, other: &OpenAiToolRegistry) -> bool
fn eq(&self, other: &OpenAiToolRegistry) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OpenAiToolRegistry
Auto Trait Implementations§
impl Freeze for OpenAiToolRegistry
impl RefUnwindSafe for OpenAiToolRegistry
impl Send for OpenAiToolRegistry
impl Sync for OpenAiToolRegistry
impl Unpin for OpenAiToolRegistry
impl UnsafeUnpin for OpenAiToolRegistry
impl UnwindSafe for OpenAiToolRegistry
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