Description:
Develop a tool use system, enabling the model to interact with user-defined R functions during conversations. This should include a general way to register tools in R, potentially using an llm_tools R6 class and a define_llm_tools() function that allows users to define tools (functions, descriptions, input schemas, etc.) and store them in an llm_tools object. The llm_tools objects should then be usable as an argument for api-functions. I would try to implement this only in claude() initially.
Possible Actions:
Create an llm_tools R6 Class:
Design an R6 class, llm_tools, to store tool definitions, including function names, descriptions, and input schemas.
Implement methods for adding, updating, and removing tools.
Develop the define_llm_tools() Function:
Create a function define_llm_tools() that takes R functions, descriptions, input schemas, and other relevant parameters to register tools in an llm_tools object.
Validate tool definitions to ensure proper formats for use with the Claude API.
Integrate Tool Use with the claude() Function:
Allow claude() to accept an llm_tools object as an argument, passing the tool definitions to the API.
Modify the API request format to include tool descriptions and input schemas, as required by Claude's tool use guidelines.
Implement Tool Execution and Handling:
Add mechanisms to extract tool input from Claude's tool use requests, execute the corresponding R function, and return the results to Claude.
Handle potential errors in tool execution and provide informative feedback.
Additional Considerations:
Tool Execution Security: Ensure secure execution of user-defined functions to prevent code injection risks.
Caching and Reuse: Consider implementing caching for tool results to avoid repeated executions when appropriate.
Tool Update Functionality: Allow users to update tool descriptions or schemas without re-registering all tools.
Description:
Develop a tool use system, enabling the model to interact with user-defined R functions during conversations. This should include a general way to register tools in R, potentially using an
llm_tools
R6 class and adefine_llm_tools()
function that allows users to define tools (functions, descriptions, input schemas, etc.) and store them in anllm_tools
object. Thellm_tools
objects should then be usable as an argument for api-functions. I would try to implement this only inclaude()
initially.Possible Actions:
Create an
llm_tools
R6 Class:llm_tools
, to store tool definitions, including function names, descriptions, and input schemas.Develop the
define_llm_tools()
Function:define_llm_tools()
that takes R functions, descriptions, input schemas, and other relevant parameters to register tools in anllm_tools
object.Integrate Tool Use with the
claude()
Function:claude()
to accept anllm_tools
object as an argument, passing the tool definitions to the API.Implement Tool Execution and Handling:
Additional Considerations: