pub struct InvocableSpec {
pub name: CapabilityName,
pub description: String,
pub input_schema: Value,
pub metadata: MetadataMap,
}Expand description
Describes an Invocable capability so it can be advertised to the model.
The spec is presented to the model alongside other available tools so that
it can decide when to call the capability. The input_schema field should
be a valid JSON Schema object describing the expected input shape.
§Example
use agentkit_capabilities::{CapabilityName, InvocableSpec};
use serde_json::json;
let spec = InvocableSpec::new(
CapabilityName::new("search"),
"Search the codebase for a pattern",
json!({
"type": "object",
"properties": {
"query": { "type": "string" }
},
"required": ["query"]
}),
);
assert_eq!(spec.name.as_str(), "search");Fields§
§name: CapabilityNameThe capability name that the model uses to reference this invocable.
description: StringA human-readable description shown to the model so it can decide when to invoke this capability.
input_schema: ValueA JSON Schema describing the expected shape of
InvocableRequest::input.
metadata: MetadataMapArbitrary key-value metadata attached to the spec.
Implementations§
Source§impl InvocableSpec
impl InvocableSpec
Sourcepub fn new(
name: impl Into<CapabilityName>,
description: impl Into<String>,
input_schema: Value,
) -> Self
pub fn new( name: impl Into<CapabilityName>, description: impl Into<String>, input_schema: Value, ) -> Self
Builds an invocable spec with empty metadata.
Sourcepub fn with_metadata(self, metadata: MetadataMap) -> Self
pub fn with_metadata(self, metadata: MetadataMap) -> Self
Replaces the spec metadata.
Trait Implementations§
Source§impl Clone for InvocableSpec
impl Clone for InvocableSpec
Source§fn clone(&self) -> InvocableSpec
fn clone(&self) -> InvocableSpec
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 InvocableSpec
impl Debug for InvocableSpec
Source§impl<'de> Deserialize<'de> for InvocableSpec
impl<'de> Deserialize<'de> for InvocableSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for InvocableSpec
impl PartialEq for InvocableSpec
Source§impl Serialize for InvocableSpec
impl Serialize for InvocableSpec
impl StructuralPartialEq for InvocableSpec
Auto Trait Implementations§
impl Freeze for InvocableSpec
impl RefUnwindSafe for InvocableSpec
impl Send for InvocableSpec
impl Sync for InvocableSpec
impl Unpin for InvocableSpec
impl UnsafeUnpin for InvocableSpec
impl UnwindSafe for InvocableSpec
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