pub trait ChatbotTool {
type State;
type Arguments: Serialize;
// Required methods
fn parse_arguments(args_string: String) -> ChatbotResult<Self::Arguments>;
fn from_db_and_arguments(
conn: &mut PgConnection,
arguments: Self::Arguments,
user_context: &ChatbotUserContext,
) -> impl Future<Output = ChatbotResult<Self>> + Send
where Self: Sized;
fn output(&self) -> String;
fn output_description_instructions(&self) -> Option<String>;
fn get_arguments(&self) -> &Self::Arguments;
fn get_tool_definition() -> AzureLLMToolDefinition;
// Provided methods
fn get_tool_output(&self) -> String { ... }
fn new(
conn: &mut PgConnection,
args_string: String,
user_context: &ChatbotUserContext,
) -> impl Future<Output = ChatbotResult<Self>> + Send
where Self: Sized { ... }
}Required Associated Types§
Required Methods§
Sourcefn parse_arguments(args_string: String) -> ChatbotResult<Self::Arguments>
fn parse_arguments(args_string: String) -> ChatbotResult<Self::Arguments>
Parse the LLM-generated function arguments and clean them
Sourcefn from_db_and_arguments(
conn: &mut PgConnection,
arguments: Self::Arguments,
user_context: &ChatbotUserContext,
) -> impl Future<Output = ChatbotResult<Self>> + Sendwhere
Self: Sized,
fn from_db_and_arguments(
conn: &mut PgConnection,
arguments: Self::Arguments,
user_context: &ChatbotUserContext,
) -> impl Future<Output = ChatbotResult<Self>> + Sendwhere
Self: Sized,
Create a new instance after parsing arguments
Sourcefn output_description_instructions(&self) -> Option<String>
fn output_description_instructions(&self) -> Option<String>
Additional instructions for the LLM on how to describe and communicate the tool output. Just-in-time prompt.
Sourcefn get_arguments(&self) -> &Self::Arguments
fn get_arguments(&self) -> &Self::Arguments
Get parsed arguments
Sourcefn get_tool_definition() -> AzureLLMToolDefinition
fn get_tool_definition() -> AzureLLMToolDefinition
Get a AzureLLMToolDefinition struct that represents this tool. The definition is sent to the LLM as part of a chat request.
Provided Methods§
Sourcefn get_tool_output(&self) -> String
fn get_tool_output(&self) -> String
Get and format tool output and instructions for LLM
Sourcefn new(
conn: &mut PgConnection,
args_string: String,
user_context: &ChatbotUserContext,
) -> impl Future<Output = ChatbotResult<Self>> + Sendwhere
Self: Sized,
fn new(
conn: &mut PgConnection,
args_string: String,
user_context: &ChatbotUserContext,
) -> impl Future<Output = ChatbotResult<Self>> + Sendwhere
Self: Sized,
Create a new instance from connection, args and context
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.