Skip to main content

authorize_tool_call

Function authorize_tool_call 

Source
pub async fn authorize_tool_call<Tool>(
    conn: &mut PgConnection,
    user_context: &ChatbotTurnContext,
    requirements: &[ToolRequirement],
) -> ChatbotResult<Option<ToolAuthorization<Tool>>>
Expand description

Proof that the caller may make this call of Tool, or None when they may not.

requirements are the ones the call’s own arguments produce, not the ones the turn was offered under: the target is chosen by the model, so it is the target that has to be authorized. None also covers a caller who is not logged in, since whatever runs behind this proof records an actor and an anonymous caller is nobody.