AI Functions

An AI Function is a modular software component that performs machine learning or AI operations like prediction, classification, or data processing.

1. Initializing LLM Virtual Machine

llm_init_async()

Initialize the LLM virtual machine (the model loaded is LLama 3.2 3B).

Note: WebGPU support is required.

Example


await llm_init_async()
Run

2. Send a Request to LLM Virtual Machine

llm_request_async(prompt: str)

Send a request to LLM virtual machine.

Parameters:

  • prompt (str): Request prompt.

Returns:

  • A str representing the response of llm.

Example


await llm_init_async()

print(await llm_request_async("Give me info on Lecce"))
Run