Skip to main content

Document Interfaces

IAIDocument

Document interface from the AI Providers SDK for RAG operations.
src/interfaces.ts
This interface is defined in the @obsidian-ai-providers/sdk package. It represents a document chunk used in retrieval-augmented generation (RAG).

Reference Interfaces

FileReference

Represents a file in the vault for the action palette file picker.
src/interfaces.ts
string
required
Full path to the file in the vaultExample: "folder/note.md"
string
required
File name without extensionExample: "note"
string
required
File extensionExample: "md" or "pdf"

CommandReference

Represents an Obsidian command.
src/interfaces.ts
string
required
Command name/ID
string
required
Human-readable command description

ProviderReference

Represents an AI provider for selection in the action palette.
src/interfaces.ts
string
required
Unique provider ID
string
required
Model name or display name
string
required
Provider service name (e.g., “Ollama”, “OpenAI”)
string
Optional URL to the provider service

ModelReference

Represents a specific AI model.
src/interfaces.ts
string
required
Model ID used by the providerExample: "llama3.2:latest"
string
required
Display name for the modelExample: "Llama 3.2"

CreativityReference

Represents a creativity level option.
src/interfaces.ts
string
required
Creativity level keyValues: "", "low", "medium", "high"
string
required
Localized display name for the creativity level

SystemPromptReference

Represents a reusable system prompt from actions.
src/interfaces.ts
string
required
Action name that provides this system prompt
string
required
The system prompt text

Token and Event Interfaces

TextToken

Represents a parsed token from user input in the action palette.
src/interfaces.ts
'text' | 'file' | 'command'
required
Type of token parsed from input
string
required
Raw content of the token
number
required
Start position in the input string
number
required
End position in the input string
string
Resolved file path (when type is "file")
string
Command name (when type is "command")

ActionPaletteSubmitEvent

Event data when the action palette is submitted.
src/interfaces.ts
string
required
User input text/prompt
string[]
required
Array of file paths selected for context
string
Optional system prompt selected from action templates

Callback Types

Function signatures for action palette callbacks.
src/interfaces.ts

GetFilesCallback

Returns available files for selection.

GetProvidersCallback

Returns available AI providers.

OnProviderChangeCallback

Called when user changes the selected provider.

GetModelsCallback

Returns available models for a given provider.

OnModelChangeCallback

Called when user changes the selected model.

OnCreativityChangeCallback

Called when user changes the creativity level.

GetSystemPromptsCallback

Returns available system prompts from actions.

Usage Example

These interfaces are used throughout the action palette implementation in src/main.ts:240-322:
These interfaces enable extensibility and type safety throughout the plugin. Use them when extending Local GPT with custom features or integrations.