AI

Entry point for the Elide AI inference API.

Provides model loading, lifecycle management, and multi-model orchestration. Accessible via the elide.ai namespace.

Module: elide.AI Support: Experimental Since: 1.1.0 Docs: Elide Docs

3 members: 3 undocumented

Methods

⚪ loadModel(modelId, options)
Load a model by HuggingFace identifier or local path.
⚪ listModels()
List all currently loaded models.
⚪ unloadModel(modelId)
Unload a specific model by identifier, freeing its resources.

Enum AIModelStatus

Lifecycle status of a loaded model.

Since: 1.1.0
ValueDescription
loading
ready
unloaded
error

Enum AIRole

Role of a message participant.

Since: 1.1.0
ValueDescription
system
user
assistant
tool

Enum AIFinishReason

Reason the model stopped generating.

Since: 1.1.0
ValueDescription
stop
length
tool_calls
content_filter
error

Enum AIContentType

Type of a content block within a message.

Since: 1.1.0
ValueDescription
text
image_url
image_base64
audio_url
audio_base64
tool_use
tool_result
thinking

Enum AIResponseFormat

Format of the model response.

Since: 1.1.0
ValueDescription
text
json_object
json_schema

Enum AIConstraintType

Constraint type for guided generation.

Since: 1.1.0
ValueDescription
none
json_schema
regex
grammar

Enum AIQuantization

Weight quantization level for model loading.

Since: 1.1.0
ValueDescription
none
q2
q3
q4
q5
q6
q8
f16
bf16
auto

Enum AIDevice

Compute device for model execution.

Since: 1.1.0
ValueDescription
auto
cpu
cuda
metal

Enum AIToolChoiceMode

Tool choice strategy.

Since: 1.1.0
ValueDescription
none
auto
required

Enum AIImageDetail

Image detail level for vision models.

Since: 1.1.0
ValueDescription
auto
low
high

Enum AIModelCategory

Category of model architecture.

Since: 1.1.0
ValueDescription
text
vision
embedding
diffusion
speech

Dictionary AIContentPart

A block of content within a message. Supports text, images, audio, tool use, and chain-of-thought reasoning.

Follows the Anthropic content-block pattern:
js
{ type: "text", text: "Hello" }
{ type: "image_url", imageUrl: { url: "https:<<>>
{ type: "image_base64", imageBase64: { mediaType: "image/png", data: "..." } }
{ type: "thinking", thinking: "Let me reason about this..." }
Since: 1.1.0

8 members: 2 supported, 6 undocumented

Properties

🟢 type
A block of content within a message. Supports text, images, audio,
🟢 text
Type of a content block within a message.
⚪ imageUrl
Image URL reference (when type = "image_url").
⚪ imageBase64
Base64-encoded image data (when type = "image_base64").
⚪ audioUrl
Audio URL reference (when type = "audio_url").
⚪ audioBase64
Base64-encoded audio data (when type = "audio_base64").
⚪ toolUse
Tool use request from the model (when type = "tool_use").
⚪ toolResult
Tool result provided by the caller (when type = "tool_result").

---

Dictionary AIImageUrl

Image URL reference (when type = "image_url").

Properties

🟢 url
Image reference by URL.
🟢 detail
Image reference by URL.

---

Dictionary AIImageBase64

Base64-encoded image data (when type = "image_base64").

2 members: 1 supported, 1 undocumented

Properties

🟢 mediaType
Image data encoded as base64.
⚪ data
Image URL reference (when type = "image_url").

---

Dictionary AIAudioUrl

Audio URL reference (when type = "audio_url").

Properties

🟢 url
Image reference by URL.
🟢 format
Audio reference by URL.

---

Dictionary AIAudioBase64

Base64-encoded audio data (when type = "audio_base64").

2 members: 1 supported, 1 undocumented

Properties

🟢 mediaType
Image data encoded as base64.
⚪ data
Image URL reference (when type = "image_url").

---

Dictionary AIToolUse

Tool use request from the model (when type = "tool_use").

3 members: 2 supported, 1 undocumented

Properties

🟢 id
Tool invocation requested by the model.
🟢 name
Tool invocation requested by the model.
⚪ input
→ string

---

Dictionary AIToolResult

Tool result provided by the caller (when type = "tool_result").

3 members: 1 supported, 2 undocumented

Properties

🟢 toolUseId
Result of a tool invocation, provided back to the model.
⚪ content
→ string
⚪ isError
→ boolean

---

Dictionary AIMessage

A single message in a conversation. Content can be either a plain string (shorthand for a single text block) or an array of content blocks for multimodal inputs.

js
// Simple text
{ role: "user", content: "Hello!" }

// Multimodal (Anthropic-style)
{ role: "user", content: [
{ type: "text", text: "What's in this image?" },
{ type: "image_url", imageUrl: { url: "https://example.com/cat.jpg" } }
]}
Since: 1.1.0

3 members: 2 supported, 1 undocumented

Properties

🟢 role
A single message in a conversation. Content can be either a plain
⚪ content
→ (string or sequence)
🟢 name
Tool invocation requested by the model.

---

Dictionary AITool

Description of a tool the model may invoke.

Since: 1.1.0

3 members: 2 supported, 1 undocumented

Properties

🟢 name
Tool invocation requested by the model.
🟢 description
Description of a tool the model may invoke.
⚪ parameters
→ object

---

Dictionary AIToolChoice

Tool selection strategy. Either a mode string or a specific tool name.

js
toolChoice: "auto"
toolChoice: { mode: "required" }
toolChoice: { name: "get_weather" }
Since: 1.1.0

2 members: 1 supported, 1 undocumented

Properties

⚪ mode
→ AIToolChoiceMode
🟢 name
Tool invocation requested by the model.

---

Dictionary AIConstraint

Constraint for guided / structured generation.

Since: 1.1.0

4 members: 1 supported, 3 undocumented

Properties

🟢 type
A block of content within a message. Supports text, images, audio,
⚪ jsonSchema
JSON Schema (when type = "json_schema").
⚪ regex
→ string
⚪ grammar
→ string

---

Dictionary AISamplingOptions

Sampling parameters that control token generation.

Since: 1.1.0

10 members: 3 supported, 7 undocumented

Properties

🟢 temperature
Sampling parameters that control token generation.
🟢 topP
Sampling parameters that control token generation.
⚪ topK
→ u32
⚪ minP
→ f64
⚪ frequencyPenalty
→ f64
⚪ presencePenalty
→ f64
⚪ repetitionPenalty
→ f64
⚪ maxTokens
→ u32
🟢 stop
Reason the model stopped generating.
⚪ seed
→ u64

---

Dictionary AIGenerateOptions

Options for a generation request.

Extends: AISamplingOptions Since: 1.1.0

11 members: 11 undocumented

Properties

⚪ systemPrompt
System prompt (applied before messages).
⚪ tools
Tools available to the model.
⚪ toolChoice
How the model should choose tools.
⚪ responseFormat
Response format constraint.
⚪ constraint
How the model should choose tools.
⚪ n
→ u32
⚪ logprobs
Whether to return log-probabilities.
⚪ topLogprobs
Number of top log-probs to return per token.
⚪ enableThinking
Enable extended thinking / chain-of-thought.
⚪ thinkingBudget
Budget for thinking tokens (0 = unlimited).
⚪ adapters
LoRA adapter names to activate for this request.

---

Dictionary AIEmbeddingOptions

Options for computing embeddings.

Since: 1.1.0

Properties

🟢 normalize
Options for computing embeddings.
🟢 dimensions
Options for computing embeddings.

---

Dictionary AIModelOptions

Options for loading a model.

Since: 1.1.0

8 members: 8 undocumented

Properties

⚪ quantization
Quantization level. "auto" selects platform-optimal format.
⚪ device
Quantization level. "auto" selects platform-optimal format.
⚪ maxSequences
Maximum number of concurrent sequences (batch size).
⚪ tokenSource
Token source for gated HuggingFace models.
⚪ category
Category hint — auto-detected when omitted.
⚪ pagedAttention
Enable paged attention for memory-efficient KV cache.
⚪ prefixCacheSize
Prefix cache size (number of sequences to cache).
⚪ adapters
LoRA adapter names to activate for this request.

---

Dictionary AIAdapterConfig

LoRA adapter paths to pre-load.

3 members: 2 supported, 1 undocumented

Properties

🟢 path
LoRA adapter configuration.
🟢 name
Tool invocation requested by the model.
⚪ weight
→ f64

---

Dictionary AICompletion

A complete model response (one or more choices).

Since: 1.1.0

4 members: 2 supported, 2 undocumented

Properties

🟢 id
Tool invocation requested by the model.
🟢 choices
A complete model response (one or more choices).
⚪ usage
→ AIUsage
⚪ model
Base64-encoded audio data (when type = "audio_base64").

---

Dictionary AIChoice

A complete model response (one or more choices).

Since: 1.1.0

4 members: 2 supported, 2 undocumented

Properties

🟢 index
A single completion choice.
🟢 message
A single completion choice.
⚪ finishReason
→ AIFinishReason
⚪ logprobs
Whether to return log-probabilities.

---

Dictionary AIResponseMessage

A single completion choice.

Since: 1.1.0

4 members: 1 supported, 3 undocumented

Properties

🟢 role
A single message in a conversation. Content can be either a plain
⚪ content
→ string
⚪ thinking
→ string
⚪ toolCalls
Tool invocations requested by the model.

---

Dictionary AITokenLogprob

3 members: 1 supported, 2 undocumented

Properties

⚪ token
Whether to return log-probabilities.
🟢 logprob
Log-probability information for a single token.
⚪ topLogprobs
Number of top log-probs to return per token.

---

Dictionary AITopLogprob

2 members: 1 supported, 1 undocumented

Properties

⚪ token
Whether to return log-probabilities.
🟢 logprob
Log-probability information for a single token.

---

Dictionary AICompletionChunk

A single chunk in a streaming response.

Since: 1.1.0

3 members: 2 supported, 1 undocumented

Properties

🟢 id
Tool invocation requested by the model.
🟢 choices
A complete model response (one or more choices).
⚪ usage
→ AIUsage

---

Dictionary AIChunkChoice

A single chunk in a streaming response.

Since: 1.1.0

3 members: 2 supported, 1 undocumented

Properties

🟢 index
A single completion choice.
🟢 delta
A streaming choice delta.
⚪ finishReason
→ AIFinishReason

---

Dictionary AIChunkDelta

A streaming choice delta.

Since: 1.1.0

4 members: 1 supported, 3 undocumented

Properties

🟢 role
A single message in a conversation. Content can be either a plain
⚪ content
→ string
⚪ thinking
→ string
⚪ toolCalls
Tool invocations requested by the model.

---

Dictionary AIUsage

6 members: 2 supported, 4 undocumented

Properties

🟢 promptTokens
Token usage statistics.
🟢 completionTokens
Token usage statistics.
⚪ totalTokens
→ u32
⚪ tokensPerSecond
→ f64
⚪ promptTokensPerSecond
→ f64
⚪ totalTimeSeconds
→ f64

---

Dictionary AIImageGenerateOptions

Options for image generation via diffusion models.

Since: 1.1.0

5 members: 1 supported, 4 undocumented

Properties

⚪ width
→ u32
🟢 height
Options for image generation via diffusion models.
⚪ steps
→ u32
⚪ guidanceScale
→ f64
⚪ seed
→ u64

---

Dictionary AIGeneratedImage

Result of an image generation request.

Since: 1.1.0

4 members: 2 supported, 2 undocumented

Properties

⚪ data
Image URL reference (when type = "image_url").
🟢 mediaType
Image data encoded as base64.
⚪ width
→ u32
🟢 height
Options for image generation via diffusion models.

---

Dictionary AISpeechOptions

Options for speech synthesis.

Since: 1.1.0

Properties

🟢 voice
Options for speech synthesis.
🟢 speed
Options for speech synthesis.
🟢 format
Audio reference by URL.

---

Dictionary AIGeneratedSpeech

Result of a speech synthesis request.

Since: 1.1.0

3 members: 1 supported, 2 undocumented

Properties

⚪ data
Image URL reference (when type = "image_url").
🟢 mediaType
Image data encoded as base64.
⚪ durationSeconds
→ f64

---

Dictionary AIModelInfo

Metadata about a loaded model.

Since: 1.1.0

6 members: 1 supported, 5 undocumented

Properties

🟢 modelId
Metadata about a loaded model.
⚪ category
Category hint — auto-detected when omitted.
⚪ status
→ AIModelStatus
⚪ parameterCount
→ u64
⚪ contextLength
→ u32
⚪ supportedAdapters
→ sequence

---

Interface AIModel

Load a model by HuggingFace identifier or local path.

Supports text, vision, embedding, diffusion, and speech models. The model category is auto-detected from the model config unless explicitly specified in options.

10 members: 1 supported, 9 undocumented

Methods

⚪ generate(messages, options)
Structured output constraint (regex, grammar, JSON schema).
⚪ stream(messages, options)
Stream completion chunks from a sequence of messages.
⚪ chat(prompt, options)
Convenience: single-turn chat. Sends one user message and
⚪ embed(inputs, options)
Compute dense vector embeddings for a batch of text inputs.
⚪ generateImage(prompt, options)
Generate an image from a text prompt using a diffusion model.
⚪ speak(text, options)
Synthesize speech from text.
⚪ destroy()
Release all resources associated with this model.

Properties

🟢 modelId
Metadata about a loaded model.
⚪ status
→ AIModelStatus
⚪ category
Category hint — auto-detected when omitted.

---