Overview
These types are used throughout the Dedalus SDK for request and response payloads.
Import
from dedalus_labs.types import (
Credential,
DedalusModel,
DedalusModelChoice,
FunctionDefinition,
JSONObjectInput,
JSONValueInput,
MCPCredentials,
MCPServerSpec,
MCPServers,
MCPToolResult,
ModelSettings,
Reasoning,
ResponseFormatJSONObject,
ResponseFormatJSONSchema,
ResponseFormatText,
ToolChoice,
VoiceIDsOrCustomVoice,
)
Type Definitions
DedalusModel
Structured model selection entry used in request payloads. Supports OpenAI-style semantics while enabling optional per-model default settings for Dedalus multi-model routing.
class DedalusModel(TypedDict):
model: str # Required
settings: Optional[ModelSettings]
Model identifier with provider prefix (e.g., openai/gpt-4, anthropic/claude-3-5-sonnet).
Optional default generation settings (e.g., temperature, max_tokens) applied when this model is selected.
ModelSettings
Default generation parameters for a specific model.
class ModelSettings(TypedDict):
temperature: Optional[float]
max_tokens: Optional[int]
top_p: Optional[float]
top_k: Optional[int]
frequency_penalty: Optional[float]
presence_penalty: Optional[float]
# ... and other model parameters
DedalusModelChoice
Union type for model specification.
DedalusModelChoice = Union[str, DedalusModel]
Can be:
- A string model ID:
"openai/gpt-4"
- A DedalusModel object with settings
FunctionDefinition
Defines a function that can be called by the model.
class FunctionDefinition(TypedDict):
name: str # Required
description: Optional[str]
parameters: Optional[Dict[str, Any]]
strict: Optional[bool]
Function description for the model.
JSON Schema describing the function parameters.
Enable strict schema adherence.
Controls which tools the model can call.
ToolChoice = Union[
Literal["auto", "none", "required"],
Dict[str, Any] # Specific tool selection
]
Options:
"auto": Model decides whether to call tools
"none": Model will not call any tools
"required": Model must call at least one tool
- Object: Specify a particular tool to call
ResponseFormatText
Text response format.
class ResponseFormatText(TypedDict):
type: Literal["text"] # Required
JSON object response format.
class ResponseFormatJSONObject(TypedDict):
type: Literal["json_object"] # Required
Structured JSON response with schema validation.
class ResponseFormatJSONSchema(TypedDict):
type: Literal["json_schema"] # Required
json_schema: Dict[str, Any] # Required
strict: Optional[bool]
JSON Schema definition for the response structure.
Enable strict schema validation.
MCPServerSpec
Specification for an MCP (Model Context Protocol) server.
class MCPServerSpec(TypedDict):
slug: Optional[str]
url: Optional[str]
config: Optional[Dict[str, Any]]
Server slug for known MCP servers (e.g., "filesystem", "github").
Additional server configuration.
MCPServers
Flexible type for specifying MCP servers.
MCPServers = Union[
str, # Single slug or URL
MCPServerSpec, # Server specification
List[Union[str, MCPServerSpec]], # Multiple servers
]
MCPCredentials
Credentials for MCP server authentication.
class MCPCredentials(TypedDict):
server: str # Required
credentials: Dict[str, str] # Required
Result from an MCP tool execution.
class MCPToolResult(BaseModel):
tool_name: str
result: Any
error: Optional[str]
Name of the MCP tool that was executed.
Result returned by the tool.
Error message if the tool execution failed.
Credential
Generic credential specification.
class Credential(TypedDict):
type: str # Required
value: str # Required
Reasoning
Reasoning/thinking configuration.
class Reasoning(TypedDict):
enabled: bool # Required
budget_tokens: Optional[int]
Enable extended reasoning.
Token budget for reasoning.
Any valid JSON value.
JSONValueInput = Union[
str,
int,
float,
bool,
None,
Dict[str, "JSONValueInput"],
List["JSONValueInput"],
]
JSON object type.
JSONObjectInput = Dict[str, JSONValueInput]
VoiceIDsOrCustomVoice
Voice selection for audio generation.
VoiceIDsOrCustomVoice = Union[
Literal["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse"],
Dict[str, Any] # Custom voice configuration
]
Usage Examples
Using DedalusModel
from dedalus_labs.types import DedalusModel
# Simple string model
model = "openai/gpt-4"
# Model with settings
model_with_settings: DedalusModel = {
"model": "openai/gpt-4",
"settings": {
"temperature": 0.7,
"max_tokens": 1000
}
}
# Auto mode
tool_choice = "auto"
# Force specific tool
tool_choice = {
"type": "function",
"function": {"name": "get_weather"}
}
# JSON object
response_format = {"type": "json_object"}
# JSON schema with validation
response_format = {
"type": "json_schema",
"json_schema": {
"name": "UserProfile",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
},
"required": ["name"]
}
},
"strict": True
}