Skip to main content

API Reference

The complete GDK surface. Use the toggles to switch language and GDK version — names and types are shown using each language's own conventions.

New to the GDK? Start with the GDK overview for installation and runnable examples.

Generated from crates/goose-sdk/src/bindings.rs at goose-sdk 0.1.0-alpha.6.

Functions

anthropic_default_model

fn anthropic_default_model() -> String

anthropic_provider

fn anthropic_provider(api_key: String, base_url: Option<String>, beta_headers: Vec<String>) -> Result<Provider, GooseError>
ParameterTypeDescription
api_keyString
base_urlOption<String>
beta_headersVec<String>

Raises GooseError

databricks_default_model

fn databricks_default_model() -> String

databricks_provider

fn databricks_provider(host: String, token: String) -> Result<Provider, GooseError>
ParameterTypeDescription
hostString
tokenString

Raises GooseError

databricks_v2_default_model

fn databricks_v2_default_model() -> String

databricks_v2_provider

fn databricks_v2_provider(host: String, token: String) -> Result<Provider, GooseError>
ParameterTypeDescription
hostString
tokenString

Raises GooseError

declarative_provider_from_json

fn declarative_provider_from_json(json: String) -> Result<Provider, GooseError>
ParameterTypeDescription
jsonString

Raises GooseError

default_compaction_templates

fn default_compaction_templates() -> CompactionTemplates

groq_default_model

fn groq_default_model() -> String

groq_provider

fn groq_provider(api_key: String) -> Result<Provider, GooseError>
ParameterTypeDescription
api_keyString

Raises GooseError

install_request_logger

Installs the process-wide provider request logger. A logger can only be installed once for the lifetime of the process.

fn install_request_logger(logger: RequestLogger) -> Result<(), GooseError>
ParameterTypeDescription
loggerRequestLogger

Raises GooseError

openai_default_model

fn openai_default_model() -> String

openai_provider

fn openai_provider(api_key: String) -> Result<Provider, GooseError>
ParameterTypeDescription
api_keyString

Raises GooseError

Classes

ProviderClass

name

fn Provider.name() -> String

supported_features

fn Provider.supported_features() -> Vec<Feature>

stream

async fn Provider.stream(model: ProviderModelConfig, system: String, messages: Vec<ProviderMessage>, tools: Vec<ProviderTool>) -> Result<ProviderStream, GooseError>
ParameterTypeDescription
modelProviderModelConfig
systemString
messagesVec<ProviderMessage>
toolsVec<ProviderTool>

Raises GooseError

complete

async fn Provider.complete(model: ProviderModelConfig, system: String, messages: Vec<ProviderMessage>, tools: Vec<ProviderTool>) -> Result<ProviderCompletion, GooseError>
ParameterTypeDescription
modelProviderModelConfig
systemString
messagesVec<ProviderMessage>
toolsVec<ProviderTool>

Raises GooseError

compact

Summarizes a conversation down to a single message so it can continue past this model's context window.

async fn Provider.compact(model_name: String, messages: Vec<CompactionMessage>, templates: Option<CompactionTemplates>) -> Result<CompactionSummary, GooseError>
ParameterTypeDescription
model_nameString
messagesVec<CompactionMessage>
templatesOption<CompactionTemplates>

Raises GooseError

ProviderStreamClass

next_chunk

async fn ProviderStream.next_chunk() -> Result<Option<StreamChunk>, GooseError>

Raises GooseError

Interfaces

RequestLoggerInterface

Receives provider request logs as JSONL records. `start` returns an identifier that is passed to `write` for every record in that request, allowing callers to keep concurrent request logs separate.

start

fn RequestLogger.start() -> Result<u64, GooseError>

Raises GooseError

write

fn RequestLogger.write(request_id: u64, record: String) -> Result<(), GooseError>
ParameterTypeDescription
request_idu64
recordString

Raises GooseError

Data types

ProviderMessageData type

A text message passed to a provider.

FieldTypeDescription
roleMessageRole
contentVec<MessageContent>

ProviderToolData type

FieldTypeDefaultDescription
nameString
descriptionString
input_schema_jsonString
annotations_jsonOption<String>None

ProviderModelConfigData type

FieldTypeDefaultDescription
model_nameString
context_limitOption<i32>None
temperatureOption<f32>None
max_tokensOption<i32>None
toolshimboolfalse
toolshim_modelOption<String>None
request_params_jsonOption<String>None
provider_params_jsonOption<String>None
reasoningOption<bool>None
timeout_msOption<u64>None
request_headersOption<HashMap<String, String>>NonePer-request HTTP headers attached to the outgoing provider call. These override any static headers configured on the provider.

UsageData type

FieldTypeDescription
input_tokensOption<i32>
output_tokensOption<i32>
total_tokensOption<i32>
cache_read_input_tokensOption<i32>
cache_creation_input_tokensOption<i32>
reasoning_tokensOption<i32>
modelString
provider_metadata_jsonOption<String>

GooseStreamErrorData type

FieldTypeDescription
kindGooseStreamErrorKind
messageString
retry_after_msOption<u64>

ProviderCompletionData type

FieldTypeDescription
message_jsonString
usageOption<Usage>

CompactionMessageData type

A text-only message. Compaction reads conversations as text, so this is the whole input shape callers need across the language boundary.

FieldTypeDescription
roleMessageRole
textString

CompactionTemplatesData type

Overrides for the summarization and summary-rendering prompts.

FieldTypeDescription
compactionString
summaryString

CompactionSummaryData type

FieldTypeDescription
textString
input_tokensOption<i32>
output_tokensOption<i32>
total_tokensOption<i32>

Enums

MessageRoleEnum

CaseAssociated data
User
Assistant
Tool

MessageContentEnum

CaseAssociated data
Text
text: String
Image
mime_type: String
data: Vec<u8>
ToolRequest
id: String
name: String
arguments_json: String
ToolResult
id: String
success: bool
content_json: String
Thinking
thinking: String
signature: String
RedactedThinking
data: String

StreamChunkEnum

CaseAssociated data
TextChunk
text: String
ToolChunk
id: String
name: String
arguments_json: String
ThinkingChunk
thinking: String
signature: String
RedactedThinkingChunk
data: String
EndChunk
usage: Option<Usage>
ErrorChunk
error: GooseStreamError

GooseStreamErrorKindEnum

CaseAssociated data
RateLimited
OutputTokenLimitExceeded
ContextLengthExceeded
Authentication
Timeout
ProviderUnavailable
Generic

FeatureEnum

CaseAssociated data
Tools
Streaming
Images
JsonSchema
Reasoning

Errors

GooseErrorError

VariantAssociated data
RateLimited
retry_after_ms: Option<u64>
retry_after_suffix: String
OutputTokenLimitExceeded
details: String
ContextLengthExceeded
details: String
Authentication
details: String
Timeout
details: String
ProviderUnavailable
details: String
Generic
details: String