Class

AIProcessor

AIProcessor()

Utility wrapper around different LLM providers used by the platform.

Constructor

# new AIProcessor()

Instantiate provider SDK clients from configuration.

View Source helpers/ai_processor.js, line 10

Classes

AIProcessor

Methods

# async createReplicateCompletionWithTimeout(model, prompt, response_format, timeoutMs) → {Promise.<IAssistantBaseFormat>}

Creates a chat completion request to Replicate with a timeout.

Parameters:
Name Type Description
model string

Name of the LLM model to use for completion.

prompt string

Prompt sent to the LLM.

response_format Record.<string, unknown>

Expected JSON shape of the response.

timeoutMs number

Maximum time in milliseconds before the request is aborted.

View Source helpers/ai_processor.js, line 79

When the request fails, parsing fails, or the timeout elapses.

Error

Parsed LLM response.

Promise.<IAssistantBaseFormat>

# async createTogetherCompletionWithTimeout(model, prompt, response_format, timeoutMs) → {Promise.<IAssistantBaseFormat>}

Creates a chat completion request to TogetherAI with a timeout.

Parameters:
Name Type Description
model string

Name of the LLM model to use for completion.

prompt string

Prompt sent to the LLM.

response_format Record.<string, unknown>

Expected JSON shape of the response.

timeoutMs number

Maximum time in milliseconds before the request is aborted.

View Source helpers/ai_processor.js, line 38

When the request fails, parsing fails, or the timeout elapses.

Error

Parsed LLM response.

Promise.<IAssistantBaseFormat>

# async fetchLLMResponse(messages, responseFormat, llmModel, retry) → {Promise.<IAssistantBaseFormat>}

Send a request to a configured LLM provider and retrieve the parsed response.

Parameters:
Name Type Default Description
messages string

Prompt or conversation payload sent to the LLM.

responseFormat Record.<string, unknown>

Expected JSON shape of the response.

llmModel string | null | undefined

Optional LLM model override.

retry number 0

Number of the current retry attempt.

View Source helpers/ai_processor.js, line 126

When all retry attempts fail or the response is invalid.

Error

Parsed LLM response.

Promise.<IAssistantBaseFormat>