Skip to main content

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
string
required
Model identifier with provider prefix (e.g., openai/gpt-4, anthropic/claude-3-5-sonnet).
settings
ModelSettings
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]
name
string
required
Function name.
description
string
Function description for the model.
parameters
object
JSON Schema describing the function parameters.
strict
boolean
Enable strict schema adherence.

ToolChoice

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

ResponseFormatJSONObject

JSON object response format.
class ResponseFormatJSONObject(TypedDict):
    type: Literal["json_object"]  # Required

ResponseFormatJSONSchema

Structured JSON response with schema validation.
class ResponseFormatJSONSchema(TypedDict):
    type: Literal["json_schema"]  # Required
    json_schema: Dict[str, Any]  # Required
    strict: Optional[bool]
type
string
required
Must be "json_schema".
json_schema
object
required
JSON Schema definition for the response structure.
strict
boolean
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]]
slug
string
Server slug for known MCP servers (e.g., "filesystem", "github").
url
string
Custom MCP server URL.
config
object
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

MCPToolResult

Result from an MCP tool execution.
class MCPToolResult(BaseModel):
    tool_name: str
    result: Any
    error: Optional[str]
tool_name
string
Name of the MCP tool that was executed.
result
any
Result returned by the tool.
error
string
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]
enabled
boolean
required
Enable extended reasoning.
budget_tokens
integer
Token budget for reasoning.

JSONValueInput

Any valid JSON value.
JSONValueInput = Union[
    str,
    int,
    float,
    bool,
    None,
    Dict[str, "JSONValueInput"],
    List["JSONValueInput"],
]

JSONObjectInput

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
    }
}

Using ToolChoice

# Auto mode
tool_choice = "auto"

# Force specific tool
tool_choice = {
    "type": "function",
    "function": {"name": "get_weather"}
}

Using Response Formats

# 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
}

Build docs developers (and LLMs) love