LLM Extension
Creating AsyncLLMBaseExtension by using nman
Run this following command:
tman install extension default_async_llm_extension_python --template-mode --template-data package_name=llm_extension --template-data class_name_prefix=LLMExtensionAbstract APIs to implement
on_data_chat_completion(self, nyra_env: NyraEnv, **kargs: LLMDataCompletionArgs) -> NoneThis method is invoked when the LLM Extension processes a data completion request, specifically in scenarios where data is transmitted using the data protocol in streaming mode.
on_call_chat_completion(self, nyra_env: NyraEnv, **kargs: LLMCallCompletionArgs) -> anyThis method is triggered when the LLM Extension processes a call completion request, applicable in scenarios where data is transmitted using the call protocol in non-streaming mode.
on_tools_update(self, nyra_env: NyraEnv, tool: LLMToolMetadata) -> NoneThis method is called when the LLM Extension receives a tool update request.
APIs
cmd_in: tool_register
tool_registerThis API facilitates the handling of tool registration requests. It accepts an array of LLMToolMetadata objects as input, which are subsequently appended toself.available_tools, ensuring their availability for future operations.
cmd_out: tool_call
tool_callThis API is utilized to dispatch tool call requests. It can be integrated with any designated LLMTool Extension endpoint to retrieve the corresponding tool call results.
Last updated