Classes
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. |
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. |
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. |
When all retry attempts fail or the response is invalid.
Error
Parsed LLM response.
Promise.<IAssistantBaseFormat>