Struct llm_chain::tools::ToolCollection
source · pub struct ToolCollection { /* private fields */ }
Implementations§
source§impl ToolCollection
impl ToolCollection
pub fn new() -> Self
pub fn add_tool<T: Tool + 'static>(&mut self, tool: T)
pub fn invoke(&self, name: &str, input: &Value) -> Result<Value, ToolUseError>
sourcepub fn process_chat_input(&self, data: &str) -> Result<String, ToolUseError>
pub fn process_chat_input(&self, data: &str) -> Result<String, ToolUseError>
Process chat input and execute the appropriate tool.
The input string should contain a YAML block describing the tool invocation.
The YAML block should have a command
field and an input
field.
Errors
Returns an OpaqueError
variant if the input is not a valid YAML or
if the specified tool is not found.
sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
Generate a YAML-formatted string describing the available tools.
sourcepub fn to_prompt_template(&self) -> PromptTemplate
pub fn to_prompt_template(&self) -> PromptTemplate
Generate a prompt template for the tool collection. Combine it with a normal prompt template to perform your task.
Trait Implementations§
source§impl Default for ToolCollection
impl Default for ToolCollection
source§fn default() -> ToolCollection
fn default() -> ToolCollection
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ToolCollection
impl !Send for ToolCollection
impl !Sync for ToolCollection
impl Unpin for ToolCollection
impl !UnwindSafe for ToolCollection
Blanket Implementations§
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request