pub struct ToolSchema {
pub name: String,
pub context: Value,
pub embedding_docs: Vec<String>,
}Expand description
Tool name, serialized context, and text descriptions for embedding-based retrieval.
Fields§
§name: String§context: Value§embedding_docs: Vec<String>Implementations§
Source§impl ToolSchema
impl ToolSchema
Sourcepub fn try_from<T>(tool: &T) -> Result<Self, EmbedError>where
T: PortableToolEmbedding,
pub fn try_from<T>(tool: &T) -> Result<Self, EmbedError>where
T: PortableToolEmbedding,
Captures a tool’s name, context, and embedding descriptions. Returns an error if context serialization fails.
use rig_core::{embeddings::{ToolSchema, EmbedError}, tool::PortableToolEmbedding};
fn schema(tool: &impl PortableToolEmbedding) -> Result<ToolSchema, EmbedError> {
ToolSchema::try_from(tool)
}Trait Implementations§
Source§impl Clone for ToolSchema
impl Clone for ToolSchema
Source§impl Default for ToolSchema
impl Default for ToolSchema
Source§impl Embed for ToolSchema
impl Embed for ToolSchema
Source§fn embed(&self, embedder: &mut TextEmbedder) -> Result<(), EmbedError>
fn embed(&self, embedder: &mut TextEmbedder) -> Result<(), EmbedError>
Append all text fragments that should be embedded for this value.
impl Eq for ToolSchema
Source§impl PartialEq for ToolSchema
impl PartialEq for ToolSchema
Source§impl Serialize for ToolSchema
impl Serialize for ToolSchema
impl StructuralPartialEq for ToolSchema
Auto Trait Implementations§
impl Freeze for ToolSchema
impl RefUnwindSafe for ToolSchema
impl Send for ToolSchema
impl Sync for ToolSchema
impl Unpin for ToolSchema
impl UnsafeUnpin for ToolSchema
impl UnwindSafe for ToolSchema
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
Source§fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
Convert this value without routing structured data through a string.