Learn R Programming

mLLMCelltype (version 1.3.2)

register_custom_provider: Register a custom LLM provider

Description

Register a custom LLM provider

Usage

register_custom_provider(provider_name, process_fn, description = NULL)

Value

Invisibly returns TRUE if registration is successful

Arguments

provider_name

Character string, unique identifier for the provider

process_fn

Function that processes prompts and returns responses. Must accept parameters: prompt, model, api_key

description

Optional description of the provider

Examples

Run this code
if (FALSE) {
register_custom_provider(
  provider_name = "my_provider",
  process_fn = function(prompt, model, api_key) {
    # Custom implementation
    response <- httr::POST(
      url = "your_api_endpoint",
      body = list(prompt = prompt),
      encode = "json"
    )
    return(httr::content(response)$choices[[1]]$text)
  }
)
}

Run the code above in your browser using DataLab