Types
TypeScript type definitions for all frontend AI operations.
The Umbraco.AI frontend exports TypeScript types for type-safe AI integration across chat, embeddings, speech-to-text, decisions, extraction, and tools.
Import
import type {
UaiChatRole,
UaiChatMessage,
UaiChatUsage,
UaiChatResult,
UaiChatStreamChunk,
UaiChatOptions,
UaiChatRequest,
UaiEmbeddingOptions,
UaiEmbeddingResult,
UaiEmbeddingItem,
UaiSpeechToTextOptions,
UaiSpeechToTextResult,
UaiDecisionQuestion,
UaiDecisionResult,
UaiDecisionOptions,
UaiExtractionRequest,
UaiExtractionResult,
UaiExtractionOptions,
UaiToolScope,
UaiToolItem,
} from "@umbraco-ai/core";Message Types
UaiChatRole
The role of a message participant.
'user'
Message from the user
'assistant'
Message from the AI
'system'
System instructions
UaiChatMessage
Represents a single message in the conversation.
Response Types
UaiChatUsage
Token usage statistics from a completion.
UaiChatResult
The result of a chat completion.
UaiChatStreamChunk
A chunk from a streaming response.
Request Types
UaiChatOptions
Options for the UaiChatController methods.
UaiChatRequest
Internal request type used by UaiChatRepository.
Finish Reasons
Common values for finishReason:
'stop'
Model finished naturally
'length'
Hit max tokens limit
'content_filter'
Content was filtered
null
Reason not provided
Type Guards
Building Conversations
Embedding Types
UaiEmbeddingOptions
Options for the UaiEmbeddingsController methods.
UaiEmbeddingResult
The result of a batch embedding generation.
UaiEmbeddingItem
A single embedding vector with its index in the batch.
Speech-to-Text Types
UaiSpeechToTextOptions
Options for the UaiSpeechToTextController.transcribe method.
UaiSpeechToTextResult
The result of a speech-to-text transcription.
Decision Types
Types used by the Decision Controller. The kind property discriminates both the question and its matching result.
UaiDecisionQuestion
A union of the three question types.
UaiDecisionResult
A union of the three result types. Each result has the same kind as its question. confidence is only reported for choice and score results, and is left out when the provider does not report one.
UaiDecisionOptions
Options for the UaiDecisionController.ask method.
Extraction Types
Types used by the Extraction Controller. The kind property discriminates both the field and its matching answer.
UaiExtractionRequest
The text to read, and the fields to extract from it.
UaiExtractionResult
The answers, keyed by field id, plus the model and usage for the whole call.
UaiExtractionOptions
Options for the UaiExtractionController.extract method.
Tool Types
UaiToolScope
Represents a tool scope that groups related tools.
UaiToolItem
Represents a single AI tool.
Last updated
Was this helpful?