LLM Tool Extension

Creating AsyncLLMToolBaseExtension by using nman

Execute the following command:

tman install extension default_async_llm_tool_extension_python --template-mode --template-data package_name=llm_tool_extension --template-data class_name_prefix=LLMToolExtension

Abstract APIs to implement

get_tool_metadata(self, nyra_env: NyraEnv) -> list[LLMToolMetadata]

This method is invoked when the LLM Extension prepares to register itself with a connected LLM. It is expected to return a list of LLMToolMetadata objects.

run_tool(self, nyra_env: AsyncNyraEnv, name: str, args: dict) -> LLMToolResult

This method is triggered when the LLM Extension processes a tool call request. It is responsible for executing the corresponding tool function and returning the resulting output.

APIs

cmd_out: tool_register

This API facilitates the transmission of tool registration requests. It outputs an array of LLMToolMetadata, as retrieved from the get_tool_metadata method, to complete the registration process.

cmd_in: tool_register

This API processes tool call requests by invoking the run_toolmethod upon receipt of the cmd_in command.

Last updated