Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func CalculateNonStreamingTimeout(maxTokens int, model Model, opts []option.RequestOption) (time.Duration, error)
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type APIErrorObject
- type AnthropicBeta
- type AuthenticationError
- type Base64ImageSourceMediaType
- type Base64ImageSourceParam
- type Base64PDFSource
- type Base64PDFSourceParam
- type BashCodeExecutionOutputBlock
- type BashCodeExecutionOutputBlockParam
- type BashCodeExecutionResultBlock
- type BashCodeExecutionResultBlockParam
- type BashCodeExecutionToolResultBlock
- type BashCodeExecutionToolResultBlockContentUnion
- func (u BashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock() (v BashCodeExecutionResultBlock)
- func (u BashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError() (v BashCodeExecutionToolResultError)
- func (u BashCodeExecutionToolResultBlockContentUnion) RawJSON() string
- func (r *BashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BashCodeExecutionToolResultBlockParam
- type BashCodeExecutionToolResultBlockParamContentUnion
- func (u BashCodeExecutionToolResultBlockParamContentUnion) GetContent() []BashCodeExecutionOutputBlockParam
- func (u BashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
- func (u BashCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
- func (u BashCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
- func (u BashCodeExecutionToolResultBlockParamContentUnion) GetType() *string
- func (u BashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BashCodeExecutionToolResultError
- type BashCodeExecutionToolResultErrorCode
- type BashCodeExecutionToolResultErrorParam
- type BetaAPIError
- type BetaAdvisorMessageIterationUsage
- type BetaAdvisorRedactedResultBlock
- type BetaAdvisorRedactedResultBlockParam
- type BetaAdvisorResultBlock
- type BetaAdvisorResultBlockParam
- type BetaAdvisorTool20260301Param
- type BetaAdvisorToolResultBlock
- type BetaAdvisorToolResultBlockContentUnion
- func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorRedactedResultBlock() (v BetaAdvisorRedactedResultBlock)
- func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorResultBlock() (v BetaAdvisorResultBlock)
- func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorToolResultError() (v BetaAdvisorToolResultError)
- func (u BetaAdvisorToolResultBlockContentUnion) RawJSON() string
- func (r *BetaAdvisorToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaAdvisorToolResultBlockParam
- type BetaAdvisorToolResultBlockParamContentUnion
- func (u BetaAdvisorToolResultBlockParamContentUnion) GetEncryptedContent() *string
- func (u BetaAdvisorToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BetaAdvisorToolResultBlockParamContentUnion) GetText() *string
- func (u BetaAdvisorToolResultBlockParamContentUnion) GetType() *string
- func (u BetaAdvisorToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaAdvisorToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaAdvisorToolResultError
- type BetaAdvisorToolResultErrorErrorCode
- type BetaAdvisorToolResultErrorParam
- type BetaAdvisorToolResultErrorParamErrorCode
- type BetaAgentArchiveParams
- type BetaAgentGetParams
- type BetaAgentListParams
- type BetaAgentNewParams
- type BetaAgentNewParamsToolUnion
- func (u BetaAgentNewParamsToolUnion) GetConfigs() (res betaAgentNewParamsToolUnionConfigs)
- func (u BetaAgentNewParamsToolUnion) GetDefaultConfig() (res betaAgentNewParamsToolUnionDefaultConfig)
- func (u BetaAgentNewParamsToolUnion) GetDescription() *string
- func (u BetaAgentNewParamsToolUnion) GetInputSchema() *BetaManagedAgentsCustomToolInputSchemaParam
- func (u BetaAgentNewParamsToolUnion) GetMCPServerName() *string
- func (u BetaAgentNewParamsToolUnion) GetName() *string
- func (u BetaAgentNewParamsToolUnion) GetType() *string
- func (u BetaAgentNewParamsToolUnion) MarshalJSON() ([]byte, error)
- func (u *BetaAgentNewParamsToolUnion) UnmarshalJSON(data []byte) error
- type BetaAgentService
- func (r *BetaAgentService) Archive(ctx context.Context, agentID string, body BetaAgentArchiveParams, ...) (res *BetaManagedAgentsAgent, err error)
- func (r *BetaAgentService) Get(ctx context.Context, agentID string, params BetaAgentGetParams, ...) (res *BetaManagedAgentsAgent, err error)
- func (r *BetaAgentService) List(ctx context.Context, params BetaAgentListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsAgent], err error)
- func (r *BetaAgentService) ListAutoPaging(ctx context.Context, params BetaAgentListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsAgent]
- func (r *BetaAgentService) New(ctx context.Context, params BetaAgentNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsAgent, err error)
- func (r *BetaAgentService) Update(ctx context.Context, agentID string, params BetaAgentUpdateParams, ...) (res *BetaManagedAgentsAgent, err error)
- type BetaAgentUpdateParams
- type BetaAgentUpdateParamsToolUnion
- func (u BetaAgentUpdateParamsToolUnion) GetConfigs() (res betaAgentUpdateParamsToolUnionConfigs)
- func (u BetaAgentUpdateParamsToolUnion) GetDefaultConfig() (res betaAgentUpdateParamsToolUnionDefaultConfig)
- func (u BetaAgentUpdateParamsToolUnion) GetDescription() *string
- func (u BetaAgentUpdateParamsToolUnion) GetInputSchema() *BetaManagedAgentsCustomToolInputSchemaParam
- func (u BetaAgentUpdateParamsToolUnion) GetMCPServerName() *string
- func (u BetaAgentUpdateParamsToolUnion) GetName() *string
- func (u BetaAgentUpdateParamsToolUnion) GetType() *string
- func (u BetaAgentUpdateParamsToolUnion) MarshalJSON() ([]byte, error)
- func (u *BetaAgentUpdateParamsToolUnion) UnmarshalJSON(data []byte) error
- type BetaAgentVersionListParams
- type BetaAgentVersionService
- func (r *BetaAgentVersionService) List(ctx context.Context, agentID string, params BetaAgentVersionListParams, ...) (res *pagination.PageCursor[BetaManagedAgentsAgent], err error)
- func (r *BetaAgentVersionService) ListAutoPaging(ctx context.Context, agentID string, params BetaAgentVersionListParams, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsAgent]
- type BetaAllThinkingTurnsParam
- type BetaAuthenticationError
- type BetaBase64ImageSourceMediaType
- type BetaBase64ImageSourceParam
- type BetaBase64PDFSource
- type BetaBase64PDFSourceParam
- type BetaBashCodeExecutionOutputBlock
- type BetaBashCodeExecutionOutputBlockParam
- type BetaBashCodeExecutionResultBlock
- type BetaBashCodeExecutionResultBlockParam
- type BetaBashCodeExecutionToolResultBlock
- type BetaBashCodeExecutionToolResultBlockContentUnion
- func (u BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock() (v BetaBashCodeExecutionResultBlock)
- func (u BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError() (v BetaBashCodeExecutionToolResultError)
- func (u BetaBashCodeExecutionToolResultBlockContentUnion) RawJSON() string
- func (r *BetaBashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaBashCodeExecutionToolResultBlockParam
- type BetaBashCodeExecutionToolResultBlockParamContentUnion
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetContent() []BetaBashCodeExecutionOutputBlockParam
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetType() *string
- func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaBashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaBashCodeExecutionToolResultError
- type BetaBashCodeExecutionToolResultErrorErrorCode
- type BetaBashCodeExecutionToolResultErrorParam
- type BetaBashCodeExecutionToolResultErrorParamErrorCode
- type BetaBillingError
- type BetaCacheControlEphemeralParam
- type BetaCacheControlEphemeralTTL
- type BetaCacheCreation
- type BetaCapabilitySupport
- type BetaCitationCharLocation
- type BetaCitationCharLocationParam
- type BetaCitationConfig
- type BetaCitationContentBlockLocation
- type BetaCitationContentBlockLocationParam
- type BetaCitationPageLocation
- type BetaCitationPageLocationParam
- type BetaCitationSearchResultLocation
- type BetaCitationSearchResultLocationParam
- type BetaCitationWebSearchResultLocationParam
- type BetaCitationsConfigParam
- type BetaCitationsDelta
- type BetaCitationsDeltaCitationUnion
- func (u BetaCitationsDeltaCitationUnion) AsAny() anyBetaCitationsDeltaCitation
- func (u BetaCitationsDeltaCitationUnion) AsCharLocation() (v BetaCitationCharLocation)
- func (u BetaCitationsDeltaCitationUnion) AsContentBlockLocation() (v BetaCitationContentBlockLocation)
- func (u BetaCitationsDeltaCitationUnion) AsPageLocation() (v BetaCitationPageLocation)
- func (u BetaCitationsDeltaCitationUnion) AsSearchResultLocation() (v BetaCitationSearchResultLocation)
- func (u BetaCitationsDeltaCitationUnion) AsWebSearchResultLocation() (v BetaCitationsWebSearchResultLocation)
- func (u BetaCitationsDeltaCitationUnion) RawJSON() string
- func (r *BetaCitationsDeltaCitationUnion) UnmarshalJSON(data []byte) error
- type BetaCitationsWebSearchResultLocation
- type BetaClearThinking20251015EditKeepUnionParam
- func (u BetaClearThinking20251015EditKeepUnionParam) GetType() *string
- func (u BetaClearThinking20251015EditKeepUnionParam) GetValue() *int64
- func (u BetaClearThinking20251015EditKeepUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaClearThinking20251015EditKeepUnionParam) UnmarshalJSON(data []byte) error
- type BetaClearThinking20251015EditParam
- type BetaClearThinking20251015EditResponse
- type BetaClearToolUses20250919EditClearToolInputsUnionParam
- type BetaClearToolUses20250919EditParam
- type BetaClearToolUses20250919EditResponse
- type BetaClearToolUses20250919EditTriggerUnionParam
- func (u BetaClearToolUses20250919EditTriggerUnionParam) GetType() *string
- func (u BetaClearToolUses20250919EditTriggerUnionParam) GetValue() *int64
- func (u BetaClearToolUses20250919EditTriggerUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaClearToolUses20250919EditTriggerUnionParam) UnmarshalJSON(data []byte) error
- type BetaCloudConfig
- type BetaCloudConfigNetworkingUnion
- func (u BetaCloudConfigNetworkingUnion) AsAny() anyBetaCloudConfigNetworking
- func (u BetaCloudConfigNetworkingUnion) AsLimited() (v BetaLimitedNetwork)
- func (u BetaCloudConfigNetworkingUnion) AsUnrestricted() (v BetaUnrestrictedNetwork)
- func (u BetaCloudConfigNetworkingUnion) RawJSON() string
- func (r *BetaCloudConfigNetworkingUnion) UnmarshalJSON(data []byte) error
- type BetaCloudConfigParams
- type BetaCloudConfigParamsNetworkingUnion
- func (u BetaCloudConfigParamsNetworkingUnion) GetAllowMCPServers() *bool
- func (u BetaCloudConfigParamsNetworkingUnion) GetAllowPackageManagers() *bool
- func (u BetaCloudConfigParamsNetworkingUnion) GetAllowedHosts() []string
- func (u BetaCloudConfigParamsNetworkingUnion) GetType() *string
- func (u BetaCloudConfigParamsNetworkingUnion) MarshalJSON() ([]byte, error)
- func (u *BetaCloudConfigParamsNetworkingUnion) UnmarshalJSON(data []byte) error
- type BetaCodeExecutionOutputBlock
- type BetaCodeExecutionOutputBlockParam
- type BetaCodeExecutionResultBlock
- type BetaCodeExecutionResultBlockParam
- type BetaCodeExecutionTool20250522Param
- type BetaCodeExecutionTool20250825Param
- type BetaCodeExecutionTool20260120Param
- type BetaCodeExecutionToolResultBlock
- type BetaCodeExecutionToolResultBlockContentUnion
- func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock() (v BetaCodeExecutionResultBlock)
- func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError() (v BetaCodeExecutionToolResultError)
- func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock() (v BetaEncryptedCodeExecutionResultBlock)
- func (u BetaCodeExecutionToolResultBlockContentUnion) RawJSON() string
- func (r *BetaCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaCodeExecutionToolResultBlockParam
- type BetaCodeExecutionToolResultBlockParamContentUnion
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetContent() []BetaCodeExecutionOutputBlockParam
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout() *string
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetType() *string
- func (u BetaCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaCodeExecutionToolResultError
- type BetaCodeExecutionToolResultErrorCode
- type BetaCodeExecutionToolResultErrorParam
- type BetaCompact20260112EditParam
- type BetaCompactionBlock
- type BetaCompactionBlockParam
- type BetaCompactionContentBlockDelta
- type BetaCompactionIterationUsage
- type BetaContainer
- type BetaContainerParams
- type BetaContainerUploadBlock
- type BetaContainerUploadBlockParam
- type BetaContentBlockParamUnion
- func NewBetaAdvisorToolResultBlock[...](content T, toolUseID string) BetaContentBlockParamUnion
- func NewBetaBashCodeExecutionToolResultBlock[...](content T, toolUseID string) BetaContentBlockParamUnion
- func NewBetaCodeExecutionToolResultBlock[...](content T, toolUseID string) BetaContentBlockParamUnion
- func NewBetaCompactionBlock(content string) BetaContentBlockParamUnion
- func NewBetaContainerUploadBlock(fileID string) BetaContentBlockParamUnion
- func NewBetaDocumentBlock[...](source T) BetaContentBlockParamUnion
- func NewBetaImageBlock[...](source T) BetaContentBlockParamUnion
- func NewBetaMCPToolResultBlock(toolUseID string) BetaContentBlockParamUnion
- func NewBetaRedactedThinkingBlock(data string) BetaContentBlockParamUnion
- func NewBetaSearchResultBlock(content []BetaTextBlockParam, source string, title string) BetaContentBlockParamUnion
- func NewBetaServerToolUseBlock(id string, input any, name BetaServerToolUseBlockParamName) BetaContentBlockParamUnion
- func NewBetaTextBlock(text string) BetaContentBlockParamUnion
- func NewBetaTextEditorCodeExecutionToolResultBlock[...](content T, toolUseID string) BetaContentBlockParamUnion
- func NewBetaThinkingBlock(signature string, thinking string) BetaContentBlockParamUnion
- func NewBetaToolResultBlock(toolUseID string, content string, isError bool) BetaContentBlockParamUnion
- func NewBetaToolSearchToolResultBlock[...](content T, toolUseID string) BetaContentBlockParamUnion
- func NewBetaToolUseBlock(id string, input any, name string) BetaContentBlockParamUnion
- func NewBetaWebFetchToolResultBlock[T BetaWebFetchToolResultErrorBlockParam | BetaWebFetchBlockParam](content T, toolUseID string) BetaContentBlockParamUnion
- func NewBetaWebSearchToolResultBlock[T []BetaWebSearchResultBlockParam | BetaWebSearchToolRequestErrorParam](content T, toolUseID string) BetaContentBlockParamUnion
- func (u BetaContentBlockParamUnion) GetCacheControl() *BetaCacheControlEphemeralParam
- func (u BetaContentBlockParamUnion) GetCaller() (res betaContentBlockParamUnionCaller)
- func (u BetaContentBlockParamUnion) GetCitations() (res betaContentBlockParamUnionCitations)
- func (u BetaContentBlockParamUnion) GetContent() (res betaContentBlockParamUnionContent)
- func (u BetaContentBlockParamUnion) GetContext() *string
- func (u BetaContentBlockParamUnion) GetData() *string
- func (u BetaContentBlockParamUnion) GetEncryptedContent() *string
- func (u BetaContentBlockParamUnion) GetFileID() *string
- func (u BetaContentBlockParamUnion) GetID() *string
- func (u BetaContentBlockParamUnion) GetInput() *any
- func (u BetaContentBlockParamUnion) GetIsError() *bool
- func (u BetaContentBlockParamUnion) GetName() *string
- func (u BetaContentBlockParamUnion) GetServerName() *string
- func (u BetaContentBlockParamUnion) GetSignature() *string
- func (u BetaContentBlockParamUnion) GetSource() (res betaContentBlockParamUnionSource)
- func (u BetaContentBlockParamUnion) GetText() *string
- func (u BetaContentBlockParamUnion) GetThinking() *string
- func (u BetaContentBlockParamUnion) GetTitle() *string
- func (u BetaContentBlockParamUnion) GetToolUseID() *string
- func (u BetaContentBlockParamUnion) GetType() *string
- func (u BetaContentBlockParamUnion) MarshalJSON() ([]byte, error)
- func (u *BetaContentBlockParamUnion) UnmarshalJSON(data []byte) error
- type BetaContentBlockSourceContentUnionParam
- type BetaContentBlockSourceParam
- type BetaContentBlockUnion
- func (u BetaContentBlockUnion) AsAdvisorToolResult() (v BetaAdvisorToolResultBlock)
- func (u BetaContentBlockUnion) AsAny() anyBetaContentBlock
- func (u BetaContentBlockUnion) AsBashCodeExecutionToolResult() (v BetaBashCodeExecutionToolResultBlock)
- func (u BetaContentBlockUnion) AsCodeExecutionToolResult() (v BetaCodeExecutionToolResultBlock)
- func (u BetaContentBlockUnion) AsCompaction() (v BetaCompactionBlock)
- func (u BetaContentBlockUnion) AsContainerUpload() (v BetaContainerUploadBlock)
- func (u BetaContentBlockUnion) AsMCPToolResult() (v BetaMCPToolResultBlock)
- func (u BetaContentBlockUnion) AsMCPToolUse() (v BetaMCPToolUseBlock)
- func (u BetaContentBlockUnion) AsRedactedThinking() (v BetaRedactedThinkingBlock)
- func (u BetaContentBlockUnion) AsServerToolUse() (v BetaServerToolUseBlock)
- func (u BetaContentBlockUnion) AsText() (v BetaTextBlock)
- func (u BetaContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v BetaTextEditorCodeExecutionToolResultBlock)
- func (u BetaContentBlockUnion) AsThinking() (v BetaThinkingBlock)
- func (u BetaContentBlockUnion) AsToolSearchToolResult() (v BetaToolSearchToolResultBlock)
- func (u BetaContentBlockUnion) AsToolUse() (v BetaToolUseBlock)
- func (u BetaContentBlockUnion) AsWebFetchToolResult() (v BetaWebFetchToolResultBlock)
- func (u BetaContentBlockUnion) AsWebSearchToolResult() (v BetaWebSearchToolResultBlock)
- func (u BetaContentBlockUnion) RawJSON() string
- func (r BetaContentBlockUnion) ToParam() BetaContentBlockParamUnion
- func (r *BetaContentBlockUnion) UnmarshalJSON(data []byte) error
- type BetaContentBlockUnionCaller
- type BetaContentBlockUnionContent
- type BetaContentBlockUnionContentContent
- type BetaContextManagementCapability
- type BetaContextManagementConfigEditUnionParam
- func (u BetaContextManagementConfigEditUnionParam) GetClearAtLeast() *BetaInputTokensClearAtLeastParam
- func (u BetaContextManagementConfigEditUnionParam) GetClearToolInputs() *BetaClearToolUses20250919EditClearToolInputsUnionParam
- func (u BetaContextManagementConfigEditUnionParam) GetExcludeTools() []string
- func (u BetaContextManagementConfigEditUnionParam) GetInstructions() *string
- func (u BetaContextManagementConfigEditUnionParam) GetKeep() (res betaContextManagementConfigEditUnionParamKeep)
- func (u BetaContextManagementConfigEditUnionParam) GetPauseAfterCompaction() *bool
- func (u BetaContextManagementConfigEditUnionParam) GetType() *string
- func (u BetaContextManagementConfigEditUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaContextManagementConfigEditUnionParam) UnmarshalJSON(data []byte) error
- type BetaContextManagementConfigParam
- type BetaContextManagementResponse
- type BetaContextManagementResponseAppliedEditUnion
- func (u BetaContextManagementResponseAppliedEditUnion) AsAny() anyBetaContextManagementResponseAppliedEdit
- func (u BetaContextManagementResponseAppliedEditUnion) AsClearThinking20251015() (v BetaClearThinking20251015EditResponse)
- func (u BetaContextManagementResponseAppliedEditUnion) AsClearToolUses20250919() (v BetaClearToolUses20250919EditResponse)
- func (u BetaContextManagementResponseAppliedEditUnion) RawJSON() string
- func (r *BetaContextManagementResponseAppliedEditUnion) UnmarshalJSON(data []byte) error
- type BetaCountTokensContextManagementResponse
- type BetaDeletedMessageBatch
- type BetaDirectCaller
- type BetaDirectCallerParam
- type BetaDocumentBlock
- type BetaDocumentBlockSourceUnion
- func (u BetaDocumentBlockSourceUnion) AsAny() anyBetaDocumentBlockSource
- func (u BetaDocumentBlockSourceUnion) AsBase64() (v BetaBase64PDFSource)
- func (u BetaDocumentBlockSourceUnion) AsText() (v BetaPlainTextSource)
- func (u BetaDocumentBlockSourceUnion) RawJSON() string
- func (r *BetaDocumentBlockSourceUnion) UnmarshalJSON(data []byte) error
- type BetaEffortCapability
- type BetaEncryptedCodeExecutionResultBlock
- type BetaEncryptedCodeExecutionResultBlockParam
- type BetaEnvironment
- type BetaEnvironmentArchiveParams
- type BetaEnvironmentDeleteParams
- type BetaEnvironmentDeleteResponse
- type BetaEnvironmentGetParams
- type BetaEnvironmentListParams
- type BetaEnvironmentNewParams
- type BetaEnvironmentService
- func (r *BetaEnvironmentService) Archive(ctx context.Context, environmentID string, body BetaEnvironmentArchiveParams, ...) (res *BetaEnvironment, err error)
- func (r *BetaEnvironmentService) Delete(ctx context.Context, environmentID string, body BetaEnvironmentDeleteParams, ...) (res *BetaEnvironmentDeleteResponse, err error)
- func (r *BetaEnvironmentService) Get(ctx context.Context, environmentID string, query BetaEnvironmentGetParams, ...) (res *BetaEnvironment, err error)
- func (r *BetaEnvironmentService) List(ctx context.Context, params BetaEnvironmentListParams, ...) (res *pagination.PageCursor[BetaEnvironment], err error)
- func (r *BetaEnvironmentService) ListAutoPaging(ctx context.Context, params BetaEnvironmentListParams, ...) *pagination.PageCursorAutoPager[BetaEnvironment]
- func (r *BetaEnvironmentService) New(ctx context.Context, params BetaEnvironmentNewParams, ...) (res *BetaEnvironment, err error)
- func (r *BetaEnvironmentService) Update(ctx context.Context, environmentID string, params BetaEnvironmentUpdateParams, ...) (res *BetaEnvironment, err error)
- type BetaEnvironmentUpdateParams
- type BetaErrorResponse
- type BetaErrorUnion
- func (u BetaErrorUnion) AsAPIError() (v BetaAPIError)
- func (u BetaErrorUnion) AsAny() anyBetaError
- func (u BetaErrorUnion) AsAuthenticationError() (v BetaAuthenticationError)
- func (u BetaErrorUnion) AsBillingError() (v BetaBillingError)
- func (u BetaErrorUnion) AsInvalidRequestError() (v BetaInvalidRequestError)
- func (u BetaErrorUnion) AsNotFoundError() (v BetaNotFoundError)
- func (u BetaErrorUnion) AsOverloadedError() (v BetaOverloadedError)
- func (u BetaErrorUnion) AsPermissionError() (v BetaPermissionError)
- func (u BetaErrorUnion) AsRateLimitError() (v BetaRateLimitError)
- func (u BetaErrorUnion) AsTimeoutError() (v BetaGatewayTimeoutError)
- func (u BetaErrorUnion) RawJSON() string
- func (r *BetaErrorUnion) UnmarshalJSON(data []byte) error
- type BetaFileDeleteParams
- type BetaFileDocumentSourceParam
- type BetaFileDownloadParams
- type BetaFileGetMetadataParams
- type BetaFileImageSourceParam
- type BetaFileListParams
- type BetaFileScope
- type BetaFileService
- func (r *BetaFileService) Delete(ctx context.Context, fileID string, body BetaFileDeleteParams, ...) (res *DeletedFile, err error)
- func (r *BetaFileService) Download(ctx context.Context, fileID string, query BetaFileDownloadParams, ...) (res *http.Response, err error)
- func (r *BetaFileService) GetMetadata(ctx context.Context, fileID string, query BetaFileGetMetadataParams, ...) (res *FileMetadata, err error)
- func (r *BetaFileService) List(ctx context.Context, params BetaFileListParams, opts ...option.RequestOption) (res *pagination.Page[FileMetadata], err error)
- func (r *BetaFileService) ListAutoPaging(ctx context.Context, params BetaFileListParams, opts ...option.RequestOption) *pagination.PageAutoPager[FileMetadata]
- func (r *BetaFileService) Upload(ctx context.Context, params BetaFileUploadParams, opts ...option.RequestOption) (res *FileMetadata, err error)
- type BetaFileUploadParams
- type BetaGatewayTimeoutError
- type BetaImageBlockParam
- type BetaImageBlockParamSourceUnion
- func (u BetaImageBlockParamSourceUnion) GetData() *string
- func (u BetaImageBlockParamSourceUnion) GetFileID() *string
- func (u BetaImageBlockParamSourceUnion) GetMediaType() *string
- func (u BetaImageBlockParamSourceUnion) GetType() *string
- func (u BetaImageBlockParamSourceUnion) GetURL() *string
- func (u BetaImageBlockParamSourceUnion) MarshalJSON() ([]byte, error)
- func (u *BetaImageBlockParamSourceUnion) UnmarshalJSON(data []byte) error
- type BetaInputJSONDelta
- type BetaInputTokensClearAtLeastParam
- type BetaInputTokensTriggerParam
- type BetaInvalidRequestError
- type BetaIterationsUsage
- type BetaIterationsUsageItemUnion
- func (u BetaIterationsUsageItemUnion) AsAdvisorMessage() (v BetaAdvisorMessageIterationUsage)
- func (u BetaIterationsUsageItemUnion) AsAny() anyBetaIterationsUsageItem
- func (u BetaIterationsUsageItemUnion) AsCompaction() (v BetaCompactionIterationUsage)
- func (u BetaIterationsUsageItemUnion) AsMessage() (v BetaMessageIterationUsage)
- func (u BetaIterationsUsageItemUnion) RawJSON() string
- func (r *BetaIterationsUsageItemUnion) UnmarshalJSON(data []byte) error
- type BetaJSONOutputFormatParam
- type BetaLimitedNetwork
- type BetaLimitedNetworkParams
- type BetaMCPToolConfigParam
- type BetaMCPToolDefaultConfigParam
- type BetaMCPToolResultBlock
- type BetaMCPToolResultBlockContentUnion
- func (u BetaMCPToolResultBlockContentUnion) AsBetaMCPToolResultBlockContent() (v []BetaTextBlock)
- func (u BetaMCPToolResultBlockContentUnion) AsString() (v string)
- func (u BetaMCPToolResultBlockContentUnion) RawJSON() string
- func (r *BetaMCPToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaMCPToolUseBlock
- type BetaMCPToolUseBlockParam
- type BetaMCPToolsetParam
- type BetaManagedAgentsAPIActor
- type BetaManagedAgentsAPIActorType
- type BetaManagedAgentsActorUnion
- func (u BetaManagedAgentsActorUnion) AsAPIActor() (v BetaManagedAgentsAPIActor)
- func (u BetaManagedAgentsActorUnion) AsAny() anyBetaManagedAgentsActor
- func (u BetaManagedAgentsActorUnion) AsSessionActor() (v BetaManagedAgentsSessionActor)
- func (u BetaManagedAgentsActorUnion) AsUserActor() (v BetaManagedAgentsUserActor)
- func (u BetaManagedAgentsActorUnion) RawJSON() string
- func (r *BetaManagedAgentsActorUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgent
- type BetaManagedAgentsAgentCustomToolUseEvent
- type BetaManagedAgentsAgentCustomToolUseEventType
- type BetaManagedAgentsAgentMCPToolResultEvent
- type BetaManagedAgentsAgentMCPToolResultEventContentUnion
- func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsAny() anyBetaManagedAgentsAgentMCPToolResultEventContent
- func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
- func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
- func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
- func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) RawJSON() string
- func (r *BetaManagedAgentsAgentMCPToolResultEventContentUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentMCPToolResultEventContentUnionSource
- type BetaManagedAgentsAgentMCPToolResultEventType
- type BetaManagedAgentsAgentMCPToolUseEvent
- type BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission
- type BetaManagedAgentsAgentMCPToolUseEventType
- type BetaManagedAgentsAgentMessageEvent
- type BetaManagedAgentsAgentMessageEventType
- type BetaManagedAgentsAgentParams
- type BetaManagedAgentsAgentParamsType
- type BetaManagedAgentsAgentSkillUnion
- func (u BetaManagedAgentsAgentSkillUnion) AsAnthropic() (v BetaManagedAgentsAnthropicSkill)
- func (u BetaManagedAgentsAgentSkillUnion) AsAny() anyBetaManagedAgentsAgentSkill
- func (u BetaManagedAgentsAgentSkillUnion) AsCustom() (v BetaManagedAgentsCustomSkill)
- func (u BetaManagedAgentsAgentSkillUnion) RawJSON() string
- func (r *BetaManagedAgentsAgentSkillUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentThinkingEvent
- type BetaManagedAgentsAgentThinkingEventType
- type BetaManagedAgentsAgentThreadContextCompactedEvent
- type BetaManagedAgentsAgentThreadContextCompactedEventType
- type BetaManagedAgentsAgentToolConfig
- type BetaManagedAgentsAgentToolConfigName
- type BetaManagedAgentsAgentToolConfigParams
- type BetaManagedAgentsAgentToolConfigParamsName
- type BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion
- type BetaManagedAgentsAgentToolConfigPermissionPolicyUnion
- func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
- func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
- func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsAgentToolConfigPermissionPolicy
- func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) RawJSON() string
- func (r *BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentToolResultEvent
- type BetaManagedAgentsAgentToolResultEventContentUnion
- func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsAny() anyBetaManagedAgentsAgentToolResultEventContent
- func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
- func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
- func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
- func (u BetaManagedAgentsAgentToolResultEventContentUnion) RawJSON() string
- func (r *BetaManagedAgentsAgentToolResultEventContentUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentToolResultEventContentUnionSource
- type BetaManagedAgentsAgentToolResultEventType
- type BetaManagedAgentsAgentToolUnion
- func (u BetaManagedAgentsAgentToolUnion) AsAgentToolset20260401() (v BetaManagedAgentsAgentToolset20260401)
- func (u BetaManagedAgentsAgentToolUnion) AsAny() anyBetaManagedAgentsAgentTool
- func (u BetaManagedAgentsAgentToolUnion) AsCustom() (v BetaManagedAgentsCustomTool)
- func (u BetaManagedAgentsAgentToolUnion) AsMCPToolset() (v BetaManagedAgentsMCPToolset)
- func (u BetaManagedAgentsAgentToolUnion) RawJSON() string
- func (r *BetaManagedAgentsAgentToolUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentToolUnionConfigs
- type BetaManagedAgentsAgentToolUnionDefaultConfig
- type BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy
- type BetaManagedAgentsAgentToolUseEvent
- type BetaManagedAgentsAgentToolUseEventEvaluatedPermission
- type BetaManagedAgentsAgentToolUseEventType
- type BetaManagedAgentsAgentToolset20260401
- type BetaManagedAgentsAgentToolset20260401Params
- type BetaManagedAgentsAgentToolset20260401ParamsType
- type BetaManagedAgentsAgentToolset20260401Type
- type BetaManagedAgentsAgentToolsetDefaultConfig
- type BetaManagedAgentsAgentToolsetDefaultConfigParams
- type BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion
- func (u BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) GetType() *string
- func (u BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion
- func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
- func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
- func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicy
- func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) RawJSON() string
- func (r *BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsAgentType
- type BetaManagedAgentsAlwaysAllowPolicy
- type BetaManagedAgentsAlwaysAllowPolicyParam
- type BetaManagedAgentsAlwaysAllowPolicyType
- type BetaManagedAgentsAlwaysAskPolicy
- type BetaManagedAgentsAlwaysAskPolicyParam
- type BetaManagedAgentsAlwaysAskPolicyType
- type BetaManagedAgentsAnthropicSkill
- type BetaManagedAgentsAnthropicSkillParams
- type BetaManagedAgentsAnthropicSkillParamsType
- type BetaManagedAgentsAnthropicSkillType
- type BetaManagedAgentsBase64DocumentSource
- type BetaManagedAgentsBase64DocumentSourceParam
- type BetaManagedAgentsBase64DocumentSourceType
- type BetaManagedAgentsBase64ImageSource
- type BetaManagedAgentsBase64ImageSourceParam
- type BetaManagedAgentsBase64ImageSourceType
- type BetaManagedAgentsBillingError
- type BetaManagedAgentsBillingErrorRetryStatusUnion
- func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsBillingErrorRetryStatus
- func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsBillingErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsBillingErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsBillingErrorType
- type BetaManagedAgentsBranchCheckout
- type BetaManagedAgentsBranchCheckoutParam
- type BetaManagedAgentsBranchCheckoutType
- type BetaManagedAgentsCacheCreationUsage
- type BetaManagedAgentsCommitCheckout
- type BetaManagedAgentsCommitCheckoutParam
- type BetaManagedAgentsCommitCheckoutType
- type BetaManagedAgentsCredential
- type BetaManagedAgentsCredentialAuthUnion
- func (u BetaManagedAgentsCredentialAuthUnion) AsAny() anyBetaManagedAgentsCredentialAuth
- func (u BetaManagedAgentsCredentialAuthUnion) AsMCPOAuth() (v BetaManagedAgentsMCPOAuthAuthResponse)
- func (u BetaManagedAgentsCredentialAuthUnion) AsStaticBearer() (v BetaManagedAgentsStaticBearerAuthResponse)
- func (u BetaManagedAgentsCredentialAuthUnion) RawJSON() string
- func (r *BetaManagedAgentsCredentialAuthUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsCredentialType
- type BetaManagedAgentsCustomSkill
- type BetaManagedAgentsCustomSkillParams
- type BetaManagedAgentsCustomSkillParamsType
- type BetaManagedAgentsCustomSkillType
- type BetaManagedAgentsCustomTool
- type BetaManagedAgentsCustomToolInputSchema
- type BetaManagedAgentsCustomToolInputSchemaParam
- type BetaManagedAgentsCustomToolInputSchemaType
- type BetaManagedAgentsCustomToolParams
- type BetaManagedAgentsCustomToolParamsType
- type BetaManagedAgentsCustomToolType
- type BetaManagedAgentsDeleteSessionResource
- type BetaManagedAgentsDeleteSessionResourceType
- type BetaManagedAgentsDeletedCredential
- type BetaManagedAgentsDeletedCredentialType
- type BetaManagedAgentsDeletedMemory
- type BetaManagedAgentsDeletedMemoryStore
- type BetaManagedAgentsDeletedMemoryStoreType
- type BetaManagedAgentsDeletedMemoryType
- type BetaManagedAgentsDeletedSession
- type BetaManagedAgentsDeletedSessionType
- type BetaManagedAgentsDeletedVault
- type BetaManagedAgentsDeletedVaultType
- type BetaManagedAgentsDocumentBlock
- type BetaManagedAgentsDocumentBlockParam
- type BetaManagedAgentsDocumentBlockSourceUnion
- func (u BetaManagedAgentsDocumentBlockSourceUnion) AsAny() anyBetaManagedAgentsDocumentBlockSource
- func (u BetaManagedAgentsDocumentBlockSourceUnion) AsBase64() (v BetaManagedAgentsBase64DocumentSource)
- func (u BetaManagedAgentsDocumentBlockSourceUnion) AsFile() (v BetaManagedAgentsFileDocumentSource)
- func (u BetaManagedAgentsDocumentBlockSourceUnion) AsText() (v BetaManagedAgentsPlainTextDocumentSource)
- func (u BetaManagedAgentsDocumentBlockSourceUnion) AsURL() (v BetaManagedAgentsURLDocumentSource)
- func (u BetaManagedAgentsDocumentBlockSourceUnion) RawJSON() string
- func (r *BetaManagedAgentsDocumentBlockSourceUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsDocumentBlockSourceUnionParam
- func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetData() *string
- func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetFileID() *string
- func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetMediaType() *string
- func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetType() *string
- func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetURL() *string
- func (u BetaManagedAgentsDocumentBlockSourceUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsDocumentBlockSourceUnionParam) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsDocumentBlockType
- type BetaManagedAgentsEventParamsUnion
- func BetaManagedAgentsEventParamsOfUserCustomToolResult(customToolUseID string) BetaManagedAgentsEventParamsUnion
- func BetaManagedAgentsEventParamsOfUserInterrupt(type_ BetaManagedAgentsUserInterruptEventParamsType) BetaManagedAgentsEventParamsUnion
- func BetaManagedAgentsEventParamsOfUserMessage(content []BetaManagedAgentsUserMessageEventParamsContentUnion) BetaManagedAgentsEventParamsUnion
- func BetaManagedAgentsEventParamsOfUserToolConfirmation(result BetaManagedAgentsUserToolConfirmationEventParamsResult, ...) BetaManagedAgentsEventParamsUnion
- func (u BetaManagedAgentsEventParamsUnion) GetContent() (res betaManagedAgentsEventParamsUnionContent)
- func (u BetaManagedAgentsEventParamsUnion) GetCustomToolUseID() *string
- func (u BetaManagedAgentsEventParamsUnion) GetDenyMessage() *string
- func (u BetaManagedAgentsEventParamsUnion) GetIsError() *bool
- func (u BetaManagedAgentsEventParamsUnion) GetResult() *string
- func (u BetaManagedAgentsEventParamsUnion) GetToolUseID() *string
- func (u BetaManagedAgentsEventParamsUnion) GetType() *string
- func (u BetaManagedAgentsEventParamsUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsEventParamsUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsFileDocumentSource
- type BetaManagedAgentsFileDocumentSourceParam
- type BetaManagedAgentsFileDocumentSourceType
- type BetaManagedAgentsFileImageSource
- type BetaManagedAgentsFileImageSourceParam
- type BetaManagedAgentsFileImageSourceType
- type BetaManagedAgentsFileResource
- type BetaManagedAgentsFileResourceParams
- type BetaManagedAgentsFileResourceParamsType
- type BetaManagedAgentsFileResourceType
- type BetaManagedAgentsGitHubRepositoryResource
- type BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion
- func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsAny() anyBetaManagedAgentsGitHubRepositoryResourceCheckout
- func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsBranch() (v BetaManagedAgentsBranchCheckout)
- func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsCommit() (v BetaManagedAgentsCommitCheckout)
- func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) RawJSON() string
- func (r *BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsGitHubRepositoryResourceParams
- type BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion
- func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetName() *string
- func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetSha() *string
- func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetType() *string
- func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsGitHubRepositoryResourceParamsType
- type BetaManagedAgentsGitHubRepositoryResourceType
- type BetaManagedAgentsImageBlock
- type BetaManagedAgentsImageBlockParam
- type BetaManagedAgentsImageBlockSourceUnion
- func (u BetaManagedAgentsImageBlockSourceUnion) AsAny() anyBetaManagedAgentsImageBlockSource
- func (u BetaManagedAgentsImageBlockSourceUnion) AsBase64() (v BetaManagedAgentsBase64ImageSource)
- func (u BetaManagedAgentsImageBlockSourceUnion) AsFile() (v BetaManagedAgentsFileImageSource)
- func (u BetaManagedAgentsImageBlockSourceUnion) AsURL() (v BetaManagedAgentsURLImageSource)
- func (u BetaManagedAgentsImageBlockSourceUnion) RawJSON() string
- func (r *BetaManagedAgentsImageBlockSourceUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsImageBlockSourceUnionParam
- func (u BetaManagedAgentsImageBlockSourceUnionParam) GetData() *string
- func (u BetaManagedAgentsImageBlockSourceUnionParam) GetFileID() *string
- func (u BetaManagedAgentsImageBlockSourceUnionParam) GetMediaType() *string
- func (u BetaManagedAgentsImageBlockSourceUnionParam) GetType() *string
- func (u BetaManagedAgentsImageBlockSourceUnionParam) GetURL() *string
- func (u BetaManagedAgentsImageBlockSourceUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsImageBlockSourceUnionParam) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsImageBlockType
- type BetaManagedAgentsMCPAuthenticationFailedError
- type BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion
- func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsMCPAuthenticationFailedErrorRetryStatus
- func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPAuthenticationFailedErrorType
- type BetaManagedAgentsMCPConnectionFailedError
- type BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion
- func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsMCPConnectionFailedErrorRetryStatus
- func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPConnectionFailedErrorType
- type BetaManagedAgentsMCPOAuthAuthResponse
- type BetaManagedAgentsMCPOAuthAuthResponseType
- type BetaManagedAgentsMCPOAuthCreateParams
- type BetaManagedAgentsMCPOAuthCreateParamsType
- type BetaManagedAgentsMCPOAuthRefreshParams
- type BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion
- func (u BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) GetClientSecret() *string
- func (u BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) GetType() *string
- func (u BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPOAuthRefreshResponse
- type BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion
- func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsAny() anyBetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuth
- func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsClientSecretBasic() (v BetaManagedAgentsTokenEndpointAuthBasicResponse)
- func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsClientSecretPost() (v BetaManagedAgentsTokenEndpointAuthPostResponse)
- func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsNone() (v BetaManagedAgentsTokenEndpointAuthNoneResponse)
- func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) RawJSON() string
- func (r *BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPOAuthRefreshUpdateParams
- type BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion
- func (u BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) GetClientSecret() *string
- func (u BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) GetType() *string
- func (u BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPOAuthUpdateParams
- type BetaManagedAgentsMCPOAuthUpdateParamsType
- type BetaManagedAgentsMCPServerURLDefinition
- type BetaManagedAgentsMCPServerURLDefinitionType
- type BetaManagedAgentsMCPToolConfig
- type BetaManagedAgentsMCPToolConfigParams
- type BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion
- type BetaManagedAgentsMCPToolConfigPermissionPolicyUnion
- func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
- func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
- func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsMCPToolConfigPermissionPolicy
- func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) RawJSON() string
- func (r *BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPToolset
- type BetaManagedAgentsMCPToolsetDefaultConfig
- type BetaManagedAgentsMCPToolsetDefaultConfigParams
- type BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion
- func (u BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) GetType() *string
- func (u BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion
- func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
- func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
- func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicy
- func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) RawJSON() string
- func (r *BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMCPToolsetParams
- type BetaManagedAgentsMCPToolsetParamsType
- type BetaManagedAgentsMCPToolsetType
- type BetaManagedAgentsMemory
- type BetaManagedAgentsMemoryListItemUnion
- func (u BetaManagedAgentsMemoryListItemUnion) AsAny() anyBetaManagedAgentsMemoryListItem
- func (u BetaManagedAgentsMemoryListItemUnion) AsMemory() (v BetaManagedAgentsMemory)
- func (u BetaManagedAgentsMemoryListItemUnion) AsMemoryPrefix() (v BetaManagedAgentsMemoryPrefix)
- func (u BetaManagedAgentsMemoryListItemUnion) RawJSON() string
- func (r *BetaManagedAgentsMemoryListItemUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsMemoryPrefix
- type BetaManagedAgentsMemoryPrefixType
- type BetaManagedAgentsMemoryStore
- type BetaManagedAgentsMemoryStoreResource
- type BetaManagedAgentsMemoryStoreResourceAccess
- type BetaManagedAgentsMemoryStoreResourceParam
- type BetaManagedAgentsMemoryStoreResourceParamAccess
- type BetaManagedAgentsMemoryStoreResourceParamType
- type BetaManagedAgentsMemoryStoreResourceType
- type BetaManagedAgentsMemoryStoreType
- type BetaManagedAgentsMemoryType
- type BetaManagedAgentsMemoryVersion
- type BetaManagedAgentsMemoryVersionOperation
- type BetaManagedAgentsMemoryVersionType
- type BetaManagedAgentsMemoryView
- type BetaManagedAgentsModel
- type BetaManagedAgentsModelConfig
- type BetaManagedAgentsModelConfigParams
- type BetaManagedAgentsModelConfigParamsSpeed
- type BetaManagedAgentsModelConfigSpeed
- type BetaManagedAgentsModelOverloadedError
- type BetaManagedAgentsModelOverloadedErrorRetryStatusUnion
- func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsModelOverloadedErrorRetryStatus
- func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsModelOverloadedErrorType
- type BetaManagedAgentsModelRateLimitedError
- type BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion
- func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsModelRateLimitedErrorRetryStatus
- func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsModelRateLimitedErrorType
- type BetaManagedAgentsModelRequestFailedError
- type BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion
- func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsModelRequestFailedErrorRetryStatus
- func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsModelRequestFailedErrorType
- type BetaManagedAgentsPlainTextDocumentSource
- type BetaManagedAgentsPlainTextDocumentSourceMediaType
- type BetaManagedAgentsPlainTextDocumentSourceParam
- type BetaManagedAgentsPlainTextDocumentSourceType
- type BetaManagedAgentsPreconditionParam
- type BetaManagedAgentsPreconditionType
- type BetaManagedAgentsRetryStatusExhausted
- type BetaManagedAgentsRetryStatusExhaustedType
- type BetaManagedAgentsRetryStatusRetrying
- type BetaManagedAgentsRetryStatusRetryingType
- type BetaManagedAgentsRetryStatusTerminal
- type BetaManagedAgentsRetryStatusTerminalType
- type BetaManagedAgentsSendSessionEvents
- type BetaManagedAgentsSendSessionEventsDataUnion
- func (u BetaManagedAgentsSendSessionEventsDataUnion) AsAny() anyBetaManagedAgentsSendSessionEventsData
- func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserCustomToolResult() (v BetaManagedAgentsUserCustomToolResultEvent)
- func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserInterrupt() (v BetaManagedAgentsUserInterruptEvent)
- func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserMessage() (v BetaManagedAgentsUserMessageEvent)
- func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserToolConfirmation() (v BetaManagedAgentsUserToolConfirmationEvent)
- func (u BetaManagedAgentsSendSessionEventsDataUnion) RawJSON() string
- func (r *BetaManagedAgentsSendSessionEventsDataUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSendSessionEventsDataUnionContent
- type BetaManagedAgentsSession
- type BetaManagedAgentsSessionActor
- type BetaManagedAgentsSessionActorType
- type BetaManagedAgentsSessionAgent
- type BetaManagedAgentsSessionAgentSkillUnion
- func (u BetaManagedAgentsSessionAgentSkillUnion) AsAnthropic() (v BetaManagedAgentsAnthropicSkill)
- func (u BetaManagedAgentsSessionAgentSkillUnion) AsAny() anyBetaManagedAgentsSessionAgentSkill
- func (u BetaManagedAgentsSessionAgentSkillUnion) AsCustom() (v BetaManagedAgentsCustomSkill)
- func (u BetaManagedAgentsSessionAgentSkillUnion) RawJSON() string
- func (r *BetaManagedAgentsSessionAgentSkillUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSessionAgentToolUnion
- func (u BetaManagedAgentsSessionAgentToolUnion) AsAgentToolset20260401() (v BetaManagedAgentsAgentToolset20260401)
- func (u BetaManagedAgentsSessionAgentToolUnion) AsAny() anyBetaManagedAgentsSessionAgentTool
- func (u BetaManagedAgentsSessionAgentToolUnion) AsCustom() (v BetaManagedAgentsCustomTool)
- func (u BetaManagedAgentsSessionAgentToolUnion) AsMCPToolset() (v BetaManagedAgentsMCPToolset)
- func (u BetaManagedAgentsSessionAgentToolUnion) RawJSON() string
- func (r *BetaManagedAgentsSessionAgentToolUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSessionAgentToolUnionConfigs
- type BetaManagedAgentsSessionAgentToolUnionDefaultConfig
- type BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy
- type BetaManagedAgentsSessionAgentType
- type BetaManagedAgentsSessionDeletedEvent
- type BetaManagedAgentsSessionDeletedEventType
- type BetaManagedAgentsSessionEndTurn
- type BetaManagedAgentsSessionEndTurnType
- type BetaManagedAgentsSessionErrorEvent
- type BetaManagedAgentsSessionErrorEventErrorUnion
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsAny() anyBetaManagedAgentsSessionErrorEventError
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsBillingError() (v BetaManagedAgentsBillingError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsMCPAuthenticationFailedError() (v BetaManagedAgentsMCPAuthenticationFailedError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsMCPConnectionFailedError() (v BetaManagedAgentsMCPConnectionFailedError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsModelOverloadedError() (v BetaManagedAgentsModelOverloadedError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsModelRateLimitedError() (v BetaManagedAgentsModelRateLimitedError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsModelRequestFailedError() (v BetaManagedAgentsModelRequestFailedError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsUnknownError() (v BetaManagedAgentsUnknownError)
- func (u BetaManagedAgentsSessionErrorEventErrorUnion) RawJSON() string
- func (r *BetaManagedAgentsSessionErrorEventErrorUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus
- type BetaManagedAgentsSessionErrorEventType
- type BetaManagedAgentsSessionEventUnion
- func (u BetaManagedAgentsSessionEventUnion) AsAgentCustomToolUse() (v BetaManagedAgentsAgentCustomToolUseEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentMCPToolResult() (v BetaManagedAgentsAgentMCPToolResultEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentMCPToolUse() (v BetaManagedAgentsAgentMCPToolUseEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentMessage() (v BetaManagedAgentsAgentMessageEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentThinking() (v BetaManagedAgentsAgentThinkingEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentThreadContextCompacted() (v BetaManagedAgentsAgentThreadContextCompactedEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentToolResult() (v BetaManagedAgentsAgentToolResultEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAgentToolUse() (v BetaManagedAgentsAgentToolUseEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsAny() anyBetaManagedAgentsSessionEvent
- func (u BetaManagedAgentsSessionEventUnion) AsSessionDeleted() (v BetaManagedAgentsSessionDeletedEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSessionError() (v BetaManagedAgentsSessionErrorEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusIdle() (v BetaManagedAgentsSessionStatusIdleEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusRescheduled() (v BetaManagedAgentsSessionStatusRescheduledEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusRunning() (v BetaManagedAgentsSessionStatusRunningEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusTerminated() (v BetaManagedAgentsSessionStatusTerminatedEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSpanModelRequestEnd() (v BetaManagedAgentsSpanModelRequestEndEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsSpanModelRequestStart() (v BetaManagedAgentsSpanModelRequestStartEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsUserCustomToolResult() (v BetaManagedAgentsUserCustomToolResultEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsUserInterrupt() (v BetaManagedAgentsUserInterruptEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsUserMessage() (v BetaManagedAgentsUserMessageEvent)
- func (u BetaManagedAgentsSessionEventUnion) AsUserToolConfirmation() (v BetaManagedAgentsUserToolConfirmationEvent)
- func (u BetaManagedAgentsSessionEventUnion) RawJSON() string
- func (r *BetaManagedAgentsSessionEventUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSessionEventUnionContent
- type BetaManagedAgentsSessionRequiresAction
- type BetaManagedAgentsSessionRequiresActionType
- type BetaManagedAgentsSessionResourceUnion
- func (u BetaManagedAgentsSessionResourceUnion) AsAny() anyBetaManagedAgentsSessionResource
- func (u BetaManagedAgentsSessionResourceUnion) AsFile() (v BetaManagedAgentsFileResource)
- func (u BetaManagedAgentsSessionResourceUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResource)
- func (u BetaManagedAgentsSessionResourceUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResource)
- func (u BetaManagedAgentsSessionResourceUnion) RawJSON() string
- func (r *BetaManagedAgentsSessionResourceUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSessionRetriesExhausted
- type BetaManagedAgentsSessionRetriesExhaustedType
- type BetaManagedAgentsSessionStats
- type BetaManagedAgentsSessionStatus
- type BetaManagedAgentsSessionStatusIdleEvent
- type BetaManagedAgentsSessionStatusIdleEventStopReasonUnion
- func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsAny() anyBetaManagedAgentsSessionStatusIdleEventStopReason
- func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsEndTurn() (v BetaManagedAgentsSessionEndTurn)
- func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsRequiresAction() (v BetaManagedAgentsSessionRequiresAction)
- func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsRetriesExhausted() (v BetaManagedAgentsSessionRetriesExhausted)
- func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) RawJSON() string
- func (r *BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSessionStatusIdleEventType
- type BetaManagedAgentsSessionStatusRescheduledEvent
- type BetaManagedAgentsSessionStatusRescheduledEventType
- type BetaManagedAgentsSessionStatusRunningEvent
- type BetaManagedAgentsSessionStatusRunningEventType
- type BetaManagedAgentsSessionStatusTerminatedEvent
- type BetaManagedAgentsSessionStatusTerminatedEventType
- type BetaManagedAgentsSessionType
- type BetaManagedAgentsSessionUsage
- type BetaManagedAgentsSkillParamsUnion
- func (u BetaManagedAgentsSkillParamsUnion) GetSkillID() *string
- func (u BetaManagedAgentsSkillParamsUnion) GetType() *string
- func (u BetaManagedAgentsSkillParamsUnion) GetVersion() *string
- func (u BetaManagedAgentsSkillParamsUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsSkillParamsUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsSpanModelRequestEndEvent
- type BetaManagedAgentsSpanModelRequestEndEventType
- type BetaManagedAgentsSpanModelRequestStartEvent
- type BetaManagedAgentsSpanModelRequestStartEventType
- type BetaManagedAgentsSpanModelUsage
- type BetaManagedAgentsSpanModelUsageSpeed
- type BetaManagedAgentsStaticBearerAuthResponse
- type BetaManagedAgentsStaticBearerAuthResponseType
- type BetaManagedAgentsStaticBearerCreateParams
- type BetaManagedAgentsStaticBearerCreateParamsType
- type BetaManagedAgentsStaticBearerUpdateParams
- type BetaManagedAgentsStaticBearerUpdateParamsType
- type BetaManagedAgentsStreamSessionEventsUnion
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentCustomToolUse() (v BetaManagedAgentsAgentCustomToolUseEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentMCPToolResult() (v BetaManagedAgentsAgentMCPToolResultEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentMCPToolUse() (v BetaManagedAgentsAgentMCPToolUseEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentMessage() (v BetaManagedAgentsAgentMessageEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentThinking() (v BetaManagedAgentsAgentThinkingEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentThreadContextCompacted() (v BetaManagedAgentsAgentThreadContextCompactedEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentToolResult() (v BetaManagedAgentsAgentToolResultEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentToolUse() (v BetaManagedAgentsAgentToolUseEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsAny() anyBetaManagedAgentsStreamSessionEvents
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionDeleted() (v BetaManagedAgentsSessionDeletedEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionError() (v BetaManagedAgentsSessionErrorEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusIdle() (v BetaManagedAgentsSessionStatusIdleEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusRescheduled() (v BetaManagedAgentsSessionStatusRescheduledEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusRunning() (v BetaManagedAgentsSessionStatusRunningEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusTerminated() (v BetaManagedAgentsSessionStatusTerminatedEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSpanModelRequestEnd() (v BetaManagedAgentsSpanModelRequestEndEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsSpanModelRequestStart() (v BetaManagedAgentsSpanModelRequestStartEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserCustomToolResult() (v BetaManagedAgentsUserCustomToolResultEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserInterrupt() (v BetaManagedAgentsUserInterruptEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserMessage() (v BetaManagedAgentsUserMessageEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserToolConfirmation() (v BetaManagedAgentsUserToolConfirmationEvent)
- func (u BetaManagedAgentsStreamSessionEventsUnion) RawJSON() string
- func (r *BetaManagedAgentsStreamSessionEventsUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsStreamSessionEventsUnionContent
- type BetaManagedAgentsTextBlock
- type BetaManagedAgentsTextBlockParam
- type BetaManagedAgentsTextBlockType
- type BetaManagedAgentsTokenEndpointAuthBasicParam
- type BetaManagedAgentsTokenEndpointAuthBasicParamType
- type BetaManagedAgentsTokenEndpointAuthBasicResponse
- type BetaManagedAgentsTokenEndpointAuthBasicResponseType
- type BetaManagedAgentsTokenEndpointAuthBasicUpdateParam
- type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType
- type BetaManagedAgentsTokenEndpointAuthNoneParam
- type BetaManagedAgentsTokenEndpointAuthNoneParamType
- type BetaManagedAgentsTokenEndpointAuthNoneResponse
- type BetaManagedAgentsTokenEndpointAuthNoneResponseType
- type BetaManagedAgentsTokenEndpointAuthPostParam
- type BetaManagedAgentsTokenEndpointAuthPostParamType
- type BetaManagedAgentsTokenEndpointAuthPostResponse
- type BetaManagedAgentsTokenEndpointAuthPostResponseType
- type BetaManagedAgentsTokenEndpointAuthPostUpdateParam
- type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType
- type BetaManagedAgentsURLDocumentSource
- type BetaManagedAgentsURLDocumentSourceParam
- type BetaManagedAgentsURLDocumentSourceType
- type BetaManagedAgentsURLImageSource
- type BetaManagedAgentsURLImageSourceParam
- type BetaManagedAgentsURLImageSourceType
- type BetaManagedAgentsURLMCPServerParams
- type BetaManagedAgentsURLMCPServerParamsType
- type BetaManagedAgentsUnknownError
- type BetaManagedAgentsUnknownErrorRetryStatusUnion
- func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsUnknownErrorRetryStatus
- func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
- func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
- func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
- func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) RawJSON() string
- func (r *BetaManagedAgentsUnknownErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsUnknownErrorType
- type BetaManagedAgentsUserActor
- type BetaManagedAgentsUserActorType
- type BetaManagedAgentsUserCustomToolResultEvent
- type BetaManagedAgentsUserCustomToolResultEventContentUnion
- func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsAny() anyBetaManagedAgentsUserCustomToolResultEventContent
- func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
- func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
- func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
- func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) RawJSON() string
- func (r *BetaManagedAgentsUserCustomToolResultEventContentUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsUserCustomToolResultEventContentUnionSource
- type BetaManagedAgentsUserCustomToolResultEventParams
- type BetaManagedAgentsUserCustomToolResultEventParamsContentUnion
- func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetContext() *string
- func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetSource() (res betaManagedAgentsUserCustomToolResultEventParamsContentUnionSource)
- func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetText() *string
- func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetTitle() *string
- func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetType() *string
- func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsUserCustomToolResultEventParamsType
- type BetaManagedAgentsUserCustomToolResultEventType
- type BetaManagedAgentsUserInterruptEvent
- type BetaManagedAgentsUserInterruptEventParams
- type BetaManagedAgentsUserInterruptEventParamsType
- type BetaManagedAgentsUserInterruptEventType
- type BetaManagedAgentsUserMessageEvent
- type BetaManagedAgentsUserMessageEventContentUnion
- func (u BetaManagedAgentsUserMessageEventContentUnion) AsAny() anyBetaManagedAgentsUserMessageEventContent
- func (u BetaManagedAgentsUserMessageEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
- func (u BetaManagedAgentsUserMessageEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
- func (u BetaManagedAgentsUserMessageEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
- func (u BetaManagedAgentsUserMessageEventContentUnion) RawJSON() string
- func (r *BetaManagedAgentsUserMessageEventContentUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsUserMessageEventContentUnionSource
- type BetaManagedAgentsUserMessageEventParams
- type BetaManagedAgentsUserMessageEventParamsContentUnion
- func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetContext() *string
- func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetSource() (res betaManagedAgentsUserMessageEventParamsContentUnionSource)
- func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetText() *string
- func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetTitle() *string
- func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetType() *string
- func (u BetaManagedAgentsUserMessageEventParamsContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaManagedAgentsUserMessageEventParamsContentUnion) UnmarshalJSON(data []byte) error
- type BetaManagedAgentsUserMessageEventParamsType
- type BetaManagedAgentsUserMessageEventType
- type BetaManagedAgentsUserToolConfirmationEvent
- type BetaManagedAgentsUserToolConfirmationEventParams
- type BetaManagedAgentsUserToolConfirmationEventParamsResult
- type BetaManagedAgentsUserToolConfirmationEventParamsType
- type BetaManagedAgentsUserToolConfirmationEventResult
- type BetaManagedAgentsUserToolConfirmationEventType
- type BetaManagedAgentsVault
- type BetaManagedAgentsVaultType
- type BetaMemoryStoreArchiveParams
- type BetaMemoryStoreDeleteParams
- type BetaMemoryStoreGetParams
- type BetaMemoryStoreListParams
- type BetaMemoryStoreMemoryDeleteParams
- type BetaMemoryStoreMemoryGetParams
- type BetaMemoryStoreMemoryListParams
- type BetaMemoryStoreMemoryListParamsOrder
- type BetaMemoryStoreMemoryNewParams
- type BetaMemoryStoreMemoryService
- func (r *BetaMemoryStoreMemoryService) Delete(ctx context.Context, memoryID string, params BetaMemoryStoreMemoryDeleteParams, ...) (res *BetaManagedAgentsDeletedMemory, err error)
- func (r *BetaMemoryStoreMemoryService) Get(ctx context.Context, memoryID string, params BetaMemoryStoreMemoryGetParams, ...) (res *BetaManagedAgentsMemory, err error)
- func (r *BetaMemoryStoreMemoryService) List(ctx context.Context, memoryStoreID string, ...) (res *pagination.PageCursor[BetaManagedAgentsMemoryListItemUnion], err error)
- func (r *BetaMemoryStoreMemoryService) ListAutoPaging(ctx context.Context, memoryStoreID string, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsMemoryListItemUnion]
- func (r *BetaMemoryStoreMemoryService) New(ctx context.Context, memoryStoreID string, ...) (res *BetaManagedAgentsMemory, err error)
- func (r *BetaMemoryStoreMemoryService) Update(ctx context.Context, memoryID string, params BetaMemoryStoreMemoryUpdateParams, ...) (res *BetaManagedAgentsMemory, err error)
- type BetaMemoryStoreMemoryUpdateParams
- type BetaMemoryStoreMemoryVersionGetParams
- type BetaMemoryStoreMemoryVersionListParams
- type BetaMemoryStoreMemoryVersionRedactParams
- type BetaMemoryStoreMemoryVersionService
- func (r *BetaMemoryStoreMemoryVersionService) Get(ctx context.Context, memoryVersionID string, ...) (res *BetaManagedAgentsMemoryVersion, err error)
- func (r *BetaMemoryStoreMemoryVersionService) List(ctx context.Context, memoryStoreID string, ...) (res *pagination.PageCursor[BetaManagedAgentsMemoryVersion], err error)
- func (r *BetaMemoryStoreMemoryVersionService) ListAutoPaging(ctx context.Context, memoryStoreID string, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsMemoryVersion]
- func (r *BetaMemoryStoreMemoryVersionService) Redact(ctx context.Context, memoryVersionID string, ...) (res *BetaManagedAgentsMemoryVersion, err error)
- type BetaMemoryStoreNewParams
- type BetaMemoryStoreService
- func (r *BetaMemoryStoreService) Archive(ctx context.Context, memoryStoreID string, body BetaMemoryStoreArchiveParams, ...) (res *BetaManagedAgentsMemoryStore, err error)
- func (r *BetaMemoryStoreService) Delete(ctx context.Context, memoryStoreID string, body BetaMemoryStoreDeleteParams, ...) (res *BetaManagedAgentsDeletedMemoryStore, err error)
- func (r *BetaMemoryStoreService) Get(ctx context.Context, memoryStoreID string, query BetaMemoryStoreGetParams, ...) (res *BetaManagedAgentsMemoryStore, err error)
- func (r *BetaMemoryStoreService) List(ctx context.Context, params BetaMemoryStoreListParams, ...) (res *pagination.PageCursor[BetaManagedAgentsMemoryStore], err error)
- func (r *BetaMemoryStoreService) ListAutoPaging(ctx context.Context, params BetaMemoryStoreListParams, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsMemoryStore]
- func (r *BetaMemoryStoreService) New(ctx context.Context, params BetaMemoryStoreNewParams, ...) (res *BetaManagedAgentsMemoryStore, err error)
- func (r *BetaMemoryStoreService) Update(ctx context.Context, memoryStoreID string, params BetaMemoryStoreUpdateParams, ...) (res *BetaManagedAgentsMemoryStore, err error)
- type BetaMemoryStoreUpdateParams
- type BetaMemoryTool20250818CommandUnion
- func (u BetaMemoryTool20250818CommandUnion) AsAny() anyBetaMemoryTool20250818Command
- func (u BetaMemoryTool20250818CommandUnion) AsCreate() (v BetaMemoryTool20250818CreateCommand)
- func (u BetaMemoryTool20250818CommandUnion) AsDelete() (v BetaMemoryTool20250818DeleteCommand)
- func (u BetaMemoryTool20250818CommandUnion) AsInsert() (v BetaMemoryTool20250818InsertCommand)
- func (u BetaMemoryTool20250818CommandUnion) AsRename() (v BetaMemoryTool20250818RenameCommand)
- func (u BetaMemoryTool20250818CommandUnion) AsStrReplace() (v BetaMemoryTool20250818StrReplaceCommand)
- func (u BetaMemoryTool20250818CommandUnion) AsView() (v BetaMemoryTool20250818ViewCommand)
- func (u BetaMemoryTool20250818CommandUnion) RawJSON() string
- func (r *BetaMemoryTool20250818CommandUnion) UnmarshalJSON(data []byte) error
- type BetaMemoryTool20250818CreateCommand
- type BetaMemoryTool20250818DeleteCommand
- type BetaMemoryTool20250818InsertCommand
- type BetaMemoryTool20250818Param
- type BetaMemoryTool20250818RenameCommand
- type BetaMemoryTool20250818StrReplaceCommand
- type BetaMemoryTool20250818ViewCommand
- type BetaMessage
- type BetaMessageBatch
- type BetaMessageBatchCancelParams
- type BetaMessageBatchCanceledResult
- type BetaMessageBatchDeleteParams
- type BetaMessageBatchErroredResult
- type BetaMessageBatchExpiredResult
- type BetaMessageBatchGetParams
- type BetaMessageBatchIndividualResponse
- type BetaMessageBatchListParams
- type BetaMessageBatchNewParams
- type BetaMessageBatchNewParamsRequest
- type BetaMessageBatchNewParamsRequestParams
- type BetaMessageBatchNewParamsRequestParamsContainerUnion
- type BetaMessageBatchProcessingStatus
- type BetaMessageBatchRequestCounts
- type BetaMessageBatchResultUnion
- func (u BetaMessageBatchResultUnion) AsAny() anyBetaMessageBatchResult
- func (u BetaMessageBatchResultUnion) AsCanceled() (v BetaMessageBatchCanceledResult)
- func (u BetaMessageBatchResultUnion) AsErrored() (v BetaMessageBatchErroredResult)
- func (u BetaMessageBatchResultUnion) AsExpired() (v BetaMessageBatchExpiredResult)
- func (u BetaMessageBatchResultUnion) AsSucceeded() (v BetaMessageBatchSucceededResult)
- func (u BetaMessageBatchResultUnion) RawJSON() string
- func (r *BetaMessageBatchResultUnion) UnmarshalJSON(data []byte) error
- type BetaMessageBatchResultsParams
- type BetaMessageBatchService
- func (r *BetaMessageBatchService) Cancel(ctx context.Context, messageBatchID string, body BetaMessageBatchCancelParams, ...) (res *BetaMessageBatch, err error)
- func (r *BetaMessageBatchService) Delete(ctx context.Context, messageBatchID string, body BetaMessageBatchDeleteParams, ...) (res *BetaDeletedMessageBatch, err error)
- func (r *BetaMessageBatchService) Get(ctx context.Context, messageBatchID string, query BetaMessageBatchGetParams, ...) (res *BetaMessageBatch, err error)
- func (r *BetaMessageBatchService) List(ctx context.Context, params BetaMessageBatchListParams, ...) (res *pagination.Page[BetaMessageBatch], err error)
- func (r *BetaMessageBatchService) ListAutoPaging(ctx context.Context, params BetaMessageBatchListParams, ...) *pagination.PageAutoPager[BetaMessageBatch]
- func (r *BetaMessageBatchService) New(ctx context.Context, params BetaMessageBatchNewParams, ...) (res *BetaMessageBatch, err error)
- func (r *BetaMessageBatchService) ResultsStreaming(ctx context.Context, messageBatchID string, ...) (stream *jsonl.Stream[BetaMessageBatchIndividualResponse])
- type BetaMessageBatchSucceededResult
- type BetaMessageCountTokensParams
- type BetaMessageCountTokensParamsSpeed
- type BetaMessageCountTokensParamsSystemUnion
- type BetaMessageCountTokensParamsToolUnion
- func (u BetaMessageCountTokensParamsToolUnion) GetAllowedCallers() []string
- func (u BetaMessageCountTokensParamsToolUnion) GetAllowedDomains() []string
- func (u BetaMessageCountTokensParamsToolUnion) GetBlockedDomains() []string
- func (u BetaMessageCountTokensParamsToolUnion) GetCacheControl() *BetaCacheControlEphemeralParam
- func (u BetaMessageCountTokensParamsToolUnion) GetCaching() *BetaCacheControlEphemeralParam
- func (u BetaMessageCountTokensParamsToolUnion) GetCitations() *BetaCitationsConfigParam
- func (u BetaMessageCountTokensParamsToolUnion) GetConfigs() map[string]BetaMCPToolConfigParam
- func (u BetaMessageCountTokensParamsToolUnion) GetDefaultConfig() *BetaMCPToolDefaultConfigParam
- func (u BetaMessageCountTokensParamsToolUnion) GetDeferLoading() *bool
- func (u BetaMessageCountTokensParamsToolUnion) GetDescription() *string
- func (u BetaMessageCountTokensParamsToolUnion) GetDisplayHeightPx() *int64
- func (u BetaMessageCountTokensParamsToolUnion) GetDisplayNumber() *int64
- func (u BetaMessageCountTokensParamsToolUnion) GetDisplayWidthPx() *int64
- func (u BetaMessageCountTokensParamsToolUnion) GetEagerInputStreaming() *bool
- func (u BetaMessageCountTokensParamsToolUnion) GetEnableZoom() *bool
- func (u BetaMessageCountTokensParamsToolUnion) GetInputExamples() []map[string]any
- func (u BetaMessageCountTokensParamsToolUnion) GetInputSchema() *BetaToolInputSchemaParam
- func (u BetaMessageCountTokensParamsToolUnion) GetMCPServerName() *string
- func (u BetaMessageCountTokensParamsToolUnion) GetMaxCharacters() *int64
- func (u BetaMessageCountTokensParamsToolUnion) GetMaxContentTokens() *int64
- func (u BetaMessageCountTokensParamsToolUnion) GetMaxUses() *int64
- func (u BetaMessageCountTokensParamsToolUnion) GetModel() *Model
- func (u BetaMessageCountTokensParamsToolUnion) GetName() *string
- func (u BetaMessageCountTokensParamsToolUnion) GetStrict() *bool
- func (u BetaMessageCountTokensParamsToolUnion) GetType() *string
- func (u BetaMessageCountTokensParamsToolUnion) GetUseCache() *bool
- func (u BetaMessageCountTokensParamsToolUnion) GetUserLocation() *BetaUserLocationParam
- func (u BetaMessageCountTokensParamsToolUnion) MarshalJSON() ([]byte, error)
- func (u *BetaMessageCountTokensParamsToolUnion) UnmarshalJSON(data []byte) error
- type BetaMessageDeltaUsage
- type BetaMessageIterationUsage
- type BetaMessageNewParams
- type BetaMessageNewParamsContainerUnion
- type BetaMessageNewParamsServiceTier
- type BetaMessageNewParamsSpeed
- type BetaMessageParam
- type BetaMessageParamRole
- type BetaMessageService
- func (r *BetaMessageService) CountTokens(ctx context.Context, params BetaMessageCountTokensParams, ...) (res *BetaMessageTokensCount, err error)
- func (r *BetaMessageService) New(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (res *BetaMessage, err error)
- func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[BetaRawMessageStreamEventUnion])
- func (r *BetaMessageService) NewToolRunner(tools []BetaTool, params BetaToolRunnerParams, opts ...option.RequestOption) *BetaToolRunner
- func (r *BetaMessageService) NewToolRunnerStreaming(tools []BetaTool, params BetaToolRunnerParams, opts ...option.RequestOption) *BetaToolRunnerStreaming
- type BetaMessageTokensCount
- type BetaMetadataParam
- type BetaModelCapabilities
- type BetaModelGetParams
- type BetaModelInfo
- type BetaModelListParams
- type BetaModelService
- func (r *BetaModelService) Get(ctx context.Context, modelID string, query BetaModelGetParams, ...) (res *BetaModelInfo, err error)
- func (r *BetaModelService) List(ctx context.Context, params BetaModelListParams, opts ...option.RequestOption) (res *pagination.Page[BetaModelInfo], err error)
- func (r *BetaModelService) ListAutoPaging(ctx context.Context, params BetaModelListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BetaModelInfo]
- type BetaNotFoundError
- type BetaOutputConfigEffort
- type BetaOutputConfigParam
- type BetaOverloadedError
- type BetaPackages
- type BetaPackagesParams
- type BetaPackagesParamsType
- type BetaPackagesType
- type BetaPermissionError
- type BetaPlainTextSource
- type BetaPlainTextSourceParam
- type BetaRateLimitError
- type BetaRawContentBlockDeltaEvent
- type BetaRawContentBlockDeltaUnion
- func (u BetaRawContentBlockDeltaUnion) AsAny() anyBetaRawContentBlockDelta
- func (u BetaRawContentBlockDeltaUnion) AsCitationsDelta() (v BetaCitationsDelta)
- func (u BetaRawContentBlockDeltaUnion) AsCompactionDelta() (v BetaCompactionContentBlockDelta)
- func (u BetaRawContentBlockDeltaUnion) AsInputJSONDelta() (v BetaInputJSONDelta)
- func (u BetaRawContentBlockDeltaUnion) AsSignatureDelta() (v BetaSignatureDelta)
- func (u BetaRawContentBlockDeltaUnion) AsTextDelta() (v BetaTextDelta)
- func (u BetaRawContentBlockDeltaUnion) AsThinkingDelta() (v BetaThinkingDelta)
- func (u BetaRawContentBlockDeltaUnion) RawJSON() string
- func (r *BetaRawContentBlockDeltaUnion) UnmarshalJSON(data []byte) error
- type BetaRawContentBlockStartEvent
- type BetaRawContentBlockStartEventContentBlockUnion
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsAdvisorToolResult() (v BetaAdvisorToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsAny() anyBetaRawContentBlockStartEventContentBlock
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult() (v BetaBashCodeExecutionToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult() (v BetaCodeExecutionToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsCompaction() (v BetaCompactionBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsContainerUpload() (v BetaContainerUploadBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolResult() (v BetaMCPToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolUse() (v BetaMCPToolUseBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsRedactedThinking() (v BetaRedactedThinkingBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsServerToolUse() (v BetaServerToolUseBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsText() (v BetaTextBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v BetaTextEditorCodeExecutionToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsThinking() (v BetaThinkingBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsToolSearchToolResult() (v BetaToolSearchToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsToolUse() (v BetaToolUseBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsWebFetchToolResult() (v BetaWebFetchToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) AsWebSearchToolResult() (v BetaWebSearchToolResultBlock)
- func (u BetaRawContentBlockStartEventContentBlockUnion) RawJSON() string
- func (r *BetaRawContentBlockStartEventContentBlockUnion) UnmarshalJSON(data []byte) error
- type BetaRawContentBlockStartEventContentBlockUnionCaller
- type BetaRawContentBlockStartEventContentBlockUnionContent
- type BetaRawContentBlockStartEventContentBlockUnionContentContent
- type BetaRawContentBlockStopEvent
- type BetaRawMessageDeltaEvent
- type BetaRawMessageDeltaEventDelta
- type BetaRawMessageStartEvent
- type BetaRawMessageStopEvent
- type BetaRawMessageStreamEventUnion
- func (u BetaRawMessageStreamEventUnion) AsAny() anyBetaRawMessageStreamEvent
- func (u BetaRawMessageStreamEventUnion) AsContentBlockDelta() (v BetaRawContentBlockDeltaEvent)
- func (u BetaRawMessageStreamEventUnion) AsContentBlockStart() (v BetaRawContentBlockStartEvent)
- func (u BetaRawMessageStreamEventUnion) AsContentBlockStop() (v BetaRawContentBlockStopEvent)
- func (u BetaRawMessageStreamEventUnion) AsMessageDelta() (v BetaRawMessageDeltaEvent)
- func (u BetaRawMessageStreamEventUnion) AsMessageStart() (v BetaRawMessageStartEvent)
- func (u BetaRawMessageStreamEventUnion) AsMessageStop() (v BetaRawMessageStopEvent)
- func (u BetaRawMessageStreamEventUnion) RawJSON() string
- func (r *BetaRawMessageStreamEventUnion) UnmarshalJSON(data []byte) error
- type BetaRawMessageStreamEventUnionDelta
- type BetaRedactedThinkingBlock
- type BetaRedactedThinkingBlockParam
- type BetaRefusalStopDetails
- type BetaRefusalStopDetailsCategory
- type BetaRequestDocumentBlockParam
- type BetaRequestDocumentBlockSourceUnionParam
- func (u BetaRequestDocumentBlockSourceUnionParam) GetContent() *BetaContentBlockSourceContentUnionParam
- func (u BetaRequestDocumentBlockSourceUnionParam) GetData() *string
- func (u BetaRequestDocumentBlockSourceUnionParam) GetFileID() *string
- func (u BetaRequestDocumentBlockSourceUnionParam) GetMediaType() *string
- func (u BetaRequestDocumentBlockSourceUnionParam) GetType() *string
- func (u BetaRequestDocumentBlockSourceUnionParam) GetURL() *string
- func (u BetaRequestDocumentBlockSourceUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaRequestDocumentBlockSourceUnionParam) UnmarshalJSON(data []byte) error
- type BetaRequestMCPServerToolConfigurationParam
- type BetaRequestMCPServerURLDefinitionParam
- type BetaRequestMCPToolResultBlockParam
- type BetaRequestMCPToolResultBlockParamContentUnion
- type BetaSearchResultBlockParam
- type BetaServerToolCaller
- type BetaServerToolCaller20260120
- type BetaServerToolCaller20260120Param
- type BetaServerToolCallerParam
- type BetaServerToolUsage
- type BetaServerToolUseBlock
- type BetaServerToolUseBlockCallerUnion
- func (u BetaServerToolUseBlockCallerUnion) AsAny() anyBetaServerToolUseBlockCaller
- func (u BetaServerToolUseBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
- func (u BetaServerToolUseBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
- func (u BetaServerToolUseBlockCallerUnion) AsDirect() (v BetaDirectCaller)
- func (u BetaServerToolUseBlockCallerUnion) RawJSON() string
- func (r *BetaServerToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
- type BetaServerToolUseBlockName
- type BetaServerToolUseBlockParam
- type BetaServerToolUseBlockParamCallerUnion
- type BetaServerToolUseBlockParamName
- type BetaService
- type BetaSessionArchiveParams
- type BetaSessionDeleteParams
- type BetaSessionEventListParams
- type BetaSessionEventListParamsOrder
- type BetaSessionEventSendParams
- type BetaSessionEventService
- func (r *BetaSessionEventService) List(ctx context.Context, sessionID string, params BetaSessionEventListParams, ...) (res *pagination.PageCursor[BetaManagedAgentsSessionEventUnion], err error)
- func (r *BetaSessionEventService) ListAutoPaging(ctx context.Context, sessionID string, params BetaSessionEventListParams, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsSessionEventUnion]
- func (r *BetaSessionEventService) Send(ctx context.Context, sessionID string, params BetaSessionEventSendParams, ...) (res *BetaManagedAgentsSendSessionEvents, err error)
- func (r *BetaSessionEventService) StreamEvents(ctx context.Context, sessionID string, query BetaSessionEventStreamParams, ...) (stream *ssestream.Stream[BetaManagedAgentsStreamSessionEventsUnion])
- type BetaSessionEventStreamParams
- type BetaSessionGetParams
- type BetaSessionListParams
- type BetaSessionListParamsOrder
- type BetaSessionNewParams
- type BetaSessionNewParamsAgentUnion
- type BetaSessionNewParamsResourceUnion
- func (u BetaSessionNewParamsResourceUnion) GetAccess() *string
- func (u BetaSessionNewParamsResourceUnion) GetAuthorizationToken() *string
- func (u BetaSessionNewParamsResourceUnion) GetCheckout() *BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion
- func (u BetaSessionNewParamsResourceUnion) GetFileID() *string
- func (u BetaSessionNewParamsResourceUnion) GetInstructions() *string
- func (u BetaSessionNewParamsResourceUnion) GetMemoryStoreID() *string
- func (u BetaSessionNewParamsResourceUnion) GetMountPath() *string
- func (u BetaSessionNewParamsResourceUnion) GetType() *string
- func (u BetaSessionNewParamsResourceUnion) GetURL() *string
- func (u BetaSessionNewParamsResourceUnion) MarshalJSON() ([]byte, error)
- func (u *BetaSessionNewParamsResourceUnion) UnmarshalJSON(data []byte) error
- type BetaSessionResourceAddParams
- type BetaSessionResourceDeleteParams
- type BetaSessionResourceGetParams
- type BetaSessionResourceGetResponseUnion
- func (u BetaSessionResourceGetResponseUnion) AsAny() anyBetaSessionResourceGetResponse
- func (u BetaSessionResourceGetResponseUnion) AsFile() (v BetaManagedAgentsFileResource)
- func (u BetaSessionResourceGetResponseUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResource)
- func (u BetaSessionResourceGetResponseUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResource)
- func (u BetaSessionResourceGetResponseUnion) RawJSON() string
- func (r *BetaSessionResourceGetResponseUnion) UnmarshalJSON(data []byte) error
- type BetaSessionResourceListParams
- type BetaSessionResourceService
- func (r *BetaSessionResourceService) Add(ctx context.Context, sessionID string, params BetaSessionResourceAddParams, ...) (res *BetaManagedAgentsFileResource, err error)
- func (r *BetaSessionResourceService) Delete(ctx context.Context, resourceID string, params BetaSessionResourceDeleteParams, ...) (res *BetaManagedAgentsDeleteSessionResource, err error)
- func (r *BetaSessionResourceService) Get(ctx context.Context, resourceID string, params BetaSessionResourceGetParams, ...) (res *BetaSessionResourceGetResponseUnion, err error)
- func (r *BetaSessionResourceService) List(ctx context.Context, sessionID string, params BetaSessionResourceListParams, ...) (res *pagination.PageCursor[BetaManagedAgentsSessionResourceUnion], err error)
- func (r *BetaSessionResourceService) ListAutoPaging(ctx context.Context, sessionID string, params BetaSessionResourceListParams, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsSessionResourceUnion]
- func (r *BetaSessionResourceService) Update(ctx context.Context, resourceID string, params BetaSessionResourceUpdateParams, ...) (res *BetaSessionResourceUpdateResponseUnion, err error)
- type BetaSessionResourceUpdateParams
- type BetaSessionResourceUpdateResponseUnion
- func (u BetaSessionResourceUpdateResponseUnion) AsAny() anyBetaSessionResourceUpdateResponse
- func (u BetaSessionResourceUpdateResponseUnion) AsFile() (v BetaManagedAgentsFileResource)
- func (u BetaSessionResourceUpdateResponseUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResource)
- func (u BetaSessionResourceUpdateResponseUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResource)
- func (u BetaSessionResourceUpdateResponseUnion) RawJSON() string
- func (r *BetaSessionResourceUpdateResponseUnion) UnmarshalJSON(data []byte) error
- type BetaSessionService
- func (r *BetaSessionService) Archive(ctx context.Context, sessionID string, body BetaSessionArchiveParams, ...) (res *BetaManagedAgentsSession, err error)
- func (r *BetaSessionService) Delete(ctx context.Context, sessionID string, body BetaSessionDeleteParams, ...) (res *BetaManagedAgentsDeletedSession, err error)
- func (r *BetaSessionService) Get(ctx context.Context, sessionID string, query BetaSessionGetParams, ...) (res *BetaManagedAgentsSession, err error)
- func (r *BetaSessionService) List(ctx context.Context, params BetaSessionListParams, ...) (res *pagination.PageCursor[BetaManagedAgentsSession], err error)
- func (r *BetaSessionService) ListAutoPaging(ctx context.Context, params BetaSessionListParams, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsSession]
- func (r *BetaSessionService) New(ctx context.Context, params BetaSessionNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsSession, err error)
- func (r *BetaSessionService) Update(ctx context.Context, sessionID string, params BetaSessionUpdateParams, ...) (res *BetaManagedAgentsSession, err error)
- type BetaSessionUpdateParams
- type BetaSignatureDelta
- type BetaSkill
- type BetaSkillDeleteParams
- type BetaSkillDeleteResponse
- type BetaSkillGetParams
- type BetaSkillGetResponse
- type BetaSkillListParams
- type BetaSkillListResponse
- type BetaSkillNewParams
- type BetaSkillNewResponse
- type BetaSkillParams
- type BetaSkillParamsType
- type BetaSkillService
- func (r *BetaSkillService) Delete(ctx context.Context, skillID string, body BetaSkillDeleteParams, ...) (res *BetaSkillDeleteResponse, err error)
- func (r *BetaSkillService) Get(ctx context.Context, skillID string, query BetaSkillGetParams, ...) (res *BetaSkillGetResponse, err error)
- func (r *BetaSkillService) List(ctx context.Context, params BetaSkillListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaSkillListResponse], err error)
- func (r *BetaSkillService) ListAutoPaging(ctx context.Context, params BetaSkillListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaSkillListResponse]
- func (r *BetaSkillService) New(ctx context.Context, params BetaSkillNewParams, opts ...option.RequestOption) (res *BetaSkillNewResponse, err error)
- type BetaSkillType
- type BetaSkillVersionDeleteParams
- type BetaSkillVersionDeleteResponse
- type BetaSkillVersionGetParams
- type BetaSkillVersionGetResponse
- type BetaSkillVersionListParams
- type BetaSkillVersionListResponse
- type BetaSkillVersionNewParams
- type BetaSkillVersionNewResponse
- type BetaSkillVersionService
- func (r *BetaSkillVersionService) Delete(ctx context.Context, version string, params BetaSkillVersionDeleteParams, ...) (res *BetaSkillVersionDeleteResponse, err error)
- func (r *BetaSkillVersionService) Get(ctx context.Context, version string, params BetaSkillVersionGetParams, ...) (res *BetaSkillVersionGetResponse, err error)
- func (r *BetaSkillVersionService) List(ctx context.Context, skillID string, params BetaSkillVersionListParams, ...) (res *pagination.PageCursor[BetaSkillVersionListResponse], err error)
- func (r *BetaSkillVersionService) ListAutoPaging(ctx context.Context, skillID string, params BetaSkillVersionListParams, ...) *pagination.PageCursorAutoPager[BetaSkillVersionListResponse]
- func (r *BetaSkillVersionService) New(ctx context.Context, skillID string, params BetaSkillVersionNewParams, ...) (res *BetaSkillVersionNewResponse, err error)
- type BetaStopReason
- type BetaTextBlock
- type BetaTextBlockParam
- type BetaTextCitationParamUnion
- func (u BetaTextCitationParamUnion) GetCitedText() *string
- func (u BetaTextCitationParamUnion) GetDocumentIndex() *int64
- func (u BetaTextCitationParamUnion) GetDocumentTitle() *string
- func (u BetaTextCitationParamUnion) GetEncryptedIndex() *string
- func (u BetaTextCitationParamUnion) GetEndBlockIndex() *int64
- func (u BetaTextCitationParamUnion) GetEndCharIndex() *int64
- func (u BetaTextCitationParamUnion) GetEndPageNumber() *int64
- func (u BetaTextCitationParamUnion) GetSearchResultIndex() *int64
- func (u BetaTextCitationParamUnion) GetSource() *string
- func (u BetaTextCitationParamUnion) GetStartBlockIndex() *int64
- func (u BetaTextCitationParamUnion) GetStartCharIndex() *int64
- func (u BetaTextCitationParamUnion) GetStartPageNumber() *int64
- func (u BetaTextCitationParamUnion) GetTitle() *string
- func (u BetaTextCitationParamUnion) GetType() *string
- func (u BetaTextCitationParamUnion) GetURL() *string
- func (u BetaTextCitationParamUnion) MarshalJSON() ([]byte, error)
- func (u *BetaTextCitationParamUnion) UnmarshalJSON(data []byte) error
- type BetaTextCitationUnion
- func (u BetaTextCitationUnion) AsAny() anyBetaTextCitation
- func (u BetaTextCitationUnion) AsCharLocation() (v BetaCitationCharLocation)
- func (u BetaTextCitationUnion) AsContentBlockLocation() (v BetaCitationContentBlockLocation)
- func (u BetaTextCitationUnion) AsPageLocation() (v BetaCitationPageLocation)
- func (u BetaTextCitationUnion) AsSearchResultLocation() (v BetaCitationSearchResultLocation)
- func (u BetaTextCitationUnion) AsWebSearchResultLocation() (v BetaCitationsWebSearchResultLocation)
- func (u BetaTextCitationUnion) RawJSON() string
- func (r *BetaTextCitationUnion) UnmarshalJSON(data []byte) error
- type BetaTextDelta
- type BetaTextEditorCodeExecutionCreateResultBlock
- type BetaTextEditorCodeExecutionCreateResultBlockParam
- type BetaTextEditorCodeExecutionStrReplaceResultBlock
- type BetaTextEditorCodeExecutionStrReplaceResultBlockParam
- type BetaTextEditorCodeExecutionToolResultBlock
- type BetaTextEditorCodeExecutionToolResultBlockContentUnion
- func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock() (v BetaTextEditorCodeExecutionCreateResultBlock)
- func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock() (v BetaTextEditorCodeExecutionStrReplaceResultBlock)
- func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError() (v BetaTextEditorCodeExecutionToolResultError)
- func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock() (v BetaTextEditorCodeExecutionViewResultBlock)
- func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) RawJSON() string
- func (r *BetaTextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaTextEditorCodeExecutionToolResultBlockParam
- type BetaTextEditorCodeExecutionToolResultBlockParamContentUnion
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent() *string
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage() *string
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType() *string
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate() *bool
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines() []string
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines() *int64
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetType() *string
- func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaTextEditorCodeExecutionToolResultError
- type BetaTextEditorCodeExecutionToolResultErrorErrorCode
- type BetaTextEditorCodeExecutionToolResultErrorParam
- type BetaTextEditorCodeExecutionToolResultErrorParamErrorCode
- type BetaTextEditorCodeExecutionViewResultBlock
- type BetaTextEditorCodeExecutionViewResultBlockFileType
- type BetaTextEditorCodeExecutionViewResultBlockParam
- type BetaTextEditorCodeExecutionViewResultBlockParamFileType
- type BetaThinkingBlock
- type BetaThinkingBlockParam
- type BetaThinkingCapability
- type BetaThinkingConfigAdaptiveDisplay
- type BetaThinkingConfigAdaptiveParam
- type BetaThinkingConfigDisabledParam
- type BetaThinkingConfigEnabledDisplay
- type BetaThinkingConfigEnabledParam
- type BetaThinkingConfigParamUnion
- func (u BetaThinkingConfigParamUnion) GetBudgetTokens() *int64
- func (u BetaThinkingConfigParamUnion) GetDisplay() *string
- func (u BetaThinkingConfigParamUnion) GetType() *string
- func (u BetaThinkingConfigParamUnion) MarshalJSON() ([]byte, error)
- func (u *BetaThinkingConfigParamUnion) UnmarshalJSON(data []byte) error
- type BetaThinkingDelta
- type BetaThinkingTurnsParam
- type BetaThinkingTypes
- type BetaTokenTaskBudgetParam
- type BetaTool
- type BetaToolBash20241022Param
- type BetaToolBash20250124Param
- type BetaToolChoiceAnyParam
- type BetaToolChoiceAutoParam
- type BetaToolChoiceNoneParam
- type BetaToolChoiceToolParam
- type BetaToolChoiceUnionParam
- func (u BetaToolChoiceUnionParam) GetDisableParallelToolUse() *bool
- func (u BetaToolChoiceUnionParam) GetName() *string
- func (u BetaToolChoiceUnionParam) GetType() *string
- func (u BetaToolChoiceUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaToolChoiceUnionParam) UnmarshalJSON(data []byte) error
- type BetaToolComputerUse20241022Param
- type BetaToolComputerUse20250124Param
- type BetaToolComputerUse20251124Param
- type BetaToolInputSchemaParam
- type BetaToolParam
- type BetaToolReferenceBlock
- type BetaToolReferenceBlockParam
- type BetaToolResultBlockParam
- type BetaToolResultBlockParamContentUnion
- func (u BetaToolResultBlockParamContentUnion) GetCacheControl() *BetaCacheControlEphemeralParam
- func (u BetaToolResultBlockParamContentUnion) GetCitations() (res betaToolResultBlockParamContentUnionCitations)
- func (u BetaToolResultBlockParamContentUnion) GetContent() []BetaTextBlockParam
- func (u BetaToolResultBlockParamContentUnion) GetContext() *string
- func (u BetaToolResultBlockParamContentUnion) GetSource() (res betaToolResultBlockParamContentUnionSource)
- func (u BetaToolResultBlockParamContentUnion) GetText() *string
- func (u BetaToolResultBlockParamContentUnion) GetTitle() *string
- func (u BetaToolResultBlockParamContentUnion) GetToolName() *string
- func (u BetaToolResultBlockParamContentUnion) GetType() *string
- func (u BetaToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaToolRunner
- func (r *BetaToolRunner) All(ctx context.Context) iter.Seq2[*BetaMessage, error]
- func (b *BetaToolRunner) AppendMessages(messages ...BetaMessageParam)
- func (b *BetaToolRunner) Err() error
- func (b *BetaToolRunner) IsCompleted() bool
- func (b *BetaToolRunner) IterationCount() int
- func (b *BetaToolRunner) LastMessage() *BetaMessage
- func (b *BetaToolRunner) Messages() []BetaMessageParam
- func (r *BetaToolRunner) NextMessage(ctx context.Context) (*BetaMessage, error)
- func (r *BetaToolRunner) RunToCompletion(ctx context.Context) (*BetaMessage, error)
- type BetaToolRunnerParams
- type BetaToolRunnerStreaming
- func (r *BetaToolRunnerStreaming) AllStreaming(ctx context.Context) iter.Seq2[iter.Seq2[BetaRawMessageStreamEventUnion, error], error]
- func (b *BetaToolRunnerStreaming) AppendMessages(messages ...BetaMessageParam)
- func (b *BetaToolRunnerStreaming) Err() error
- func (b *BetaToolRunnerStreaming) IsCompleted() bool
- func (b *BetaToolRunnerStreaming) IterationCount() int
- func (b *BetaToolRunnerStreaming) LastMessage() *BetaMessage
- func (b *BetaToolRunnerStreaming) Messages() []BetaMessageParam
- func (r *BetaToolRunnerStreaming) NextStreaming(ctx context.Context) iter.Seq2[BetaRawMessageStreamEventUnion, error]
- type BetaToolSearchToolBm25_20251119Param
- type BetaToolSearchToolBm25_20251119Type
- type BetaToolSearchToolRegex20251119Param
- type BetaToolSearchToolRegex20251119Type
- type BetaToolSearchToolResultBlock
- type BetaToolSearchToolResultBlockContentUnion
- func (u BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError() (v BetaToolSearchToolResultError)
- func (u BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock() (v BetaToolSearchToolSearchResultBlock)
- func (u BetaToolSearchToolResultBlockContentUnion) RawJSON() string
- func (r *BetaToolSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaToolSearchToolResultBlockParam
- type BetaToolSearchToolResultBlockParamContentUnion
- func (u BetaToolSearchToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BetaToolSearchToolResultBlockParamContentUnion) GetToolReferences() []BetaToolReferenceBlockParam
- func (u BetaToolSearchToolResultBlockParamContentUnion) GetType() *string
- func (u BetaToolSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaToolSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaToolSearchToolResultError
- type BetaToolSearchToolResultErrorErrorCode
- type BetaToolSearchToolResultErrorParam
- type BetaToolSearchToolResultErrorParamErrorCode
- type BetaToolSearchToolSearchResultBlock
- type BetaToolSearchToolSearchResultBlockParam
- type BetaToolTextEditor20241022Param
- type BetaToolTextEditor20250124Param
- type BetaToolTextEditor20250429Param
- type BetaToolTextEditor20250728Param
- type BetaToolType
- type BetaToolUnionParam
- func BetaToolUnionParamOfAdvisorTool20260301(model Model) BetaToolUnionParam
- func BetaToolUnionParamOfComputerUseTool20241022(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam
- func BetaToolUnionParamOfComputerUseTool20250124(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam
- func BetaToolUnionParamOfComputerUseTool20251124(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam
- func BetaToolUnionParamOfMCPToolset(mcpServerName string) BetaToolUnionParam
- func BetaToolUnionParamOfTool(inputSchema BetaToolInputSchemaParam, name string) BetaToolUnionParam
- func BetaToolUnionParamOfToolSearchToolBm25_20251119(type_ BetaToolSearchToolBm25_20251119Type) BetaToolUnionParam
- func BetaToolUnionParamOfToolSearchToolRegex20251119(type_ BetaToolSearchToolRegex20251119Type) BetaToolUnionParam
- func (u BetaToolUnionParam) GetAllowedCallers() []string
- func (u BetaToolUnionParam) GetAllowedDomains() []string
- func (u BetaToolUnionParam) GetBlockedDomains() []string
- func (u BetaToolUnionParam) GetCacheControl() *BetaCacheControlEphemeralParam
- func (u BetaToolUnionParam) GetCaching() *BetaCacheControlEphemeralParam
- func (u BetaToolUnionParam) GetCitations() *BetaCitationsConfigParam
- func (u BetaToolUnionParam) GetConfigs() map[string]BetaMCPToolConfigParam
- func (u BetaToolUnionParam) GetDefaultConfig() *BetaMCPToolDefaultConfigParam
- func (u BetaToolUnionParam) GetDeferLoading() *bool
- func (u BetaToolUnionParam) GetDescription() *string
- func (u BetaToolUnionParam) GetDisplayHeightPx() *int64
- func (u BetaToolUnionParam) GetDisplayNumber() *int64
- func (u BetaToolUnionParam) GetDisplayWidthPx() *int64
- func (u BetaToolUnionParam) GetEagerInputStreaming() *bool
- func (u BetaToolUnionParam) GetEnableZoom() *bool
- func (u BetaToolUnionParam) GetInputExamples() []map[string]any
- func (u BetaToolUnionParam) GetInputSchema() *BetaToolInputSchemaParam
- func (u BetaToolUnionParam) GetMCPServerName() *string
- func (u BetaToolUnionParam) GetMaxCharacters() *int64
- func (u BetaToolUnionParam) GetMaxContentTokens() *int64
- func (u BetaToolUnionParam) GetMaxUses() *int64
- func (u BetaToolUnionParam) GetModel() *Model
- func (u BetaToolUnionParam) GetName() *string
- func (u BetaToolUnionParam) GetStrict() *bool
- func (u BetaToolUnionParam) GetType() *string
- func (u BetaToolUnionParam) GetUseCache() *bool
- func (u BetaToolUnionParam) GetUserLocation() *BetaUserLocationParam
- func (u BetaToolUnionParam) MarshalJSON() ([]byte, error)
- func (u *BetaToolUnionParam) UnmarshalJSON(data []byte) error
- type BetaToolUseBlock
- type BetaToolUseBlockCallerUnion
- func (u BetaToolUseBlockCallerUnion) AsAny() anyBetaToolUseBlockCaller
- func (u BetaToolUseBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
- func (u BetaToolUseBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
- func (u BetaToolUseBlockCallerUnion) AsDirect() (v BetaDirectCaller)
- func (u BetaToolUseBlockCallerUnion) RawJSON() string
- func (r *BetaToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
- type BetaToolUseBlockParam
- type BetaToolUseBlockParamCallerUnion
- type BetaToolUsesKeepParam
- type BetaToolUsesTriggerParam
- type BetaURLImageSourceParam
- type BetaURLPDFSourceParam
- type BetaUnrestrictedNetwork
- type BetaUnrestrictedNetworkParam
- type BetaUsage
- type BetaUsageServiceTier
- type BetaUsageSpeed
- type BetaUserLocationParam
- type BetaUserProfile
- type BetaUserProfileEnrollmentURL
- type BetaUserProfileEnrollmentURLType
- type BetaUserProfileGetParams
- type BetaUserProfileListParams
- type BetaUserProfileListParamsOrder
- type BetaUserProfileNewEnrollmentURLParams
- type BetaUserProfileNewParams
- type BetaUserProfileService
- func (r *BetaUserProfileService) Get(ctx context.Context, userProfileID string, query BetaUserProfileGetParams, ...) (res *BetaUserProfile, err error)
- func (r *BetaUserProfileService) List(ctx context.Context, params BetaUserProfileListParams, ...) (res *pagination.PageCursor[BetaUserProfile], err error)
- func (r *BetaUserProfileService) ListAutoPaging(ctx context.Context, params BetaUserProfileListParams, ...) *pagination.PageCursorAutoPager[BetaUserProfile]
- func (r *BetaUserProfileService) New(ctx context.Context, params BetaUserProfileNewParams, ...) (res *BetaUserProfile, err error)
- func (r *BetaUserProfileService) NewEnrollmentURL(ctx context.Context, userProfileID string, ...) (res *BetaUserProfileEnrollmentURL, err error)
- func (r *BetaUserProfileService) Update(ctx context.Context, userProfileID string, params BetaUserProfileUpdateParams, ...) (res *BetaUserProfile, err error)
- type BetaUserProfileTrustGrant
- type BetaUserProfileTrustGrantStatus
- type BetaUserProfileType
- type BetaUserProfileUpdateParams
- type BetaVaultArchiveParams
- type BetaVaultCredentialArchiveParams
- type BetaVaultCredentialDeleteParams
- type BetaVaultCredentialGetParams
- type BetaVaultCredentialListParams
- type BetaVaultCredentialNewParams
- type BetaVaultCredentialNewParamsAuthUnion
- func (u BetaVaultCredentialNewParamsAuthUnion) GetAccessToken() *string
- func (u BetaVaultCredentialNewParamsAuthUnion) GetExpiresAt() *time.Time
- func (u BetaVaultCredentialNewParamsAuthUnion) GetMCPServerURL() *string
- func (u BetaVaultCredentialNewParamsAuthUnion) GetRefresh() *BetaManagedAgentsMCPOAuthRefreshParams
- func (u BetaVaultCredentialNewParamsAuthUnion) GetToken() *string
- func (u BetaVaultCredentialNewParamsAuthUnion) GetType() *string
- func (u BetaVaultCredentialNewParamsAuthUnion) MarshalJSON() ([]byte, error)
- func (u *BetaVaultCredentialNewParamsAuthUnion) UnmarshalJSON(data []byte) error
- type BetaVaultCredentialService
- func (r *BetaVaultCredentialService) Archive(ctx context.Context, credentialID string, ...) (res *BetaManagedAgentsCredential, err error)
- func (r *BetaVaultCredentialService) Delete(ctx context.Context, credentialID string, ...) (res *BetaManagedAgentsDeletedCredential, err error)
- func (r *BetaVaultCredentialService) Get(ctx context.Context, credentialID string, params BetaVaultCredentialGetParams, ...) (res *BetaManagedAgentsCredential, err error)
- func (r *BetaVaultCredentialService) List(ctx context.Context, vaultID string, params BetaVaultCredentialListParams, ...) (res *pagination.PageCursor[BetaManagedAgentsCredential], err error)
- func (r *BetaVaultCredentialService) ListAutoPaging(ctx context.Context, vaultID string, params BetaVaultCredentialListParams, ...) *pagination.PageCursorAutoPager[BetaManagedAgentsCredential]
- func (r *BetaVaultCredentialService) New(ctx context.Context, vaultID string, params BetaVaultCredentialNewParams, ...) (res *BetaManagedAgentsCredential, err error)
- func (r *BetaVaultCredentialService) Update(ctx context.Context, credentialID string, ...) (res *BetaManagedAgentsCredential, err error)
- type BetaVaultCredentialUpdateParams
- type BetaVaultCredentialUpdateParamsAuthUnion
- func (u BetaVaultCredentialUpdateParamsAuthUnion) GetAccessToken() *string
- func (u BetaVaultCredentialUpdateParamsAuthUnion) GetExpiresAt() *time.Time
- func (u BetaVaultCredentialUpdateParamsAuthUnion) GetRefresh() *BetaManagedAgentsMCPOAuthRefreshUpdateParams
- func (u BetaVaultCredentialUpdateParamsAuthUnion) GetToken() *string
- func (u BetaVaultCredentialUpdateParamsAuthUnion) GetType() *string
- func (u BetaVaultCredentialUpdateParamsAuthUnion) MarshalJSON() ([]byte, error)
- func (u *BetaVaultCredentialUpdateParamsAuthUnion) UnmarshalJSON(data []byte) error
- type BetaVaultDeleteParams
- type BetaVaultGetParams
- type BetaVaultListParams
- type BetaVaultNewParams
- type BetaVaultService
- func (r *BetaVaultService) Archive(ctx context.Context, vaultID string, body BetaVaultArchiveParams, ...) (res *BetaManagedAgentsVault, err error)
- func (r *BetaVaultService) Delete(ctx context.Context, vaultID string, body BetaVaultDeleteParams, ...) (res *BetaManagedAgentsDeletedVault, err error)
- func (r *BetaVaultService) Get(ctx context.Context, vaultID string, query BetaVaultGetParams, ...) (res *BetaManagedAgentsVault, err error)
- func (r *BetaVaultService) List(ctx context.Context, params BetaVaultListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsVault], err error)
- func (r *BetaVaultService) ListAutoPaging(ctx context.Context, params BetaVaultListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsVault]
- func (r *BetaVaultService) New(ctx context.Context, params BetaVaultNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsVault, err error)
- func (r *BetaVaultService) Update(ctx context.Context, vaultID string, params BetaVaultUpdateParams, ...) (res *BetaManagedAgentsVault, err error)
- type BetaVaultUpdateParams
- type BetaWebFetchBlock
- type BetaWebFetchBlockParam
- type BetaWebFetchTool20250910Param
- type BetaWebFetchTool20260209Param
- type BetaWebFetchTool20260309Param
- type BetaWebFetchToolResultBlock
- type BetaWebFetchToolResultBlockCallerUnion
- func (u BetaWebFetchToolResultBlockCallerUnion) AsAny() anyBetaWebFetchToolResultBlockCaller
- func (u BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
- func (u BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
- func (u BetaWebFetchToolResultBlockCallerUnion) AsDirect() (v BetaDirectCaller)
- func (u BetaWebFetchToolResultBlockCallerUnion) RawJSON() string
- func (r *BetaWebFetchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
- type BetaWebFetchToolResultBlockContentUnion
- func (u BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock() (v BetaWebFetchBlock)
- func (u BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError() (v BetaWebFetchToolResultErrorBlock)
- func (u BetaWebFetchToolResultBlockContentUnion) RawJSON() string
- func (r *BetaWebFetchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaWebFetchToolResultBlockParam
- type BetaWebFetchToolResultBlockParamCallerUnion
- func (u BetaWebFetchToolResultBlockParamCallerUnion) GetToolID() *string
- func (u BetaWebFetchToolResultBlockParamCallerUnion) GetType() *string
- func (u BetaWebFetchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
- func (u *BetaWebFetchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
- type BetaWebFetchToolResultBlockParamContentUnion
- func (u BetaWebFetchToolResultBlockParamContentUnion) GetContent() *BetaRequestDocumentBlockParam
- func (u BetaWebFetchToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u BetaWebFetchToolResultBlockParamContentUnion) GetRetrievedAt() *string
- func (u BetaWebFetchToolResultBlockParamContentUnion) GetType() *string
- func (u BetaWebFetchToolResultBlockParamContentUnion) GetURL() *string
- func (u BetaWebFetchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *BetaWebFetchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type BetaWebFetchToolResultErrorBlock
- type BetaWebFetchToolResultErrorBlockParam
- type BetaWebFetchToolResultErrorCode
- type BetaWebSearchResultBlock
- type BetaWebSearchResultBlockParam
- type BetaWebSearchTool20250305Param
- type BetaWebSearchTool20260209Param
- type BetaWebSearchToolRequestErrorParam
- type BetaWebSearchToolResultBlock
- type BetaWebSearchToolResultBlockCallerUnion
- func (u BetaWebSearchToolResultBlockCallerUnion) AsAny() anyBetaWebSearchToolResultBlockCaller
- func (u BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
- func (u BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
- func (u BetaWebSearchToolResultBlockCallerUnion) AsDirect() (v BetaDirectCaller)
- func (u BetaWebSearchToolResultBlockCallerUnion) RawJSON() string
- func (r *BetaWebSearchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
- type BetaWebSearchToolResultBlockContentUnion
- func (u BetaWebSearchToolResultBlockContentUnion) AsBetaWebSearchResultBlockArray() (v []BetaWebSearchResultBlock)
- func (u BetaWebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError() (v BetaWebSearchToolResultError)
- func (u BetaWebSearchToolResultBlockContentUnion) RawJSON() string
- func (r *BetaWebSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type BetaWebSearchToolResultBlockParam
- type BetaWebSearchToolResultBlockParamCallerUnion
- func (u BetaWebSearchToolResultBlockParamCallerUnion) GetToolID() *string
- func (u BetaWebSearchToolResultBlockParamCallerUnion) GetType() *string
- func (u BetaWebSearchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
- func (u *BetaWebSearchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
- type BetaWebSearchToolResultBlockParamContentUnion
- type BetaWebSearchToolResultError
- type BetaWebSearchToolResultErrorCode
- type BillingError
- type CacheControlEphemeralParam
- type CacheControlEphemeralTTL
- type CacheCreation
- type CapabilitySupport
- type CitationCharLocation
- type CitationCharLocationParam
- type CitationContentBlockLocation
- type CitationContentBlockLocationParam
- type CitationPageLocation
- type CitationPageLocationParam
- type CitationSearchResultLocationParam
- type CitationWebSearchResultLocationParam
- type CitationsConfig
- type CitationsConfigParam
- type CitationsDelta
- type CitationsDeltaCitationUnion
- func (u CitationsDeltaCitationUnion) AsAny() anyCitationsDeltaCitation
- func (u CitationsDeltaCitationUnion) AsCharLocation() (v CitationCharLocation)
- func (u CitationsDeltaCitationUnion) AsContentBlockLocation() (v CitationContentBlockLocation)
- func (u CitationsDeltaCitationUnion) AsPageLocation() (v CitationPageLocation)
- func (u CitationsDeltaCitationUnion) AsSearchResultLocation() (v CitationsSearchResultLocation)
- func (u CitationsDeltaCitationUnion) AsWebSearchResultLocation() (v CitationsWebSearchResultLocation)
- func (u CitationsDeltaCitationUnion) RawJSON() string
- func (r *CitationsDeltaCitationUnion) UnmarshalJSON(data []byte) error
- type CitationsSearchResultLocation
- type CitationsWebSearchResultLocation
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type CodeExecutionOutputBlock
- type CodeExecutionOutputBlockParam
- type CodeExecutionResultBlock
- type CodeExecutionResultBlockParam
- type CodeExecutionTool20250522Param
- type CodeExecutionTool20250825Param
- type CodeExecutionTool20260120Param
- type CodeExecutionToolResultBlock
- type CodeExecutionToolResultBlockContentUnion
- func (u CodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock() (v CodeExecutionResultBlock)
- func (u CodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError() (v CodeExecutionToolResultError)
- func (u CodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock() (v EncryptedCodeExecutionResultBlock)
- func (u CodeExecutionToolResultBlockContentUnion) RawJSON() string
- func (r *CodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type CodeExecutionToolResultBlockParam
- type CodeExecutionToolResultBlockParamContentUnion
- func (u CodeExecutionToolResultBlockParamContentUnion) GetContent() []CodeExecutionOutputBlockParam
- func (u CodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout() *string
- func (u CodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u CodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
- func (u CodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
- func (u CodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
- func (u CodeExecutionToolResultBlockParamContentUnion) GetType() *string
- func (u CodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *CodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type CodeExecutionToolResultError
- type CodeExecutionToolResultErrorCode
- type CodeExecutionToolResultErrorParam
- type Completion
- type CompletionNewParams
- type CompletionService
- type Container
- type ContainerUploadBlock
- type ContainerUploadBlockParam
- type ContentBlockDeltaEvent
- type ContentBlockParamUnion
- func NewBashCodeExecutionToolResultBlock[T BashCodeExecutionToolResultErrorParam | BashCodeExecutionResultBlockParam](content T, toolUseID string) ContentBlockParamUnion
- func NewCodeExecutionToolResultBlock[...](content T, toolUseID string) ContentBlockParamUnion
- func NewContainerUploadBlock(fileID string) ContentBlockParamUnion
- func NewDocumentBlock[...](source T) ContentBlockParamUnion
- func NewImageBlock[T Base64ImageSourceParam | URLImageSourceParam](source T) ContentBlockParamUnion
- func NewImageBlockBase64(mediaType string, encodedData string) ContentBlockParamUnion
- func NewRedactedThinkingBlock(data string) ContentBlockParamUnion
- func NewSearchResultBlock(content []TextBlockParam, source string, title string) ContentBlockParamUnion
- func NewServerToolUseBlock(id string, input any, name ServerToolUseBlockParamName) ContentBlockParamUnion
- func NewTextBlock(text string) ContentBlockParamUnion
- func NewTextEditorCodeExecutionToolResultBlock[...](content T, toolUseID string) ContentBlockParamUnion
- func NewThinkingBlock(signature string, thinking string) ContentBlockParamUnion
- func NewToolResultBlock(toolUseID string, content string, isError bool) ContentBlockParamUnion
- func NewToolSearchToolResultBlock[T ToolSearchToolResultErrorParam | ToolSearchToolSearchResultBlockParam](content T, toolUseID string) ContentBlockParamUnion
- func NewToolUseBlock(id string, input any, name string) ContentBlockParamUnion
- func NewWebFetchToolResultBlock[T WebFetchToolResultErrorBlockParam | WebFetchBlockParam](content T, toolUseID string) ContentBlockParamUnion
- func NewWebSearchToolResultBlock[T []WebSearchResultBlockParam | WebSearchToolRequestErrorParam](content T, toolUseID string) ContentBlockParamUnion
- func (u ContentBlockParamUnion) GetCacheControl() *CacheControlEphemeralParam
- func (u ContentBlockParamUnion) GetCaller() (res contentBlockParamUnionCaller)
- func (u ContentBlockParamUnion) GetCitations() (res contentBlockParamUnionCitations)
- func (u ContentBlockParamUnion) GetContent() (res contentBlockParamUnionContent)
- func (u ContentBlockParamUnion) GetContext() *string
- func (u ContentBlockParamUnion) GetData() *string
- func (u ContentBlockParamUnion) GetFileID() *string
- func (u ContentBlockParamUnion) GetID() *string
- func (u ContentBlockParamUnion) GetInput() *any
- func (u ContentBlockParamUnion) GetIsError() *bool
- func (u ContentBlockParamUnion) GetName() *string
- func (u ContentBlockParamUnion) GetSignature() *string
- func (u ContentBlockParamUnion) GetSource() (res contentBlockParamUnionSource)
- func (u ContentBlockParamUnion) GetText() *string
- func (u ContentBlockParamUnion) GetThinking() *string
- func (u ContentBlockParamUnion) GetTitle() *string
- func (u ContentBlockParamUnion) GetToolUseID() *string
- func (u ContentBlockParamUnion) GetType() *string
- func (u ContentBlockParamUnion) MarshalJSON() ([]byte, error)
- func (u *ContentBlockParamUnion) UnmarshalJSON(data []byte) error
- type ContentBlockSourceContentItemUnionParam
- func (u ContentBlockSourceContentItemUnionParam) GetCacheControl() *CacheControlEphemeralParam
- func (u ContentBlockSourceContentItemUnionParam) GetCitations() []TextCitationParamUnion
- func (u ContentBlockSourceContentItemUnionParam) GetSource() *ImageBlockParamSourceUnion
- func (u ContentBlockSourceContentItemUnionParam) GetText() *string
- func (u ContentBlockSourceContentItemUnionParam) GetType() *string
- func (u ContentBlockSourceContentItemUnionParam) MarshalJSON() ([]byte, error)
- func (u *ContentBlockSourceContentItemUnionParam) UnmarshalJSON(data []byte) error
- type ContentBlockSourceContentUnionParam
- type ContentBlockSourceParam
- type ContentBlockStartEvent
- type ContentBlockStartEventContentBlockUnion
- func (u ContentBlockStartEventContentBlockUnion) AsAny() anyContentBlockStartEventContentBlock
- func (u ContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult() (v BashCodeExecutionToolResultBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult() (v CodeExecutionToolResultBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsContainerUpload() (v ContainerUploadBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsRedactedThinking() (v RedactedThinkingBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsServerToolUse() (v ServerToolUseBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsText() (v TextBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v TextEditorCodeExecutionToolResultBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsThinking() (v ThinkingBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsToolSearchToolResult() (v ToolSearchToolResultBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsToolUse() (v ToolUseBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsWebFetchToolResult() (v WebFetchToolResultBlock)
- func (u ContentBlockStartEventContentBlockUnion) AsWebSearchToolResult() (v WebSearchToolResultBlock)
- func (u ContentBlockStartEventContentBlockUnion) RawJSON() string
- func (r *ContentBlockStartEventContentBlockUnion) UnmarshalJSON(data []byte) error
- type ContentBlockStartEventContentBlockUnionCaller
- type ContentBlockStartEventContentBlockUnionContent
- type ContentBlockStartEventContentBlockUnionContentContent
- type ContentBlockStopEvent
- type ContentBlockUnion
- func (u ContentBlockUnion) AsAny() anyContentBlock
- func (u ContentBlockUnion) AsBashCodeExecutionToolResult() (v BashCodeExecutionToolResultBlock)
- func (u ContentBlockUnion) AsCodeExecutionToolResult() (v CodeExecutionToolResultBlock)
- func (u ContentBlockUnion) AsContainerUpload() (v ContainerUploadBlock)
- func (u ContentBlockUnion) AsRedactedThinking() (v RedactedThinkingBlock)
- func (u ContentBlockUnion) AsServerToolUse() (v ServerToolUseBlock)
- func (u ContentBlockUnion) AsText() (v TextBlock)
- func (u ContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v TextEditorCodeExecutionToolResultBlock)
- func (u ContentBlockUnion) AsThinking() (v ThinkingBlock)
- func (u ContentBlockUnion) AsToolSearchToolResult() (v ToolSearchToolResultBlock)
- func (u ContentBlockUnion) AsToolUse() (v ToolUseBlock)
- func (u ContentBlockUnion) AsWebFetchToolResult() (v WebFetchToolResultBlock)
- func (u ContentBlockUnion) AsWebSearchToolResult() (v WebSearchToolResultBlock)
- func (u ContentBlockUnion) RawJSON() string
- func (r ContentBlockUnion) ToParam() ContentBlockParamUnion
- func (r *ContentBlockUnion) UnmarshalJSON(data []byte) error
- type ContentBlockUnionCaller
- type ContentBlockUnionContent
- type ContentBlockUnionContentContent
- type ContextManagementCapability
- type DeletedFile
- type DeletedFileType
- type DeletedMessageBatch
- type DirectCaller
- type DirectCallerParam
- type DocumentBlock
- type DocumentBlockParam
- type DocumentBlockParamSourceUnion
- func (u DocumentBlockParamSourceUnion) GetContent() *ContentBlockSourceContentUnionParam
- func (u DocumentBlockParamSourceUnion) GetData() *string
- func (u DocumentBlockParamSourceUnion) GetMediaType() *string
- func (u DocumentBlockParamSourceUnion) GetType() *string
- func (u DocumentBlockParamSourceUnion) GetURL() *string
- func (u DocumentBlockParamSourceUnion) MarshalJSON() ([]byte, error)
- func (u *DocumentBlockParamSourceUnion) UnmarshalJSON(data []byte) error
- type DocumentBlockSourceUnion
- func (u DocumentBlockSourceUnion) AsAny() anyDocumentBlockSource
- func (u DocumentBlockSourceUnion) AsBase64() (v Base64PDFSource)
- func (u DocumentBlockSourceUnion) AsText() (v PlainTextSource)
- func (u DocumentBlockSourceUnion) RawJSON() string
- func (r *DocumentBlockSourceUnion) UnmarshalJSON(data []byte) error
- type EffortCapability
- type EncryptedCodeExecutionResultBlock
- type EncryptedCodeExecutionResultBlockParam
- type Error
- type ErrorObjectUnion
- type ErrorResponse
- type ErrorType
- type FileMetadata
- type GatewayTimeoutError
- type ImageBlockParam
- type ImageBlockParamSourceUnion
- func (u ImageBlockParamSourceUnion) GetData() *string
- func (u ImageBlockParamSourceUnion) GetMediaType() *string
- func (u ImageBlockParamSourceUnion) GetType() *string
- func (u ImageBlockParamSourceUnion) GetURL() *string
- func (u ImageBlockParamSourceUnion) MarshalJSON() ([]byte, error)
- func (u *ImageBlockParamSourceUnion) UnmarshalJSON(data []byte) error
- type InputJSONDelta
- type InvalidRequestError
- type JSONOutputFormatParam
- type MemoryTool20250818Param
- type Message
- type MessageBatch
- type MessageBatchCanceledResult
- type MessageBatchErroredResult
- type MessageBatchExpiredResult
- type MessageBatchIndividualResponse
- type MessageBatchListParams
- type MessageBatchNewParams
- type MessageBatchNewParamsRequest
- type MessageBatchNewParamsRequestParams
- type MessageBatchProcessingStatus
- type MessageBatchRequestCounts
- type MessageBatchResultUnion
- func (u MessageBatchResultUnion) AsAny() anyMessageBatchResult
- func (u MessageBatchResultUnion) AsCanceled() (v MessageBatchCanceledResult)
- func (u MessageBatchResultUnion) AsErrored() (v MessageBatchErroredResult)
- func (u MessageBatchResultUnion) AsExpired() (v MessageBatchExpiredResult)
- func (u MessageBatchResultUnion) AsSucceeded() (v MessageBatchSucceededResult)
- func (u MessageBatchResultUnion) RawJSON() string
- func (r *MessageBatchResultUnion) UnmarshalJSON(data []byte) error
- type MessageBatchService
- func (r *MessageBatchService) Cancel(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (res *MessageBatch, err error)
- func (r *MessageBatchService) Delete(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (res *DeletedMessageBatch, err error)
- func (r *MessageBatchService) Get(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (res *MessageBatch, err error)
- func (r *MessageBatchService) List(ctx context.Context, query MessageBatchListParams, ...) (res *pagination.Page[MessageBatch], err error)
- func (r *MessageBatchService) ListAutoPaging(ctx context.Context, query MessageBatchListParams, ...) *pagination.PageAutoPager[MessageBatch]
- func (r *MessageBatchService) New(ctx context.Context, body MessageBatchNewParams, opts ...option.RequestOption) (res *MessageBatch, err error)
- func (r *MessageBatchService) ResultsStreaming(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (stream *jsonl.Stream[MessageBatchIndividualResponse])
- type MessageBatchSucceededResult
- type MessageCountTokensParams
- type MessageCountTokensParamsSystemUnion
- type MessageCountTokensToolUnionParam
- func MessageCountTokensToolParamOfTool(inputSchema ToolInputSchemaParam, name string) MessageCountTokensToolUnionParam
- func MessageCountTokensToolParamOfToolSearchToolBm25_20251119(type_ ToolSearchToolBm25_20251119Type) MessageCountTokensToolUnionParam
- func MessageCountTokensToolParamOfToolSearchToolRegex20251119(type_ ToolSearchToolRegex20251119Type) MessageCountTokensToolUnionParam
- func (u MessageCountTokensToolUnionParam) GetAllowedCallers() []string
- func (u MessageCountTokensToolUnionParam) GetAllowedDomains() []string
- func (u MessageCountTokensToolUnionParam) GetBlockedDomains() []string
- func (u MessageCountTokensToolUnionParam) GetCacheControl() *CacheControlEphemeralParam
- func (u MessageCountTokensToolUnionParam) GetCitations() *CitationsConfigParam
- func (u MessageCountTokensToolUnionParam) GetDeferLoading() *bool
- func (u MessageCountTokensToolUnionParam) GetDescription() *string
- func (u MessageCountTokensToolUnionParam) GetEagerInputStreaming() *bool
- func (u MessageCountTokensToolUnionParam) GetInputExamples() []map[string]any
- func (u MessageCountTokensToolUnionParam) GetInputSchema() *ToolInputSchemaParam
- func (u MessageCountTokensToolUnionParam) GetMaxCharacters() *int64
- func (u MessageCountTokensToolUnionParam) GetMaxContentTokens() *int64
- func (u MessageCountTokensToolUnionParam) GetMaxUses() *int64
- func (u MessageCountTokensToolUnionParam) GetName() *string
- func (u MessageCountTokensToolUnionParam) GetStrict() *bool
- func (u MessageCountTokensToolUnionParam) GetType() *string
- func (u MessageCountTokensToolUnionParam) GetUseCache() *bool
- func (u MessageCountTokensToolUnionParam) GetUserLocation() *UserLocationParam
- func (u MessageCountTokensToolUnionParam) MarshalJSON() ([]byte, error)
- func (u *MessageCountTokensToolUnionParam) UnmarshalJSON(data []byte) error
- type MessageDeltaEvent
- type MessageDeltaEventDelta
- type MessageDeltaUsage
- type MessageNewParams
- type MessageNewParamsServiceTier
- type MessageParam
- type MessageParamRole
- type MessageService
- func (r *MessageService) CountTokens(ctx context.Context, body MessageCountTokensParams, ...) (res *MessageTokensCount, err error)
- func (r *MessageService) New(ctx context.Context, body MessageNewParams, opts ...option.RequestOption) (res *Message, err error)
- func (r *MessageService) NewStreaming(ctx context.Context, body MessageNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[MessageStreamEventUnion])
- type MessageStartEvent
- type MessageStopEvent
- type MessageStreamEventUnion
- func (u MessageStreamEventUnion) AsAny() anyMessageStreamEvent
- func (u MessageStreamEventUnion) AsContentBlockDelta() (v ContentBlockDeltaEvent)
- func (u MessageStreamEventUnion) AsContentBlockStart() (v ContentBlockStartEvent)
- func (u MessageStreamEventUnion) AsContentBlockStop() (v ContentBlockStopEvent)
- func (u MessageStreamEventUnion) AsMessageDelta() (v MessageDeltaEvent)
- func (u MessageStreamEventUnion) AsMessageStart() (v MessageStartEvent)
- func (u MessageStreamEventUnion) AsMessageStop() (v MessageStopEvent)
- func (u MessageStreamEventUnion) RawJSON() string
- func (r *MessageStreamEventUnion) UnmarshalJSON(data []byte) error
- type MessageStreamEventUnionDelta
- type MessageTokensCount
- type MetadataParam
- type Model
- type ModelCapabilities
- type ModelGetParams
- type ModelInfo
- type ModelListParams
- type ModelService
- func (r *ModelService) Get(ctx context.Context, modelID string, query ModelGetParams, ...) (res *ModelInfo, err error)
- func (r *ModelService) List(ctx context.Context, params ModelListParams, opts ...option.RequestOption) (res *pagination.Page[ModelInfo], err error)
- func (r *ModelService) ListAutoPaging(ctx context.Context, params ModelListParams, opts ...option.RequestOption) *pagination.PageAutoPager[ModelInfo]
- type NotFoundError
- type OutputConfigEffort
- type OutputConfigParam
- type OverloadedError
- type PermissionError
- type PlainTextSource
- type PlainTextSourceParam
- type RateLimitError
- type RawContentBlockDeltaUnion
- func (u RawContentBlockDeltaUnion) AsAny() anyRawContentBlockDelta
- func (u RawContentBlockDeltaUnion) AsCitationsDelta() (v CitationsDelta)
- func (u RawContentBlockDeltaUnion) AsInputJSONDelta() (v InputJSONDelta)
- func (u RawContentBlockDeltaUnion) AsSignatureDelta() (v SignatureDelta)
- func (u RawContentBlockDeltaUnion) AsTextDelta() (v TextDelta)
- func (u RawContentBlockDeltaUnion) AsThinkingDelta() (v ThinkingDelta)
- func (u RawContentBlockDeltaUnion) RawJSON() string
- func (r *RawContentBlockDeltaUnion) UnmarshalJSON(data []byte) error
- type RedactedThinkingBlock
- type RedactedThinkingBlockParam
- type RefusalStopDetails
- type RefusalStopDetailsCategory
- type SearchResultBlockParam
- type ServerToolCaller
- type ServerToolCaller20260120
- type ServerToolCaller20260120Param
- type ServerToolCallerParam
- type ServerToolUsage
- type ServerToolUseBlock
- type ServerToolUseBlockCallerUnion
- func (u ServerToolUseBlockCallerUnion) AsAny() anyServerToolUseBlockCaller
- func (u ServerToolUseBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
- func (u ServerToolUseBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
- func (u ServerToolUseBlockCallerUnion) AsDirect() (v DirectCaller)
- func (u ServerToolUseBlockCallerUnion) RawJSON() string
- func (r *ServerToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
- type ServerToolUseBlockName
- type ServerToolUseBlockParam
- type ServerToolUseBlockParamCallerUnion
- type ServerToolUseBlockParamName
- type SignatureDelta
- type StopReason
- type TextBlock
- type TextBlockParam
- type TextCitationParamUnion
- func (u TextCitationParamUnion) GetCitedText() *string
- func (u TextCitationParamUnion) GetDocumentIndex() *int64
- func (u TextCitationParamUnion) GetDocumentTitle() *string
- func (u TextCitationParamUnion) GetEncryptedIndex() *string
- func (u TextCitationParamUnion) GetEndBlockIndex() *int64
- func (u TextCitationParamUnion) GetEndCharIndex() *int64
- func (u TextCitationParamUnion) GetEndPageNumber() *int64
- func (u TextCitationParamUnion) GetSearchResultIndex() *int64
- func (u TextCitationParamUnion) GetSource() *string
- func (u TextCitationParamUnion) GetStartBlockIndex() *int64
- func (u TextCitationParamUnion) GetStartCharIndex() *int64
- func (u TextCitationParamUnion) GetStartPageNumber() *int64
- func (u TextCitationParamUnion) GetTitle() *string
- func (u TextCitationParamUnion) GetType() *string
- func (u TextCitationParamUnion) GetURL() *string
- func (u TextCitationParamUnion) MarshalJSON() ([]byte, error)
- func (u *TextCitationParamUnion) UnmarshalJSON(data []byte) error
- type TextCitationUnion
- func (u TextCitationUnion) AsAny() anyTextCitation
- func (u TextCitationUnion) AsCharLocation() (v CitationCharLocation)
- func (u TextCitationUnion) AsContentBlockLocation() (v CitationContentBlockLocation)
- func (u TextCitationUnion) AsPageLocation() (v CitationPageLocation)
- func (u TextCitationUnion) AsSearchResultLocation() (v CitationsSearchResultLocation)
- func (u TextCitationUnion) AsWebSearchResultLocation() (v CitationsWebSearchResultLocation)
- func (u TextCitationUnion) RawJSON() string
- func (r *TextCitationUnion) UnmarshalJSON(data []byte) error
- type TextDelta
- type TextEditorCodeExecutionCreateResultBlock
- type TextEditorCodeExecutionCreateResultBlockParam
- type TextEditorCodeExecutionStrReplaceResultBlock
- type TextEditorCodeExecutionStrReplaceResultBlockParam
- type TextEditorCodeExecutionToolResultBlock
- type TextEditorCodeExecutionToolResultBlockContentUnion
- func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock() (v TextEditorCodeExecutionCreateResultBlock)
- func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock() (v TextEditorCodeExecutionStrReplaceResultBlock)
- func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError() (v TextEditorCodeExecutionToolResultError)
- func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock() (v TextEditorCodeExecutionViewResultBlock)
- func (u TextEditorCodeExecutionToolResultBlockContentUnion) RawJSON() string
- func (r *TextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type TextEditorCodeExecutionToolResultBlockParam
- type TextEditorCodeExecutionToolResultBlockParamContentUnion
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent() *string
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage() *string
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType() *string
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate() *bool
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines() []string
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines() *int64
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetType() *string
- func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *TextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type TextEditorCodeExecutionToolResultError
- type TextEditorCodeExecutionToolResultErrorCode
- type TextEditorCodeExecutionToolResultErrorParam
- type TextEditorCodeExecutionViewResultBlock
- type TextEditorCodeExecutionViewResultBlockFileType
- type TextEditorCodeExecutionViewResultBlockParam
- type TextEditorCodeExecutionViewResultBlockParamFileType
- type ThinkingBlock
- type ThinkingBlockParam
- type ThinkingCapability
- type ThinkingConfigAdaptiveDisplay
- type ThinkingConfigAdaptiveParam
- type ThinkingConfigDisabledParam
- type ThinkingConfigEnabledDisplay
- type ThinkingConfigEnabledParam
- type ThinkingConfigParamUnion
- type ThinkingDelta
- type ThinkingTypes
- type ToolBash20250124Param
- type ToolChoiceAnyParam
- type ToolChoiceAutoParam
- type ToolChoiceNoneParam
- type ToolChoiceToolParam
- type ToolChoiceUnionParam
- type ToolInputSchemaParam
- type ToolParam
- type ToolReferenceBlock
- type ToolReferenceBlockParam
- type ToolResultBlockParam
- type ToolResultBlockParamContentUnion
- func (u ToolResultBlockParamContentUnion) GetCacheControl() *CacheControlEphemeralParam
- func (u ToolResultBlockParamContentUnion) GetCitations() (res toolResultBlockParamContentUnionCitations)
- func (u ToolResultBlockParamContentUnion) GetContent() []TextBlockParam
- func (u ToolResultBlockParamContentUnion) GetContext() *string
- func (u ToolResultBlockParamContentUnion) GetSource() (res toolResultBlockParamContentUnionSource)
- func (u ToolResultBlockParamContentUnion) GetText() *string
- func (u ToolResultBlockParamContentUnion) GetTitle() *string
- func (u ToolResultBlockParamContentUnion) GetToolName() *string
- func (u ToolResultBlockParamContentUnion) GetType() *string
- func (u ToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *ToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type ToolSearchToolBm25_20251119Param
- type ToolSearchToolBm25_20251119Type
- type ToolSearchToolRegex20251119Param
- type ToolSearchToolRegex20251119Type
- type ToolSearchToolResultBlock
- type ToolSearchToolResultBlockContentUnion
- func (u ToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError() (v ToolSearchToolResultError)
- func (u ToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock() (v ToolSearchToolSearchResultBlock)
- func (u ToolSearchToolResultBlockContentUnion) RawJSON() string
- func (r *ToolSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type ToolSearchToolResultBlockParam
- type ToolSearchToolResultBlockParamContentUnion
- func (u ToolSearchToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u ToolSearchToolResultBlockParamContentUnion) GetToolReferences() []ToolReferenceBlockParam
- func (u ToolSearchToolResultBlockParamContentUnion) GetType() *string
- func (u ToolSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *ToolSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type ToolSearchToolResultError
- type ToolSearchToolResultErrorCode
- type ToolSearchToolResultErrorParam
- type ToolSearchToolSearchResultBlock
- type ToolSearchToolSearchResultBlockParam
- type ToolTextEditor20250124Param
- type ToolTextEditor20250429Param
- type ToolTextEditor20250728Param
- type ToolType
- type ToolUnionParam
- func (u ToolUnionParam) GetAllowedCallers() []string
- func (u ToolUnionParam) GetAllowedDomains() []string
- func (u ToolUnionParam) GetBlockedDomains() []string
- func (u ToolUnionParam) GetCacheControl() *CacheControlEphemeralParam
- func (u ToolUnionParam) GetCitations() *CitationsConfigParam
- func (u ToolUnionParam) GetDeferLoading() *bool
- func (u ToolUnionParam) GetDescription() *string
- func (u ToolUnionParam) GetEagerInputStreaming() *bool
- func (u ToolUnionParam) GetInputExamples() []map[string]any
- func (u ToolUnionParam) GetInputSchema() *ToolInputSchemaParam
- func (u ToolUnionParam) GetMaxCharacters() *int64
- func (u ToolUnionParam) GetMaxContentTokens() *int64
- func (u ToolUnionParam) GetMaxUses() *int64
- func (u ToolUnionParam) GetName() *string
- func (u ToolUnionParam) GetStrict() *bool
- func (u ToolUnionParam) GetType() *string
- func (u ToolUnionParam) GetUseCache() *bool
- func (u ToolUnionParam) GetUserLocation() *UserLocationParam
- func (u ToolUnionParam) MarshalJSON() ([]byte, error)
- func (u *ToolUnionParam) UnmarshalJSON(data []byte) error
- type ToolUseBlock
- type ToolUseBlockCallerUnion
- func (u ToolUseBlockCallerUnion) AsAny() anyToolUseBlockCaller
- func (u ToolUseBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
- func (u ToolUseBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
- func (u ToolUseBlockCallerUnion) AsDirect() (v DirectCaller)
- func (u ToolUseBlockCallerUnion) RawJSON() string
- func (r *ToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
- type ToolUseBlockParam
- type ToolUseBlockParamCallerUnion
- type URLImageSourceParam
- type URLPDFSourceParam
- type Usage
- type UsageServiceTier
- type UserLocationParam
- type WebFetchBlock
- type WebFetchBlockParam
- type WebFetchTool20250910Param
- type WebFetchTool20260209Param
- type WebFetchTool20260309Param
- type WebFetchToolResultBlock
- type WebFetchToolResultBlockCallerUnion
- func (u WebFetchToolResultBlockCallerUnion) AsAny() anyWebFetchToolResultBlockCaller
- func (u WebFetchToolResultBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
- func (u WebFetchToolResultBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
- func (u WebFetchToolResultBlockCallerUnion) AsDirect() (v DirectCaller)
- func (u WebFetchToolResultBlockCallerUnion) RawJSON() string
- func (r *WebFetchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
- type WebFetchToolResultBlockContentUnion
- func (u WebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock() (v WebFetchBlock)
- func (u WebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError() (v WebFetchToolResultErrorBlock)
- func (u WebFetchToolResultBlockContentUnion) RawJSON() string
- func (r *WebFetchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type WebFetchToolResultBlockParam
- type WebFetchToolResultBlockParamCallerUnion
- type WebFetchToolResultBlockParamContentUnion
- func (u WebFetchToolResultBlockParamContentUnion) GetContent() *DocumentBlockParam
- func (u WebFetchToolResultBlockParamContentUnion) GetErrorCode() *string
- func (u WebFetchToolResultBlockParamContentUnion) GetRetrievedAt() *string
- func (u WebFetchToolResultBlockParamContentUnion) GetType() *string
- func (u WebFetchToolResultBlockParamContentUnion) GetURL() *string
- func (u WebFetchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
- func (u *WebFetchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
- type WebFetchToolResultErrorBlock
- type WebFetchToolResultErrorBlockParam
- type WebFetchToolResultErrorCode
- type WebSearchResultBlock
- type WebSearchResultBlockParam
- type WebSearchTool20250305Param
- type WebSearchTool20250305UserLocationParam
- type WebSearchTool20260209Param
- type WebSearchTool20260209UserLocationParam
- type WebSearchToolRequestErrorErrorCode
- type WebSearchToolRequestErrorParam
- type WebSearchToolResultBlock
- type WebSearchToolResultBlockCallerUnion
- func (u WebSearchToolResultBlockCallerUnion) AsAny() anyWebSearchToolResultBlockCaller
- func (u WebSearchToolResultBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
- func (u WebSearchToolResultBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
- func (u WebSearchToolResultBlockCallerUnion) AsDirect() (v DirectCaller)
- func (u WebSearchToolResultBlockCallerUnion) RawJSON() string
- func (r *WebSearchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
- type WebSearchToolResultBlockContentUnion
- func (u WebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError() (v WebSearchToolResultError)
- func (u WebSearchToolResultBlockContentUnion) AsWebSearchResultBlockArray() (v []WebSearchResultBlock)
- func (u WebSearchToolResultBlockContentUnion) RawJSON() string
- func (r WebSearchToolResultBlockContentUnion) ToParam() WebSearchToolResultBlockParamContentUnion
- func (r *WebSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
- type WebSearchToolResultBlockParam
- type WebSearchToolResultBlockParamCallerUnion
- func (u WebSearchToolResultBlockParamCallerUnion) GetToolID() *string
- func (u WebSearchToolResultBlockParamCallerUnion) GetType() *string
- func (u WebSearchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
- func (u *WebSearchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
- type WebSearchToolResultBlockParamContentUnion
- type WebSearchToolResultError
- type WebSearchToolResultErrorCode
- type WebSearchToolResultErrorErrorCode
Constants ¶
const ErrorTypeAPIError = shared.ErrorTypeAPIError
Equals "api_error"
const ErrorTypeAuthenticationError = shared.ErrorTypeAuthenticationError
Equals "authentication_error"
const ErrorTypeBillingError = shared.ErrorTypeBillingError
Equals "billing_error"
const ErrorTypeInvalidRequestError = shared.ErrorTypeInvalidRequestError
Equals "invalid_request_error"
const ErrorTypeNotFoundError = shared.ErrorTypeNotFoundError
Equals "not_found_error"
const ErrorTypeOverloadedError = shared.ErrorTypeOverloadedError
Equals "overloaded_error"
const ErrorTypePermissionError = shared.ErrorTypePermissionError
Equals "permission_error"
const ErrorTypeRateLimitError = shared.ErrorTypeRateLimitError
Equals "rate_limit_error"
const ErrorTypeTimeoutError = shared.ErrorTypeTimeoutError
Equals "timeout_error"
const WebSearchToolRequestErrorErrorCodeInvalidToolInput = WebSearchToolResultErrorCodeInvalidToolInput
const WebSearchToolRequestErrorErrorCodeMaxUsesExceeded = WebSearchToolResultErrorCodeMaxUsesExceeded
const WebSearchToolRequestErrorErrorCodeQueryTooLong = WebSearchToolResultErrorCodeQueryTooLong
const WebSearchToolRequestErrorErrorCodeRequestTooLarge = WebSearchToolResultErrorCodeRequestTooLarge
const WebSearchToolRequestErrorErrorCodeTooManyRequests = WebSearchToolResultErrorCodeTooManyRequests
const WebSearchToolResultErrorErrorCodeInvalidToolInput = WebSearchToolResultErrorCodeInvalidToolInput
const WebSearchToolResultErrorErrorCodeMaxUsesExceeded = WebSearchToolResultErrorCodeMaxUsesExceeded
const WebSearchToolResultErrorErrorCodeQueryTooLong = WebSearchToolResultErrorCodeQueryTooLong
const WebSearchToolResultErrorErrorCodeRequestTooLarge = WebSearchToolResultErrorCodeRequestTooLarge
const WebSearchToolResultErrorErrorCodeTooManyRequests = WebSearchToolResultErrorCodeTooManyRequests
Variables ¶
var ErrStructuredOutputParse = errors.New("anthropic: failed to parse structured output")
ErrStructuredOutputParse is returned (wrapped) by BetaMessageService.New when the API request succeeds but the response body can't be unmarshaled into the struct pointer passed as Schema. The *BetaMessage is still returned in that case — check it alongside the error:
msg, err := client.Beta.Messages.New(ctx, params)
if errors.Is(err, anthropic.ErrStructuredOutputParse) {
// msg is valid; the model's response didn't match the struct shape.
}
Functions ¶
func CalculateNonStreamingTimeout ¶ added in v1.2.0
func CalculateNonStreamingTimeout(maxTokens int, model Model, opts []option.RequestOption) (time.Duration, error)
CalculateNonStreamingTimeout calculates the appropriate timeout for a non-streaming request based on the maximum number of tokens and the model's non-streaming token limit
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type APIErrorObject ¶
type APIErrorObject = shared.APIErrorObject
This is an alias to an internal type.
type AnthropicBeta ¶
type AnthropicBeta = string
const ( AnthropicBetaMessageBatches2024_09_24 AnthropicBeta = "message-batches-2024-09-24" AnthropicBetaPromptCaching2024_07_31 AnthropicBeta = "prompt-caching-2024-07-31" AnthropicBetaComputerUse2024_10_22 AnthropicBeta = "computer-use-2024-10-22" AnthropicBetaComputerUse2025_01_24 AnthropicBeta = "computer-use-2025-01-24" AnthropicBetaPDFs2024_09_25 AnthropicBeta = "pdfs-2024-09-25" AnthropicBetaTokenCounting2024_11_01 AnthropicBeta = "token-counting-2024-11-01" AnthropicBetaTokenEfficientTools2025_02_19 AnthropicBeta = "token-efficient-tools-2025-02-19" AnthropicBetaOutput128k2025_02_19 AnthropicBeta = "output-128k-2025-02-19" AnthropicBetaFilesAPI2025_04_14 AnthropicBeta = "files-api-2025-04-14" AnthropicBetaMCPClient2025_04_04 AnthropicBeta = "mcp-client-2025-04-04" AnthropicBetaMCPClient2025_11_20 AnthropicBeta = "mcp-client-2025-11-20" AnthropicBetaDevFullThinking2025_05_14 AnthropicBeta = "dev-full-thinking-2025-05-14" AnthropicBetaInterleavedThinking2025_05_14 AnthropicBeta = "interleaved-thinking-2025-05-14" AnthropicBetaCodeExecution2025_05_22 AnthropicBeta = "code-execution-2025-05-22" AnthropicBetaExtendedCacheTTL2025_04_11 AnthropicBeta = "extended-cache-ttl-2025-04-11" AnthropicBetaContext1m2025_08_07 AnthropicBeta = "context-1m-2025-08-07" AnthropicBetaContextManagement2025_06_27 AnthropicBeta = "context-management-2025-06-27" AnthropicBetaModelContextWindowExceeded2025_08_26 AnthropicBeta = "model-context-window-exceeded-2025-08-26" AnthropicBetaSkills2025_10_02 AnthropicBeta = "skills-2025-10-02" AnthropicBetaFastMode2026_02_01 AnthropicBeta = "fast-mode-2026-02-01" AnthropicBetaOutput300k2026_03_24 AnthropicBeta = "output-300k-2026-03-24" AnthropicBetaUserProfiles2026_03_24 AnthropicBeta = "user-profiles-2026-03-24" AnthropicBetaAdvisorTool2026_03_01 AnthropicBeta = "advisor-tool-2026-03-01" )
type AuthenticationError ¶
type AuthenticationError = shared.AuthenticationError
This is an alias to an internal type.
type Base64ImageSourceMediaType ¶
type Base64ImageSourceMediaType string
const ( Base64ImageSourceMediaTypeImageJPEG Base64ImageSourceMediaType = "image/jpeg" Base64ImageSourceMediaTypeImagePNG Base64ImageSourceMediaType = "image/png" Base64ImageSourceMediaTypeImageGIF Base64ImageSourceMediaType = "image/gif" Base64ImageSourceMediaTypeImageWebP Base64ImageSourceMediaType = "image/webp" )
type Base64ImageSourceParam ¶
type Base64ImageSourceParam struct {
Data string `json:"data" api:"required" format:"byte"`
// Any of "image/jpeg", "image/png", "image/gif", "image/webp".
MediaType Base64ImageSourceMediaType `json:"media_type,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as "base64".
Type constant.Base64 `json:"type" default:"base64"`
// contains filtered or unexported fields
}
The properties Data, MediaType, Type are required.
func (Base64ImageSourceParam) MarshalJSON ¶
func (r Base64ImageSourceParam) MarshalJSON() (data []byte, err error)
func (*Base64ImageSourceParam) UnmarshalJSON ¶
func (r *Base64ImageSourceParam) UnmarshalJSON(data []byte) error
type Base64PDFSource ¶ added in v1.23.0
type Base64PDFSource struct {
Data string `json:"data" api:"required" format:"byte"`
MediaType constant.ApplicationPDF `json:"media_type" default:"application/pdf"`
Type constant.Base64 `json:"type" default:"base64"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (Base64PDFSource) RawJSON ¶ added in v1.23.0
func (r Base64PDFSource) RawJSON() string
Returns the unmodified JSON received from the API
func (Base64PDFSource) ToParam ¶ added in v1.23.0
func (r Base64PDFSource) ToParam() Base64PDFSourceParam
ToParam converts this Base64PDFSource to a Base64PDFSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with Base64PDFSourceParam.Overrides()
func (*Base64PDFSource) UnmarshalJSON ¶ added in v1.23.0
func (r *Base64PDFSource) UnmarshalJSON(data []byte) error
type Base64PDFSourceParam ¶
type Base64PDFSourceParam struct {
Data string `json:"data" api:"required" format:"byte"`
// This field can be elided, and will marshal its zero value as "application/pdf".
MediaType constant.ApplicationPDF `json:"media_type" default:"application/pdf"`
// This field can be elided, and will marshal its zero value as "base64".
Type constant.Base64 `json:"type" default:"base64"`
// contains filtered or unexported fields
}
The properties Data, MediaType, Type are required.
func (Base64PDFSourceParam) MarshalJSON ¶
func (r Base64PDFSourceParam) MarshalJSON() (data []byte, err error)
func (*Base64PDFSourceParam) UnmarshalJSON ¶
func (r *Base64PDFSourceParam) UnmarshalJSON(data []byte) error
type BashCodeExecutionOutputBlock ¶ added in v1.23.0
type BashCodeExecutionOutputBlock struct {
FileID string `json:"file_id" api:"required"`
Type constant.BashCodeExecutionOutput `json:"type" default:"bash_code_execution_output"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BashCodeExecutionOutputBlock) RawJSON ¶ added in v1.23.0
func (r BashCodeExecutionOutputBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BashCodeExecutionOutputBlock) ToParam ¶ added in v1.23.0
func (r BashCodeExecutionOutputBlock) ToParam() BashCodeExecutionOutputBlockParam
func (*BashCodeExecutionOutputBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionOutputBlock) UnmarshalJSON(data []byte) error
type BashCodeExecutionOutputBlockParam ¶ added in v1.23.0
type BashCodeExecutionOutputBlockParam struct {
FileID string `json:"file_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_output".
Type constant.BashCodeExecutionOutput `json:"type" default:"bash_code_execution_output"`
// contains filtered or unexported fields
}
The properties FileID, Type are required.
func (BashCodeExecutionOutputBlockParam) MarshalJSON ¶ added in v1.23.0
func (r BashCodeExecutionOutputBlockParam) MarshalJSON() (data []byte, err error)
func (*BashCodeExecutionOutputBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionOutputBlockParam) UnmarshalJSON(data []byte) error
type BashCodeExecutionResultBlock ¶ added in v1.23.0
type BashCodeExecutionResultBlock struct {
Content []BashCodeExecutionOutputBlock `json:"content" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
Type constant.BashCodeExecutionResult `json:"type" default:"bash_code_execution_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BashCodeExecutionResultBlock) RawJSON ¶ added in v1.23.0
func (r BashCodeExecutionResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BashCodeExecutionResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionResultBlock) UnmarshalJSON(data []byte) error
type BashCodeExecutionResultBlockParam ¶ added in v1.23.0
type BashCodeExecutionResultBlockParam struct {
Content []BashCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_result".
Type constant.BashCodeExecutionResult `json:"type" default:"bash_code_execution_result"`
// contains filtered or unexported fields
}
The properties Content, ReturnCode, Stderr, Stdout, Type are required.
func (BashCodeExecutionResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r BashCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BashCodeExecutionResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error
type BashCodeExecutionToolResultBlock ¶ added in v1.23.0
type BashCodeExecutionToolResultBlock struct {
Content BashCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.BashCodeExecutionToolResult `json:"type" default:"bash_code_execution_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BashCodeExecutionToolResultBlock) RawJSON ¶ added in v1.23.0
func (r BashCodeExecutionToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BashCodeExecutionToolResultBlock) ToParam ¶ added in v1.23.0
func (r BashCodeExecutionToolResultBlock) ToParam() BashCodeExecutionToolResultBlockParam
func (*BashCodeExecutionToolResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error
type BashCodeExecutionToolResultBlockContentUnion ¶ added in v1.23.0
type BashCodeExecutionToolResultBlockContentUnion struct {
// This field is from variant [BashCodeExecutionToolResultError].
ErrorCode BashCodeExecutionToolResultErrorCode `json:"error_code"`
Type string `json:"type"`
// This field is from variant [BashCodeExecutionResultBlock].
Content []BashCodeExecutionOutputBlock `json:"content"`
// This field is from variant [BashCodeExecutionResultBlock].
ReturnCode int64 `json:"return_code"`
// This field is from variant [BashCodeExecutionResultBlock].
Stderr string `json:"stderr"`
// This field is from variant [BashCodeExecutionResultBlock].
Stdout string `json:"stdout"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BashCodeExecutionToolResultBlockContentUnion contains all possible properties and values from BashCodeExecutionToolResultError, BashCodeExecutionResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock() (v BashCodeExecutionResultBlock)
func (BashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError() (v BashCodeExecutionToolResultError)
func (BashCodeExecutionToolResultBlockContentUnion) RawJSON ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BashCodeExecutionToolResultBlockParam ¶ added in v1.23.0
type BashCodeExecutionToolResultBlockParam struct {
Content BashCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_tool_result".
Type constant.BashCodeExecutionToolResult `json:"type" default:"bash_code_execution_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BashCodeExecutionToolResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r BashCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BashCodeExecutionToolResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error
type BashCodeExecutionToolResultBlockParamContentUnion ¶ added in v1.23.0
type BashCodeExecutionToolResultBlockParamContentUnion struct {
OfRequestBashCodeExecutionToolResultError *BashCodeExecutionToolResultErrorParam `json:",omitzero,inline"`
OfRequestBashCodeExecutionResultBlock *BashCodeExecutionResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BashCodeExecutionToolResultBlockParamContentUnion) GetContent ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) GetContent() []BashCodeExecutionOutputBlockParam
Returns a pointer to the underlying variant's property, if present.
func (BashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
Returns a pointer to the underlying variant's property, if present.
func (BashCodeExecutionToolResultBlockParamContentUnion) GetStderr ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
Returns a pointer to the underlying variant's property, if present.
func (BashCodeExecutionToolResultBlockParamContentUnion) GetStdout ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
Returns a pointer to the underlying variant's property, if present.
func (BashCodeExecutionToolResultBlockParamContentUnion) GetType ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.23.0
func (u BashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *BashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BashCodeExecutionToolResultError ¶ added in v1.23.0
type BashCodeExecutionToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "output_file_too_large".
ErrorCode BashCodeExecutionToolResultErrorCode `json:"error_code" api:"required"`
Type constant.BashCodeExecutionToolResultError `json:"type" default:"bash_code_execution_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BashCodeExecutionToolResultError) RawJSON ¶ added in v1.23.0
func (r BashCodeExecutionToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BashCodeExecutionToolResultError) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionToolResultError) UnmarshalJSON(data []byte) error
type BashCodeExecutionToolResultErrorCode ¶ added in v1.23.0
type BashCodeExecutionToolResultErrorCode string
const ( BashCodeExecutionToolResultErrorCodeInvalidToolInput BashCodeExecutionToolResultErrorCode = "invalid_tool_input" BashCodeExecutionToolResultErrorCodeTooManyRequests BashCodeExecutionToolResultErrorCode = "too_many_requests" BashCodeExecutionToolResultErrorCodeExecutionTimeExceeded BashCodeExecutionToolResultErrorCode = "execution_time_exceeded" BashCodeExecutionToolResultErrorCodeOutputFileTooLarge BashCodeExecutionToolResultErrorCode = "output_file_too_large" )
type BashCodeExecutionToolResultErrorParam ¶ added in v1.23.0
type BashCodeExecutionToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "output_file_too_large".
ErrorCode BashCodeExecutionToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_tool_result_error".
Type constant.BashCodeExecutionToolResultError `json:"type" default:"bash_code_execution_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BashCodeExecutionToolResultErrorParam) MarshalJSON ¶ added in v1.23.0
func (r BashCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*BashCodeExecutionToolResultErrorParam) UnmarshalJSON ¶ added in v1.23.0
func (r *BashCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error
type BetaAPIError ¶
type BetaAPIError struct {
Message string `json:"message" api:"required"`
Type constant.APIError `json:"type" default:"api_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaAPIError) RawJSON ¶
func (r BetaAPIError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAPIError) UnmarshalJSON ¶
func (r *BetaAPIError) UnmarshalJSON(data []byte) error
type BetaAdvisorMessageIterationUsage ¶ added in v1.34.0
type BetaAdvisorMessageIterationUsage struct {
// Breakdown of cached tokens by TTL
CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
// The number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model" api:"required"`
// The number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// Usage for an advisor sub-inference iteration
Type constant.AdvisorMessage `json:"type" default:"advisor_message"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreation respjson.Field
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
Model respjson.Field
OutputTokens respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token usage for an advisor sub-inference iteration.
func (BetaAdvisorMessageIterationUsage) RawJSON ¶ added in v1.34.0
func (r BetaAdvisorMessageIterationUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAdvisorMessageIterationUsage) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorMessageIterationUsage) UnmarshalJSON(data []byte) error
type BetaAdvisorRedactedResultBlock ¶ added in v1.34.0
type BetaAdvisorRedactedResultBlock struct {
// Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect
// or modify.
EncryptedContent string `json:"encrypted_content" api:"required"`
Type constant.AdvisorRedactedResult `json:"type" default:"advisor_redacted_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EncryptedContent respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaAdvisorRedactedResultBlock) RawJSON ¶ added in v1.34.0
func (r BetaAdvisorRedactedResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAdvisorRedactedResultBlock) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorRedactedResultBlock) UnmarshalJSON(data []byte) error
type BetaAdvisorRedactedResultBlockParam ¶ added in v1.34.0
type BetaAdvisorRedactedResultBlockParam struct {
// Opaque blob produced by a prior response; must be round-tripped verbatim.
EncryptedContent string `json:"encrypted_content" api:"required"`
// This field can be elided, and will marshal its zero value as
// "advisor_redacted_result".
Type constant.AdvisorRedactedResult `json:"type" default:"advisor_redacted_result"`
// contains filtered or unexported fields
}
The properties EncryptedContent, Type are required.
func (BetaAdvisorRedactedResultBlockParam) MarshalJSON ¶ added in v1.34.0
func (r BetaAdvisorRedactedResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaAdvisorRedactedResultBlockParam) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorRedactedResultBlockParam) UnmarshalJSON(data []byte) error
type BetaAdvisorResultBlock ¶ added in v1.34.0
type BetaAdvisorResultBlock struct {
Text string `json:"text" api:"required"`
Type constant.AdvisorResult `json:"type" default:"advisor_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaAdvisorResultBlock) RawJSON ¶ added in v1.34.0
func (r BetaAdvisorResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAdvisorResultBlock) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorResultBlock) UnmarshalJSON(data []byte) error
type BetaAdvisorResultBlockParam ¶ added in v1.34.0
type BetaAdvisorResultBlockParam struct {
Text string `json:"text" api:"required"`
// This field can be elided, and will marshal its zero value as "advisor_result".
Type constant.AdvisorResult `json:"type" default:"advisor_result"`
// contains filtered or unexported fields
}
The properties Text, Type are required.
func (BetaAdvisorResultBlockParam) MarshalJSON ¶ added in v1.34.0
func (r BetaAdvisorResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaAdvisorResultBlockParam) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorResultBlockParam) UnmarshalJSON(data []byte) error
type BetaAdvisorTool20260301Param ¶ added in v1.34.0
type BetaAdvisorTool20260301Param struct {
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Caching for the advisor's own prompt. When set, each advisor call writes a cache
// entry at the given TTL so subsequent calls in the same conversation read the
// stable prefix. When omitted, the advisor prompt is not cached.
Caching BetaCacheControlEphemeralParam `json:"caching,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "advisor".
Name constant.Advisor `json:"name" default:"advisor"`
// This field can be elided, and will marshal its zero value as "advisor_20260301".
Type constant.Advisor20260301 `json:"type" default:"advisor_20260301"`
// contains filtered or unexported fields
}
The properties Model, Name, Type are required.
func (BetaAdvisorTool20260301Param) MarshalJSON ¶ added in v1.34.0
func (r BetaAdvisorTool20260301Param) MarshalJSON() (data []byte, err error)
func (*BetaAdvisorTool20260301Param) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorTool20260301Param) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultBlock ¶ added in v1.34.0
type BetaAdvisorToolResultBlock struct {
Content BetaAdvisorToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.AdvisorToolResult `json:"type" default:"advisor_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaAdvisorToolResultBlock) RawJSON ¶ added in v1.34.0
func (r BetaAdvisorToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaAdvisorToolResultBlock) ToParam ¶ added in v1.34.0
func (r BetaAdvisorToolResultBlock) ToParam() BetaAdvisorToolResultBlockParam
func (*BetaAdvisorToolResultBlock) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorToolResultBlock) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultBlockContentUnion ¶ added in v1.34.0
type BetaAdvisorToolResultBlockContentUnion struct {
// This field is from variant [BetaAdvisorToolResultError].
ErrorCode BetaAdvisorToolResultErrorErrorCode `json:"error_code"`
Type string `json:"type"`
// This field is from variant [BetaAdvisorResultBlock].
Text string `json:"text"`
// This field is from variant [BetaAdvisorRedactedResultBlock].
EncryptedContent string `json:"encrypted_content"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Text respjson.Field
EncryptedContent respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaAdvisorToolResultBlockContentUnion contains all possible properties and values from BetaAdvisorToolResultError, BetaAdvisorResultBlock, BetaAdvisorRedactedResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorRedactedResultBlock ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorRedactedResultBlock() (v BetaAdvisorRedactedResultBlock)
func (BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorResultBlock ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorResultBlock() (v BetaAdvisorResultBlock)
func (BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorToolResultError ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockContentUnion) AsResponseAdvisorToolResultError() (v BetaAdvisorToolResultError)
func (BetaAdvisorToolResultBlockContentUnion) RawJSON ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAdvisorToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultBlockParam ¶ added in v1.34.0
type BetaAdvisorToolResultBlockParam struct {
Content BetaAdvisorToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "advisor_tool_result".
Type constant.AdvisorToolResult `json:"type" default:"advisor_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaAdvisorToolResultBlockParam) MarshalJSON ¶ added in v1.34.0
func (r BetaAdvisorToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaAdvisorToolResultBlockParam) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultBlockParamContentUnion ¶ added in v1.34.0
type BetaAdvisorToolResultBlockParamContentUnion struct {
OfRequestAdvisorToolResultError *BetaAdvisorToolResultErrorParam `json:",omitzero,inline"`
OfRequestAdvisorResultBlock *BetaAdvisorResultBlockParam `json:",omitzero,inline"`
OfRequestAdvisorRedactedResultBlock *BetaAdvisorRedactedResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaAdvisorToolResultBlockParamContentUnion) GetEncryptedContent ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockParamContentUnion) GetEncryptedContent() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAdvisorToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAdvisorToolResultBlockParamContentUnion) GetText ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockParamContentUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAdvisorToolResultBlockParamContentUnion) GetType ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAdvisorToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.34.0
func (u BetaAdvisorToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaAdvisorToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.34.0
func (u *BetaAdvisorToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultError ¶ added in v1.34.0
type BetaAdvisorToolResultError struct {
// Any of "max_uses_exceeded", "prompt_too_long", "too_many_requests",
// "overloaded", "unavailable", "execution_time_exceeded".
ErrorCode BetaAdvisorToolResultErrorErrorCode `json:"error_code" api:"required"`
Type constant.AdvisorToolResultError `json:"type" default:"advisor_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaAdvisorToolResultError) RawJSON ¶ added in v1.34.0
func (r BetaAdvisorToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAdvisorToolResultError) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorToolResultError) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultErrorErrorCode ¶ added in v1.34.0
type BetaAdvisorToolResultErrorErrorCode string
const ( BetaAdvisorToolResultErrorErrorCodeMaxUsesExceeded BetaAdvisorToolResultErrorErrorCode = "max_uses_exceeded" BetaAdvisorToolResultErrorErrorCodePromptTooLong BetaAdvisorToolResultErrorErrorCode = "prompt_too_long" BetaAdvisorToolResultErrorErrorCodeTooManyRequests BetaAdvisorToolResultErrorErrorCode = "too_many_requests" BetaAdvisorToolResultErrorErrorCodeOverloaded BetaAdvisorToolResultErrorErrorCode = "overloaded" BetaAdvisorToolResultErrorErrorCodeExecutionTimeExceeded BetaAdvisorToolResultErrorErrorCode = "execution_time_exceeded" )
type BetaAdvisorToolResultErrorParam ¶ added in v1.34.0
type BetaAdvisorToolResultErrorParam struct {
// Any of "max_uses_exceeded", "prompt_too_long", "too_many_requests",
// "overloaded", "unavailable", "execution_time_exceeded".
ErrorCode BetaAdvisorToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "advisor_tool_result_error".
Type constant.AdvisorToolResultError `json:"type" default:"advisor_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaAdvisorToolResultErrorParam) MarshalJSON ¶ added in v1.34.0
func (r BetaAdvisorToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*BetaAdvisorToolResultErrorParam) UnmarshalJSON ¶ added in v1.34.0
func (r *BetaAdvisorToolResultErrorParam) UnmarshalJSON(data []byte) error
type BetaAdvisorToolResultErrorParamErrorCode ¶ added in v1.34.0
type BetaAdvisorToolResultErrorParamErrorCode string
const ( BetaAdvisorToolResultErrorParamErrorCodeMaxUsesExceeded BetaAdvisorToolResultErrorParamErrorCode = "max_uses_exceeded" BetaAdvisorToolResultErrorParamErrorCodePromptTooLong BetaAdvisorToolResultErrorParamErrorCode = "prompt_too_long" BetaAdvisorToolResultErrorParamErrorCodeTooManyRequests BetaAdvisorToolResultErrorParamErrorCode = "too_many_requests" BetaAdvisorToolResultErrorParamErrorCodeOverloaded BetaAdvisorToolResultErrorParamErrorCode = "overloaded" BetaAdvisorToolResultErrorParamErrorCodeExecutionTimeExceeded BetaAdvisorToolResultErrorParamErrorCode = "execution_time_exceeded" )
type BetaAgentArchiveParams ¶ added in v1.33.0
type BetaAgentArchiveParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaAgentGetParams ¶ added in v1.33.0
type BetaAgentGetParams struct {
// Agent version. Omit for the most recent version. Must be at least 1 if
// specified.
Version param.Opt[int64] `query:"version,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaAgentGetParams) URLQuery ¶ added in v1.33.0
func (r BetaAgentGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaAgentGetParams's query parameters as `url.Values`.
type BetaAgentListParams ¶ added in v1.33.0
type BetaAgentListParams struct {
// Return agents created at or after this time (inclusive).
CreatedAtGte param.Opt[time.Time] `query:"created_at[gte],omitzero" format:"date-time" json:"-"`
// Return agents created at or before this time (inclusive).
CreatedAtLte param.Opt[time.Time] `query:"created_at[lte],omitzero" format:"date-time" json:"-"`
// Include archived agents in results. Defaults to false.
IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
// Maximum results per page. Default 20, maximum 100.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque pagination cursor from a previous response.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaAgentListParams) URLQuery ¶ added in v1.33.0
func (r BetaAgentListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaAgentListParams's query parameters as `url.Values`.
type BetaAgentNewParams ¶ added in v1.33.0
type BetaAgentNewParams struct {
// Model identifier. Accepts the
// [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison),
// e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration
// control
Model BetaManagedAgentsModelConfigParams `json:"model,omitzero" api:"required"`
// Human-readable name for the agent. 1-256 characters.
Name string `json:"name" api:"required"`
// Description of what the agent does. Up to 2048 characters.
Description param.Opt[string] `json:"description,omitzero"`
// System prompt for the agent. Up to 100,000 characters.
System param.Opt[string] `json:"system,omitzero"`
// MCP servers this agent connects to. Maximum 20. Names must be unique within the
// array.
MCPServers []BetaManagedAgentsURLMCPServerParams `json:"mcp_servers,omitzero"`
// Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up
// to 512 chars.
Metadata map[string]string `json:"metadata,omitzero"`
// Skills available to the agent. Maximum 20.
Skills []BetaManagedAgentsSkillParamsUnion `json:"skills,omitzero"`
// Tool configurations available to the agent. Maximum of 128 tools across all
// toolsets allowed.
Tools []BetaAgentNewParamsToolUnion `json:"tools,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaAgentNewParams) MarshalJSON ¶ added in v1.33.0
func (r BetaAgentNewParams) MarshalJSON() (data []byte, err error)
func (*BetaAgentNewParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaAgentNewParams) UnmarshalJSON(data []byte) error
type BetaAgentNewParamsToolUnion ¶ added in v1.33.0
type BetaAgentNewParamsToolUnion struct {
OfAgentToolset20260401 *BetaManagedAgentsAgentToolset20260401Params `json:",omitzero,inline"`
OfMCPToolset *BetaManagedAgentsMCPToolsetParams `json:",omitzero,inline"`
OfCustom *BetaManagedAgentsCustomToolParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaAgentNewParamsToolUnion) GetConfigs ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetConfigs() (res betaAgentNewParamsToolUnionConfigs)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaAgentNewParamsToolUnion) GetDefaultConfig ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetDefaultConfig() (res betaAgentNewParamsToolUnionDefaultConfig)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaAgentNewParamsToolUnion) GetDescription ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentNewParamsToolUnion) GetInputSchema ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetInputSchema() *BetaManagedAgentsCustomToolInputSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentNewParamsToolUnion) GetMCPServerName ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetMCPServerName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentNewParamsToolUnion) GetName ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentNewParamsToolUnion) GetType ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentNewParamsToolUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaAgentNewParamsToolUnion) MarshalJSON() ([]byte, error)
func (*BetaAgentNewParamsToolUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaAgentNewParamsToolUnion) UnmarshalJSON(data []byte) error
type BetaAgentService ¶ added in v1.33.0
type BetaAgentService struct {
Options []option.RequestOption
Versions BetaAgentVersionService
}
BetaAgentService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaAgentService method instead.
func NewBetaAgentService ¶ added in v1.33.0
func NewBetaAgentService(opts ...option.RequestOption) (r BetaAgentService)
NewBetaAgentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaAgentService) Archive ¶ added in v1.33.0
func (r *BetaAgentService) Archive(ctx context.Context, agentID string, body BetaAgentArchiveParams, opts ...option.RequestOption) (res *BetaManagedAgentsAgent, err error)
Archive Agent
func (*BetaAgentService) Get ¶ added in v1.33.0
func (r *BetaAgentService) Get(ctx context.Context, agentID string, params BetaAgentGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsAgent, err error)
Get Agent
func (*BetaAgentService) List ¶ added in v1.33.0
func (r *BetaAgentService) List(ctx context.Context, params BetaAgentListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsAgent], err error)
List Agents
func (*BetaAgentService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaAgentService) ListAutoPaging(ctx context.Context, params BetaAgentListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsAgent]
List Agents
func (*BetaAgentService) New ¶ added in v1.33.0
func (r *BetaAgentService) New(ctx context.Context, params BetaAgentNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsAgent, err error)
Create Agent
func (*BetaAgentService) Update ¶ added in v1.33.0
func (r *BetaAgentService) Update(ctx context.Context, agentID string, params BetaAgentUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsAgent, err error)
Update Agent
type BetaAgentUpdateParams ¶ added in v1.33.0
type BetaAgentUpdateParams struct {
// The agent's current version, used to prevent concurrent overwrites. Obtain this
// value from a create or retrieve response. The request fails if this does not
// match the server's current version.
Version int64 `json:"version" api:"required"`
// Description. Up to 2048 characters. Omit to preserve; send empty string or null
// to clear.
Description param.Opt[string] `json:"description,omitzero"`
// System prompt. Up to 100,000 characters. Omit to preserve; send empty string or
// null to clear.
System param.Opt[string] `json:"system,omitzero"`
// Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared.
Name param.Opt[string] `json:"name,omitzero"`
// MCP servers. Full replacement. Omit to preserve; send empty array or null to
// clear. Names must be unique. Maximum 20.
MCPServers []BetaManagedAgentsURLMCPServerParams `json:"mcp_servers,omitzero"`
// Metadata patch. Set a key to a string to upsert it, or to null to delete it.
// Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars
// each) with values up to 512 chars.
Metadata map[string]string `json:"metadata,omitzero"`
// Skills. Full replacement. Omit to preserve; send empty array or null to clear.
// Maximum 20.
Skills []BetaManagedAgentsSkillParamsUnion `json:"skills,omitzero"`
// Tool configurations available to the agent. Full replacement. Omit to preserve;
// send empty array or null to clear. Maximum of 128 tools across all toolsets
// allowed.
Tools []BetaAgentUpdateParamsToolUnion `json:"tools,omitzero"`
// Model identifier. Accepts the
// [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison),
// e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration
// control. Omit to preserve. Cannot be cleared.
Model BetaManagedAgentsModelConfigParams `json:"model,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaAgentUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaAgentUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaAgentUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaAgentUpdateParams) UnmarshalJSON(data []byte) error
type BetaAgentUpdateParamsToolUnion ¶ added in v1.33.0
type BetaAgentUpdateParamsToolUnion struct {
OfAgentToolset20260401 *BetaManagedAgentsAgentToolset20260401Params `json:",omitzero,inline"`
OfMCPToolset *BetaManagedAgentsMCPToolsetParams `json:",omitzero,inline"`
OfCustom *BetaManagedAgentsCustomToolParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaAgentUpdateParamsToolUnion) GetConfigs ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetConfigs() (res betaAgentUpdateParamsToolUnionConfigs)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaAgentUpdateParamsToolUnion) GetDefaultConfig ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetDefaultConfig() (res betaAgentUpdateParamsToolUnionDefaultConfig)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaAgentUpdateParamsToolUnion) GetDescription ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentUpdateParamsToolUnion) GetInputSchema ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetInputSchema() *BetaManagedAgentsCustomToolInputSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentUpdateParamsToolUnion) GetMCPServerName ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetMCPServerName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentUpdateParamsToolUnion) GetName ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentUpdateParamsToolUnion) GetType ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAgentUpdateParamsToolUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaAgentUpdateParamsToolUnion) MarshalJSON() ([]byte, error)
func (*BetaAgentUpdateParamsToolUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaAgentUpdateParamsToolUnion) UnmarshalJSON(data []byte) error
type BetaAgentVersionListParams ¶ added in v1.33.0
type BetaAgentVersionListParams struct {
// Maximum results per page. Default 20, maximum 100.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque pagination cursor.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaAgentVersionListParams) URLQuery ¶ added in v1.33.0
func (r BetaAgentVersionListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaAgentVersionListParams's query parameters as `url.Values`.
type BetaAgentVersionService ¶ added in v1.33.0
type BetaAgentVersionService struct {
Options []option.RequestOption
}
BetaAgentVersionService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaAgentVersionService method instead.
func NewBetaAgentVersionService ¶ added in v1.33.0
func NewBetaAgentVersionService(opts ...option.RequestOption) (r BetaAgentVersionService)
NewBetaAgentVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaAgentVersionService) List ¶ added in v1.33.0
func (r *BetaAgentVersionService) List(ctx context.Context, agentID string, params BetaAgentVersionListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsAgent], err error)
List Agent Versions
func (*BetaAgentVersionService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaAgentVersionService) ListAutoPaging(ctx context.Context, agentID string, params BetaAgentVersionListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsAgent]
List Agent Versions
type BetaAllThinkingTurnsParam ¶ added in v1.16.0
type BetaAllThinkingTurnsParam struct {
Type constant.All `json:"type" default:"all"`
// contains filtered or unexported fields
}
This struct has a constant value, construct it with NewBetaAllThinkingTurnsParam.
func NewBetaAllThinkingTurnsParam ¶ added in v1.16.0
func NewBetaAllThinkingTurnsParam() BetaAllThinkingTurnsParam
func (BetaAllThinkingTurnsParam) MarshalJSON ¶ added in v1.16.0
func (r BetaAllThinkingTurnsParam) MarshalJSON() (data []byte, err error)
func (*BetaAllThinkingTurnsParam) UnmarshalJSON ¶ added in v1.16.0
func (r *BetaAllThinkingTurnsParam) UnmarshalJSON(data []byte) error
type BetaAuthenticationError ¶
type BetaAuthenticationError struct {
Message string `json:"message" api:"required"`
Type constant.AuthenticationError `json:"type" default:"authentication_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaAuthenticationError) RawJSON ¶
func (r BetaAuthenticationError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaAuthenticationError) UnmarshalJSON ¶
func (r *BetaAuthenticationError) UnmarshalJSON(data []byte) error
type BetaBase64ImageSourceMediaType ¶
type BetaBase64ImageSourceMediaType string
const ( BetaBase64ImageSourceMediaTypeImageJPEG BetaBase64ImageSourceMediaType = "image/jpeg" BetaBase64ImageSourceMediaTypeImagePNG BetaBase64ImageSourceMediaType = "image/png" BetaBase64ImageSourceMediaTypeImageGIF BetaBase64ImageSourceMediaType = "image/gif" BetaBase64ImageSourceMediaTypeImageWebP BetaBase64ImageSourceMediaType = "image/webp" )
type BetaBase64ImageSourceParam ¶
type BetaBase64ImageSourceParam struct {
Data string `json:"data" api:"required" format:"byte"`
// Any of "image/jpeg", "image/png", "image/gif", "image/webp".
MediaType BetaBase64ImageSourceMediaType `json:"media_type,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as "base64".
Type constant.Base64 `json:"type" default:"base64"`
// contains filtered or unexported fields
}
The properties Data, MediaType, Type are required.
func (BetaBase64ImageSourceParam) MarshalJSON ¶
func (r BetaBase64ImageSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaBase64ImageSourceParam) UnmarshalJSON ¶
func (r *BetaBase64ImageSourceParam) UnmarshalJSON(data []byte) error
type BetaBase64PDFSource ¶ added in v1.12.0
type BetaBase64PDFSource struct {
Data string `json:"data" api:"required" format:"byte"`
MediaType constant.ApplicationPDF `json:"media_type" default:"application/pdf"`
Type constant.Base64 `json:"type" default:"base64"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaBase64PDFSource) RawJSON ¶ added in v1.12.0
func (r BetaBase64PDFSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaBase64PDFSource) ToParam ¶ added in v1.12.0
func (r BetaBase64PDFSource) ToParam() BetaBase64PDFSourceParam
ToParam converts this BetaBase64PDFSource to a BetaBase64PDFSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaBase64PDFSourceParam.Overrides()
func (*BetaBase64PDFSource) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaBase64PDFSource) UnmarshalJSON(data []byte) error
type BetaBase64PDFSourceParam ¶
type BetaBase64PDFSourceParam struct {
Data string `json:"data" api:"required" format:"byte"`
// This field can be elided, and will marshal its zero value as "application/pdf".
MediaType constant.ApplicationPDF `json:"media_type" default:"application/pdf"`
// This field can be elided, and will marshal its zero value as "base64".
Type constant.Base64 `json:"type" default:"base64"`
// contains filtered or unexported fields
}
The properties Data, MediaType, Type are required.
func (BetaBase64PDFSourceParam) MarshalJSON ¶
func (r BetaBase64PDFSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaBase64PDFSourceParam) UnmarshalJSON ¶
func (r *BetaBase64PDFSourceParam) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionOutputBlock ¶ added in v1.10.0
type BetaBashCodeExecutionOutputBlock struct {
FileID string `json:"file_id" api:"required"`
Type constant.BashCodeExecutionOutput `json:"type" default:"bash_code_execution_output"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaBashCodeExecutionOutputBlock) RawJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionOutputBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaBashCodeExecutionOutputBlock) ToParam ¶ added in v1.20.0
func (r BetaBashCodeExecutionOutputBlock) ToParam() BetaBashCodeExecutionOutputBlockParam
func (*BetaBashCodeExecutionOutputBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionOutputBlock) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionOutputBlockParam ¶ added in v1.10.0
type BetaBashCodeExecutionOutputBlockParam struct {
FileID string `json:"file_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_output".
Type constant.BashCodeExecutionOutput `json:"type" default:"bash_code_execution_output"`
// contains filtered or unexported fields
}
The properties FileID, Type are required.
func (BetaBashCodeExecutionOutputBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionOutputBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaBashCodeExecutionOutputBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionOutputBlockParam) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionResultBlock ¶ added in v1.10.0
type BetaBashCodeExecutionResultBlock struct {
Content []BetaBashCodeExecutionOutputBlock `json:"content" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
Type constant.BashCodeExecutionResult `json:"type" default:"bash_code_execution_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaBashCodeExecutionResultBlock) RawJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaBashCodeExecutionResultBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionResultBlock) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionResultBlockParam ¶ added in v1.10.0
type BetaBashCodeExecutionResultBlockParam struct {
Content []BetaBashCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_result".
Type constant.BashCodeExecutionResult `json:"type" default:"bash_code_execution_result"`
// contains filtered or unexported fields
}
The properties Content, ReturnCode, Stderr, Stdout, Type are required.
func (BetaBashCodeExecutionResultBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaBashCodeExecutionResultBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultBlock ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultBlock struct {
Content BetaBashCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.BashCodeExecutionToolResult `json:"type" default:"bash_code_execution_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaBashCodeExecutionToolResultBlock) RawJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaBashCodeExecutionToolResultBlock) ToParam ¶ added in v1.20.0
func (r BetaBashCodeExecutionToolResultBlock) ToParam() BetaBashCodeExecutionToolResultBlockParam
func (*BetaBashCodeExecutionToolResultBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultBlockContentUnion ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultBlockContentUnion struct {
// This field is from variant [BetaBashCodeExecutionToolResultError].
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode `json:"error_code"`
Type string `json:"type"`
// This field is from variant [BetaBashCodeExecutionResultBlock].
Content []BetaBashCodeExecutionOutputBlock `json:"content"`
// This field is from variant [BetaBashCodeExecutionResultBlock].
ReturnCode int64 `json:"return_code"`
// This field is from variant [BetaBashCodeExecutionResultBlock].
Stderr string `json:"stderr"`
// This field is from variant [BetaBashCodeExecutionResultBlock].
Stdout string `json:"stdout"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaBashCodeExecutionToolResultBlockContentUnion contains all possible properties and values from BetaBashCodeExecutionToolResultError, BetaBashCodeExecutionResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionResultBlock() (v BetaBashCodeExecutionResultBlock)
func (BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockContentUnion) AsResponseBashCodeExecutionToolResultError() (v BetaBashCodeExecutionToolResultError)
func (BetaBashCodeExecutionToolResultBlockContentUnion) RawJSON ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaBashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultBlockParam ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultBlockParam struct {
Content BetaBashCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_tool_result".
Type constant.BashCodeExecutionToolResult `json:"type" default:"bash_code_execution_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaBashCodeExecutionToolResultBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaBashCodeExecutionToolResultBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultBlockParamContentUnion ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultBlockParamContentUnion struct {
OfRequestBashCodeExecutionToolResultError *BetaBashCodeExecutionToolResultErrorParam `json:",omitzero,inline"`
OfRequestBashCodeExecutionResultBlock *BetaBashCodeExecutionResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) GetContent ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetContent() []BetaBashCodeExecutionOutputBlockParam
Returns a pointer to the underlying variant's property, if present.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStderr ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStdout ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) GetType ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaBashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.10.0
func (u BetaBashCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaBashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.10.0
func (u *BetaBashCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultError ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "output_file_too_large".
ErrorCode BetaBashCodeExecutionToolResultErrorErrorCode `json:"error_code" api:"required"`
Type constant.BashCodeExecutionToolResultError `json:"type" default:"bash_code_execution_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaBashCodeExecutionToolResultError) RawJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaBashCodeExecutionToolResultError) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionToolResultError) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultErrorErrorCode ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultErrorErrorCode string
const ( BetaBashCodeExecutionToolResultErrorErrorCodeInvalidToolInput BetaBashCodeExecutionToolResultErrorErrorCode = "invalid_tool_input" BetaBashCodeExecutionToolResultErrorErrorCodeTooManyRequests BetaBashCodeExecutionToolResultErrorErrorCode = "too_many_requests" BetaBashCodeExecutionToolResultErrorErrorCodeExecutionTimeExceeded BetaBashCodeExecutionToolResultErrorErrorCode = "execution_time_exceeded" BetaBashCodeExecutionToolResultErrorErrorCodeOutputFileTooLarge BetaBashCodeExecutionToolResultErrorErrorCode = "output_file_too_large" )
type BetaBashCodeExecutionToolResultErrorParam ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "output_file_too_large".
ErrorCode BetaBashCodeExecutionToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "bash_code_execution_tool_result_error".
Type constant.BashCodeExecutionToolResultError `json:"type" default:"bash_code_execution_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaBashCodeExecutionToolResultErrorParam) MarshalJSON ¶ added in v1.10.0
func (r BetaBashCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*BetaBashCodeExecutionToolResultErrorParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaBashCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error
type BetaBashCodeExecutionToolResultErrorParamErrorCode ¶ added in v1.10.0
type BetaBashCodeExecutionToolResultErrorParamErrorCode string
const ( BetaBashCodeExecutionToolResultErrorParamErrorCodeInvalidToolInput BetaBashCodeExecutionToolResultErrorParamErrorCode = "invalid_tool_input" BetaBashCodeExecutionToolResultErrorParamErrorCodeTooManyRequests BetaBashCodeExecutionToolResultErrorParamErrorCode = "too_many_requests" BetaBashCodeExecutionToolResultErrorParamErrorCodeExecutionTimeExceeded BetaBashCodeExecutionToolResultErrorParamErrorCode = "execution_time_exceeded" BetaBashCodeExecutionToolResultErrorParamErrorCodeOutputFileTooLarge BetaBashCodeExecutionToolResultErrorParamErrorCode = "output_file_too_large" )
type BetaBillingError ¶
type BetaBillingError struct {
Message string `json:"message" api:"required"`
Type constant.BillingError `json:"type" default:"billing_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaBillingError) RawJSON ¶
func (r BetaBillingError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaBillingError) UnmarshalJSON ¶
func (r *BetaBillingError) UnmarshalJSON(data []byte) error
type BetaCacheControlEphemeralParam ¶
type BetaCacheControlEphemeralParam struct {
// The time-to-live for the cache control breakpoint.
//
// This may be one the following values:
//
// - `5m`: 5 minutes
// - `1h`: 1 hour
//
// Defaults to `5m`.
//
// Any of "5m", "1h".
TTL BetaCacheControlEphemeralTTL `json:"ttl,omitzero"`
Type constant.Ephemeral `json:"type" default:"ephemeral"`
// contains filtered or unexported fields
}
This struct has a constant value, construct it with NewBetaCacheControlEphemeralParam.
func NewBetaCacheControlEphemeralParam ¶
func NewBetaCacheControlEphemeralParam() BetaCacheControlEphemeralParam
func (BetaCacheControlEphemeralParam) MarshalJSON ¶
func (r BetaCacheControlEphemeralParam) MarshalJSON() (data []byte, err error)
func (*BetaCacheControlEphemeralParam) UnmarshalJSON ¶
func (r *BetaCacheControlEphemeralParam) UnmarshalJSON(data []byte) error
type BetaCacheControlEphemeralTTL ¶ added in v1.2.0
type BetaCacheControlEphemeralTTL string
The time-to-live for the cache control breakpoint.
This may be one the following values:
- `5m`: 5 minutes - `1h`: 1 hour
Defaults to `5m`.
const ( BetaCacheControlEphemeralTTLTTL5m BetaCacheControlEphemeralTTL = "5m" BetaCacheControlEphemeralTTLTTL1h BetaCacheControlEphemeralTTL = "1h" )
type BetaCacheCreation ¶ added in v1.2.0
type BetaCacheCreation struct {
// The number of input tokens used to create the 1 hour cache entry.
Ephemeral1hInputTokens int64 `json:"ephemeral_1h_input_tokens" api:"required"`
// The number of input tokens used to create the 5 minute cache entry.
Ephemeral5mInputTokens int64 `json:"ephemeral_5m_input_tokens" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Ephemeral1hInputTokens respjson.Field
Ephemeral5mInputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCacheCreation) RawJSON ¶ added in v1.2.0
func (r BetaCacheCreation) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCacheCreation) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCacheCreation) UnmarshalJSON(data []byte) error
type BetaCapabilitySupport ¶ added in v1.27.1
type BetaCapabilitySupport struct {
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Supported respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates whether a capability is supported.
func (BetaCapabilitySupport) RawJSON ¶ added in v1.27.1
func (r BetaCapabilitySupport) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCapabilitySupport) UnmarshalJSON ¶ added in v1.27.1
func (r *BetaCapabilitySupport) UnmarshalJSON(data []byte) error
type BetaCitationCharLocation ¶
type BetaCitationCharLocation struct {
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
DocumentTitle string `json:"document_title" api:"required"`
EndCharIndex int64 `json:"end_char_index" api:"required"`
FileID string `json:"file_id" api:"required"`
StartCharIndex int64 `json:"start_char_index" api:"required"`
Type constant.CharLocation `json:"type" default:"char_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndCharIndex respjson.Field
FileID respjson.Field
StartCharIndex respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationCharLocation) RawJSON ¶
func (r BetaCitationCharLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationCharLocation) UnmarshalJSON ¶
func (r *BetaCitationCharLocation) UnmarshalJSON(data []byte) error
type BetaCitationCharLocationParam ¶
type BetaCitationCharLocationParam struct {
DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
EndCharIndex int64 `json:"end_char_index" api:"required"`
StartCharIndex int64 `json:"start_char_index" api:"required"`
// This field can be elided, and will marshal its zero value as "char_location".
Type constant.CharLocation `json:"type" default:"char_location"`
// contains filtered or unexported fields
}
The properties CitedText, DocumentIndex, DocumentTitle, EndCharIndex, StartCharIndex, Type are required.
func (BetaCitationCharLocationParam) MarshalJSON ¶
func (r BetaCitationCharLocationParam) MarshalJSON() (data []byte, err error)
func (*BetaCitationCharLocationParam) UnmarshalJSON ¶
func (r *BetaCitationCharLocationParam) UnmarshalJSON(data []byte) error
type BetaCitationConfig ¶ added in v1.12.0
type BetaCitationConfig struct {
Enabled bool `json:"enabled" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationConfig) RawJSON ¶ added in v1.12.0
func (r BetaCitationConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationConfig) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaCitationConfig) UnmarshalJSON(data []byte) error
type BetaCitationContentBlockLocation ¶
type BetaCitationContentBlockLocation struct {
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
DocumentTitle string `json:"document_title" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
FileID string `json:"file_id" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
Type constant.ContentBlockLocation `json:"type" default:"content_block_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndBlockIndex respjson.Field
FileID respjson.Field
StartBlockIndex respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationContentBlockLocation) RawJSON ¶
func (r BetaCitationContentBlockLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationContentBlockLocation) UnmarshalJSON ¶
func (r *BetaCitationContentBlockLocation) UnmarshalJSON(data []byte) error
type BetaCitationContentBlockLocationParam ¶
type BetaCitationContentBlockLocationParam struct {
DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
// This field can be elided, and will marshal its zero value as
// "content_block_location".
Type constant.ContentBlockLocation `json:"type" default:"content_block_location"`
// contains filtered or unexported fields
}
The properties CitedText, DocumentIndex, DocumentTitle, EndBlockIndex, StartBlockIndex, Type are required.
func (BetaCitationContentBlockLocationParam) MarshalJSON ¶
func (r BetaCitationContentBlockLocationParam) MarshalJSON() (data []byte, err error)
func (*BetaCitationContentBlockLocationParam) UnmarshalJSON ¶
func (r *BetaCitationContentBlockLocationParam) UnmarshalJSON(data []byte) error
type BetaCitationPageLocation ¶
type BetaCitationPageLocation struct {
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
DocumentTitle string `json:"document_title" api:"required"`
EndPageNumber int64 `json:"end_page_number" api:"required"`
FileID string `json:"file_id" api:"required"`
StartPageNumber int64 `json:"start_page_number" api:"required"`
Type constant.PageLocation `json:"type" default:"page_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndPageNumber respjson.Field
FileID respjson.Field
StartPageNumber respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationPageLocation) RawJSON ¶
func (r BetaCitationPageLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationPageLocation) UnmarshalJSON ¶
func (r *BetaCitationPageLocation) UnmarshalJSON(data []byte) error
type BetaCitationPageLocationParam ¶
type BetaCitationPageLocationParam struct {
DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
EndPageNumber int64 `json:"end_page_number" api:"required"`
StartPageNumber int64 `json:"start_page_number" api:"required"`
// This field can be elided, and will marshal its zero value as "page_location".
Type constant.PageLocation `json:"type" default:"page_location"`
// contains filtered or unexported fields
}
The properties CitedText, DocumentIndex, DocumentTitle, EndPageNumber, StartPageNumber, Type are required.
func (BetaCitationPageLocationParam) MarshalJSON ¶
func (r BetaCitationPageLocationParam) MarshalJSON() (data []byte, err error)
func (*BetaCitationPageLocationParam) UnmarshalJSON ¶
func (r *BetaCitationPageLocationParam) UnmarshalJSON(data []byte) error
type BetaCitationSearchResultLocation ¶ added in v1.6.0
type BetaCitationSearchResultLocation struct {
CitedText string `json:"cited_text" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
SearchResultIndex int64 `json:"search_result_index" api:"required"`
Source string `json:"source" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
Title string `json:"title" api:"required"`
Type constant.SearchResultLocation `json:"type" default:"search_result_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
EndBlockIndex respjson.Field
SearchResultIndex respjson.Field
Source respjson.Field
StartBlockIndex respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationSearchResultLocation) RawJSON ¶ added in v1.6.0
func (r BetaCitationSearchResultLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationSearchResultLocation) UnmarshalJSON ¶ added in v1.6.0
func (r *BetaCitationSearchResultLocation) UnmarshalJSON(data []byte) error
type BetaCitationSearchResultLocationParam ¶ added in v1.6.0
type BetaCitationSearchResultLocationParam struct {
Title param.Opt[string] `json:"title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
SearchResultIndex int64 `json:"search_result_index" api:"required"`
Source string `json:"source" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
// This field can be elided, and will marshal its zero value as
// "search_result_location".
Type constant.SearchResultLocation `json:"type" default:"search_result_location"`
// contains filtered or unexported fields
}
The properties CitedText, EndBlockIndex, SearchResultIndex, Source, StartBlockIndex, Title, Type are required.
func (BetaCitationSearchResultLocationParam) MarshalJSON ¶ added in v1.6.0
func (r BetaCitationSearchResultLocationParam) MarshalJSON() (data []byte, err error)
func (*BetaCitationSearchResultLocationParam) UnmarshalJSON ¶ added in v1.6.0
func (r *BetaCitationSearchResultLocationParam) UnmarshalJSON(data []byte) error
type BetaCitationWebSearchResultLocationParam ¶
type BetaCitationWebSearchResultLocationParam struct {
Title param.Opt[string] `json:"title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
EncryptedIndex string `json:"encrypted_index" api:"required"`
URL string `json:"url" api:"required"`
// This field can be elided, and will marshal its zero value as
// "web_search_result_location".
Type constant.WebSearchResultLocation `json:"type" default:"web_search_result_location"`
// contains filtered or unexported fields
}
The properties CitedText, EncryptedIndex, Title, Type, URL are required.
func (BetaCitationWebSearchResultLocationParam) MarshalJSON ¶
func (r BetaCitationWebSearchResultLocationParam) MarshalJSON() (data []byte, err error)
func (*BetaCitationWebSearchResultLocationParam) UnmarshalJSON ¶
func (r *BetaCitationWebSearchResultLocationParam) UnmarshalJSON(data []byte) error
type BetaCitationsConfigParam ¶
type BetaCitationsConfigParam struct {
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// contains filtered or unexported fields
}
func (BetaCitationsConfigParam) MarshalJSON ¶
func (r BetaCitationsConfigParam) MarshalJSON() (data []byte, err error)
func (*BetaCitationsConfigParam) UnmarshalJSON ¶
func (r *BetaCitationsConfigParam) UnmarshalJSON(data []byte) error
type BetaCitationsDelta ¶
type BetaCitationsDelta struct {
Citation BetaCitationsDeltaCitationUnion `json:"citation" api:"required"`
Type constant.CitationsDelta `json:"type" default:"citations_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Citation respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationsDelta) RawJSON ¶
func (r BetaCitationsDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationsDelta) UnmarshalJSON ¶
func (r *BetaCitationsDelta) UnmarshalJSON(data []byte) error
type BetaCitationsDeltaCitationUnion ¶
type BetaCitationsDeltaCitationUnion struct {
CitedText string `json:"cited_text"`
DocumentIndex int64 `json:"document_index"`
DocumentTitle string `json:"document_title"`
// This field is from variant [BetaCitationCharLocation].
EndCharIndex int64 `json:"end_char_index"`
FileID string `json:"file_id"`
// This field is from variant [BetaCitationCharLocation].
StartCharIndex int64 `json:"start_char_index"`
// Any of "char_location", "page_location", "content_block_location",
// "web_search_result_location", "search_result_location".
Type string `json:"type"`
// This field is from variant [BetaCitationPageLocation].
EndPageNumber int64 `json:"end_page_number"`
// This field is from variant [BetaCitationPageLocation].
StartPageNumber int64 `json:"start_page_number"`
EndBlockIndex int64 `json:"end_block_index"`
StartBlockIndex int64 `json:"start_block_index"`
// This field is from variant [BetaCitationsWebSearchResultLocation].
EncryptedIndex string `json:"encrypted_index"`
Title string `json:"title"`
// This field is from variant [BetaCitationsWebSearchResultLocation].
URL string `json:"url"`
// This field is from variant [BetaCitationSearchResultLocation].
SearchResultIndex int64 `json:"search_result_index"`
// This field is from variant [BetaCitationSearchResultLocation].
Source string `json:"source"`
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndCharIndex respjson.Field
FileID respjson.Field
StartCharIndex respjson.Field
Type respjson.Field
EndPageNumber respjson.Field
StartPageNumber respjson.Field
EndBlockIndex respjson.Field
StartBlockIndex respjson.Field
EncryptedIndex respjson.Field
Title respjson.Field
URL respjson.Field
SearchResultIndex respjson.Field
Source respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaCitationsDeltaCitationUnion contains all possible properties and values from BetaCitationCharLocation, BetaCitationPageLocation, BetaCitationContentBlockLocation, BetaCitationsWebSearchResultLocation, BetaCitationSearchResultLocation.
Use the BetaCitationsDeltaCitationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaCitationsDeltaCitationUnion) AsAny ¶
func (u BetaCitationsDeltaCitationUnion) AsAny() anyBetaCitationsDeltaCitation
Use the following switch statement to find the correct variant
switch variant := BetaCitationsDeltaCitationUnion.AsAny().(type) {
case anthropic.BetaCitationCharLocation:
case anthropic.BetaCitationPageLocation:
case anthropic.BetaCitationContentBlockLocation:
case anthropic.BetaCitationsWebSearchResultLocation:
case anthropic.BetaCitationSearchResultLocation:
default:
fmt.Errorf("no variant present")
}
func (BetaCitationsDeltaCitationUnion) AsCharLocation ¶
func (u BetaCitationsDeltaCitationUnion) AsCharLocation() (v BetaCitationCharLocation)
func (BetaCitationsDeltaCitationUnion) AsContentBlockLocation ¶
func (u BetaCitationsDeltaCitationUnion) AsContentBlockLocation() (v BetaCitationContentBlockLocation)
func (BetaCitationsDeltaCitationUnion) AsPageLocation ¶
func (u BetaCitationsDeltaCitationUnion) AsPageLocation() (v BetaCitationPageLocation)
func (BetaCitationsDeltaCitationUnion) AsSearchResultLocation ¶ added in v1.5.0
func (u BetaCitationsDeltaCitationUnion) AsSearchResultLocation() (v BetaCitationSearchResultLocation)
func (BetaCitationsDeltaCitationUnion) AsWebSearchResultLocation ¶
func (u BetaCitationsDeltaCitationUnion) AsWebSearchResultLocation() (v BetaCitationsWebSearchResultLocation)
func (BetaCitationsDeltaCitationUnion) RawJSON ¶
func (u BetaCitationsDeltaCitationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationsDeltaCitationUnion) UnmarshalJSON ¶
func (r *BetaCitationsDeltaCitationUnion) UnmarshalJSON(data []byte) error
type BetaCitationsWebSearchResultLocation ¶
type BetaCitationsWebSearchResultLocation struct {
CitedText string `json:"cited_text" api:"required"`
EncryptedIndex string `json:"encrypted_index" api:"required"`
Title string `json:"title" api:"required"`
Type constant.WebSearchResultLocation `json:"type" default:"web_search_result_location"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
EncryptedIndex respjson.Field
Title respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCitationsWebSearchResultLocation) RawJSON ¶
func (r BetaCitationsWebSearchResultLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCitationsWebSearchResultLocation) UnmarshalJSON ¶
func (r *BetaCitationsWebSearchResultLocation) UnmarshalJSON(data []byte) error
type BetaClearThinking20251015EditKeepUnionParam ¶ added in v1.16.0
type BetaClearThinking20251015EditKeepUnionParam struct {
OfThinkingTurns *BetaThinkingTurnsParam `json:",omitzero,inline"`
OfAllThinkingTurns *BetaAllThinkingTurnsParam `json:",omitzero,inline"`
// Construct this variant with constant.ValueOf[constant.All]()
OfAll constant.All `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaClearThinking20251015EditKeepUnionParam) GetType ¶ added in v1.16.0
func (u BetaClearThinking20251015EditKeepUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaClearThinking20251015EditKeepUnionParam) GetValue ¶ added in v1.16.0
func (u BetaClearThinking20251015EditKeepUnionParam) GetValue() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaClearThinking20251015EditKeepUnionParam) MarshalJSON ¶ added in v1.16.0
func (u BetaClearThinking20251015EditKeepUnionParam) MarshalJSON() ([]byte, error)
func (*BetaClearThinking20251015EditKeepUnionParam) UnmarshalJSON ¶ added in v1.16.0
func (u *BetaClearThinking20251015EditKeepUnionParam) UnmarshalJSON(data []byte) error
type BetaClearThinking20251015EditParam ¶ added in v1.16.0
type BetaClearThinking20251015EditParam struct {
// Number of most recent assistant turns to keep thinking blocks for. Older turns
// will have their thinking blocks removed.
Keep BetaClearThinking20251015EditKeepUnionParam `json:"keep,omitzero"`
// This field can be elided, and will marshal its zero value as
// "clear_thinking_20251015".
Type constant.ClearThinking20251015 `json:"type" default:"clear_thinking_20251015"`
// contains filtered or unexported fields
}
The property Type is required.
func (BetaClearThinking20251015EditParam) MarshalJSON ¶ added in v1.16.0
func (r BetaClearThinking20251015EditParam) MarshalJSON() (data []byte, err error)
func (*BetaClearThinking20251015EditParam) UnmarshalJSON ¶ added in v1.16.0
func (r *BetaClearThinking20251015EditParam) UnmarshalJSON(data []byte) error
type BetaClearThinking20251015EditResponse ¶ added in v1.16.0
type BetaClearThinking20251015EditResponse struct {
// Number of input tokens cleared by this edit.
ClearedInputTokens int64 `json:"cleared_input_tokens" api:"required"`
// Number of thinking turns that were cleared.
ClearedThinkingTurns int64 `json:"cleared_thinking_turns" api:"required"`
// The type of context management edit applied.
Type constant.ClearThinking20251015 `json:"type" default:"clear_thinking_20251015"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClearedInputTokens respjson.Field
ClearedThinkingTurns respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaClearThinking20251015EditResponse) RawJSON ¶ added in v1.16.0
func (r BetaClearThinking20251015EditResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaClearThinking20251015EditResponse) UnmarshalJSON ¶ added in v1.16.0
func (r *BetaClearThinking20251015EditResponse) UnmarshalJSON(data []byte) error
type BetaClearToolUses20250919EditClearToolInputsUnionParam ¶ added in v1.13.0
type BetaClearToolUses20250919EditClearToolInputsUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfStringArray []string `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaClearToolUses20250919EditClearToolInputsUnionParam) MarshalJSON ¶ added in v1.13.0
func (u BetaClearToolUses20250919EditClearToolInputsUnionParam) MarshalJSON() ([]byte, error)
func (*BetaClearToolUses20250919EditClearToolInputsUnionParam) UnmarshalJSON ¶ added in v1.13.0
func (u *BetaClearToolUses20250919EditClearToolInputsUnionParam) UnmarshalJSON(data []byte) error
type BetaClearToolUses20250919EditParam ¶ added in v1.13.0
type BetaClearToolUses20250919EditParam struct {
// Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
ClearToolInputs BetaClearToolUses20250919EditClearToolInputsUnionParam `json:"clear_tool_inputs,omitzero"`
// Tool names whose uses are preserved from clearing
ExcludeTools []string `json:"exclude_tools,omitzero"`
// Minimum number of tokens that must be cleared when triggered. Context will only
// be modified if at least this many tokens can be removed.
ClearAtLeast BetaInputTokensClearAtLeastParam `json:"clear_at_least,omitzero"`
// Number of tool uses to retain in the conversation
Keep BetaToolUsesKeepParam `json:"keep,omitzero"`
// Condition that triggers the context management strategy
Trigger BetaClearToolUses20250919EditTriggerUnionParam `json:"trigger,omitzero"`
// This field can be elided, and will marshal its zero value as
// "clear_tool_uses_20250919".
Type constant.ClearToolUses20250919 `json:"type" default:"clear_tool_uses_20250919"`
// contains filtered or unexported fields
}
The property Type is required.
func (BetaClearToolUses20250919EditParam) MarshalJSON ¶ added in v1.13.0
func (r BetaClearToolUses20250919EditParam) MarshalJSON() (data []byte, err error)
func (*BetaClearToolUses20250919EditParam) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaClearToolUses20250919EditParam) UnmarshalJSON(data []byte) error
type BetaClearToolUses20250919EditResponse ¶ added in v1.13.0
type BetaClearToolUses20250919EditResponse struct {
// Number of input tokens cleared by this edit.
ClearedInputTokens int64 `json:"cleared_input_tokens" api:"required"`
// Number of tool uses that were cleared.
ClearedToolUses int64 `json:"cleared_tool_uses" api:"required"`
// The type of context management edit applied.
Type constant.ClearToolUses20250919 `json:"type" default:"clear_tool_uses_20250919"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClearedInputTokens respjson.Field
ClearedToolUses respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaClearToolUses20250919EditResponse) RawJSON ¶ added in v1.13.0
func (r BetaClearToolUses20250919EditResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaClearToolUses20250919EditResponse) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaClearToolUses20250919EditResponse) UnmarshalJSON(data []byte) error
type BetaClearToolUses20250919EditTriggerUnionParam ¶ added in v1.13.0
type BetaClearToolUses20250919EditTriggerUnionParam struct {
OfInputTokens *BetaInputTokensTriggerParam `json:",omitzero,inline"`
OfToolUses *BetaToolUsesTriggerParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaClearToolUses20250919EditTriggerUnionParam) GetType ¶ added in v1.13.0
func (u BetaClearToolUses20250919EditTriggerUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaClearToolUses20250919EditTriggerUnionParam) GetValue ¶ added in v1.13.0
func (u BetaClearToolUses20250919EditTriggerUnionParam) GetValue() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaClearToolUses20250919EditTriggerUnionParam) MarshalJSON ¶ added in v1.13.0
func (u BetaClearToolUses20250919EditTriggerUnionParam) MarshalJSON() ([]byte, error)
func (*BetaClearToolUses20250919EditTriggerUnionParam) UnmarshalJSON ¶ added in v1.13.0
func (u *BetaClearToolUses20250919EditTriggerUnionParam) UnmarshalJSON(data []byte) error
type BetaCloudConfig ¶ added in v1.33.0
type BetaCloudConfig struct {
// Network configuration policy.
Networking BetaCloudConfigNetworkingUnion `json:"networking" api:"required"`
// Package manager configuration.
Packages BetaPackages `json:"packages" api:"required"`
// Environment type
Type constant.Cloud `json:"type" default:"cloud"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Networking respjson.Field
Packages respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
`cloud` environment configuration.
func (BetaCloudConfig) RawJSON ¶ added in v1.33.0
func (r BetaCloudConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCloudConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaCloudConfig) UnmarshalJSON(data []byte) error
type BetaCloudConfigNetworkingUnion ¶ added in v1.33.0
type BetaCloudConfigNetworkingUnion struct {
// Any of "unrestricted", "limited".
Type string `json:"type"`
// This field is from variant [BetaLimitedNetwork].
AllowMCPServers bool `json:"allow_mcp_servers"`
// This field is from variant [BetaLimitedNetwork].
AllowPackageManagers bool `json:"allow_package_managers"`
// This field is from variant [BetaLimitedNetwork].
AllowedHosts []string `json:"allowed_hosts"`
JSON struct {
Type respjson.Field
AllowMCPServers respjson.Field
AllowPackageManagers respjson.Field
AllowedHosts respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaCloudConfigNetworkingUnion contains all possible properties and values from BetaUnrestrictedNetwork, BetaLimitedNetwork.
Use the BetaCloudConfigNetworkingUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaCloudConfigNetworkingUnion) AsAny ¶ added in v1.33.0
func (u BetaCloudConfigNetworkingUnion) AsAny() anyBetaCloudConfigNetworking
Use the following switch statement to find the correct variant
switch variant := BetaCloudConfigNetworkingUnion.AsAny().(type) {
case anthropic.BetaUnrestrictedNetwork:
case anthropic.BetaLimitedNetwork:
default:
fmt.Errorf("no variant present")
}
func (BetaCloudConfigNetworkingUnion) AsLimited ¶ added in v1.33.0
func (u BetaCloudConfigNetworkingUnion) AsLimited() (v BetaLimitedNetwork)
func (BetaCloudConfigNetworkingUnion) AsUnrestricted ¶ added in v1.33.0
func (u BetaCloudConfigNetworkingUnion) AsUnrestricted() (v BetaUnrestrictedNetwork)
func (BetaCloudConfigNetworkingUnion) RawJSON ¶ added in v1.33.0
func (u BetaCloudConfigNetworkingUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCloudConfigNetworkingUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaCloudConfigNetworkingUnion) UnmarshalJSON(data []byte) error
type BetaCloudConfigParams ¶ added in v1.33.0
type BetaCloudConfigParams struct {
// Network configuration policy. Omit on update to preserve the existing value.
Networking BetaCloudConfigParamsNetworkingUnion `json:"networking,omitzero"`
// Specify packages (and optionally their versions) available in this environment.
//
// When versioning, use the version semantics relevant for the package manager,
// e.g. for `pip` use `package==1.0.0`. You are responsible for validating the
// package and version exist. Unversioned installs the latest.
Packages BetaPackagesParams `json:"packages,omitzero"`
// Environment type
//
// This field can be elided, and will marshal its zero value as "cloud".
Type constant.Cloud `json:"type" default:"cloud"`
// contains filtered or unexported fields
}
Request params for `cloud` environment configuration.
Fields default to null; on update, omitted fields preserve the existing value.
The property Type is required.
func (BetaCloudConfigParams) MarshalJSON ¶ added in v1.33.0
func (r BetaCloudConfigParams) MarshalJSON() (data []byte, err error)
func (*BetaCloudConfigParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaCloudConfigParams) UnmarshalJSON(data []byte) error
type BetaCloudConfigParamsNetworkingUnion ¶ added in v1.33.0
type BetaCloudConfigParamsNetworkingUnion struct {
OfUnrestricted *BetaUnrestrictedNetworkParam `json:",omitzero,inline"`
OfLimited *BetaLimitedNetworkParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaCloudConfigParamsNetworkingUnion) GetAllowMCPServers ¶ added in v1.33.0
func (u BetaCloudConfigParamsNetworkingUnion) GetAllowMCPServers() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaCloudConfigParamsNetworkingUnion) GetAllowPackageManagers ¶ added in v1.33.0
func (u BetaCloudConfigParamsNetworkingUnion) GetAllowPackageManagers() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaCloudConfigParamsNetworkingUnion) GetAllowedHosts ¶ added in v1.33.0
func (u BetaCloudConfigParamsNetworkingUnion) GetAllowedHosts() []string
Returns a pointer to the underlying variant's property, if present.
func (BetaCloudConfigParamsNetworkingUnion) GetType ¶ added in v1.33.0
func (u BetaCloudConfigParamsNetworkingUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaCloudConfigParamsNetworkingUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaCloudConfigParamsNetworkingUnion) MarshalJSON() ([]byte, error)
func (*BetaCloudConfigParamsNetworkingUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaCloudConfigParamsNetworkingUnion) UnmarshalJSON(data []byte) error
type BetaCodeExecutionOutputBlock ¶ added in v1.2.0
type BetaCodeExecutionOutputBlock struct {
FileID string `json:"file_id" api:"required"`
Type constant.CodeExecutionOutput `json:"type" default:"code_execution_output"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCodeExecutionOutputBlock) RawJSON ¶ added in v1.2.0
func (r BetaCodeExecutionOutputBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaCodeExecutionOutputBlock) ToParam ¶ added in v1.20.0
func (r BetaCodeExecutionOutputBlock) ToParam() BetaCodeExecutionOutputBlockParam
func (*BetaCodeExecutionOutputBlock) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionOutputBlock) UnmarshalJSON(data []byte) error
type BetaCodeExecutionOutputBlockParam ¶ added in v1.2.0
type BetaCodeExecutionOutputBlockParam struct {
FileID string `json:"file_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_output".
Type constant.CodeExecutionOutput `json:"type" default:"code_execution_output"`
// contains filtered or unexported fields
}
The properties FileID, Type are required.
func (BetaCodeExecutionOutputBlockParam) MarshalJSON ¶ added in v1.2.0
func (r BetaCodeExecutionOutputBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionOutputBlockParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionOutputBlockParam) UnmarshalJSON(data []byte) error
type BetaCodeExecutionResultBlock ¶ added in v1.2.0
type BetaCodeExecutionResultBlock struct {
Content []BetaCodeExecutionOutputBlock `json:"content" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
Type constant.CodeExecutionResult `json:"type" default:"code_execution_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCodeExecutionResultBlock) RawJSON ¶ added in v1.2.0
func (r BetaCodeExecutionResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCodeExecutionResultBlock) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionResultBlock) UnmarshalJSON(data []byte) error
type BetaCodeExecutionResultBlockParam ¶ added in v1.2.0
type BetaCodeExecutionResultBlockParam struct {
Content []BetaCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_result".
Type constant.CodeExecutionResult `json:"type" default:"code_execution_result"`
// contains filtered or unexported fields
}
The properties Content, ReturnCode, Stderr, Stdout, Type are required.
func (BetaCodeExecutionResultBlockParam) MarshalJSON ¶ added in v1.2.0
func (r BetaCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionResultBlockParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error
type BetaCodeExecutionTool20250522Param ¶ added in v1.2.0
type BetaCodeExecutionTool20250522Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "code_execution".
Name constant.CodeExecution `json:"name" default:"code_execution"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20250522".
Type constant.CodeExecution20250522 `json:"type" default:"code_execution_20250522"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaCodeExecutionTool20250522Param) MarshalJSON ¶ added in v1.2.0
func (r BetaCodeExecutionTool20250522Param) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionTool20250522Param) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionTool20250522Param) UnmarshalJSON(data []byte) error
type BetaCodeExecutionTool20250825Param ¶ added in v1.10.0
type BetaCodeExecutionTool20250825Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "code_execution".
Name constant.CodeExecution `json:"name" default:"code_execution"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20250825".
Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaCodeExecutionTool20250825Param) MarshalJSON ¶ added in v1.10.0
func (r BetaCodeExecutionTool20250825Param) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionTool20250825Param) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaCodeExecutionTool20250825Param) UnmarshalJSON(data []byte) error
type BetaCodeExecutionTool20260120Param ¶ added in v1.23.0
type BetaCodeExecutionTool20260120Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "code_execution".
Name constant.CodeExecution `json:"name" default:"code_execution"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20260120".
Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
// contains filtered or unexported fields
}
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
The properties Name, Type are required.
func (BetaCodeExecutionTool20260120Param) MarshalJSON ¶ added in v1.23.0
func (r BetaCodeExecutionTool20260120Param) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionTool20260120Param) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaCodeExecutionTool20260120Param) UnmarshalJSON(data []byte) error
type BetaCodeExecutionToolResultBlock ¶ added in v1.2.0
type BetaCodeExecutionToolResultBlock struct {
// Code execution result with encrypted stdout for PFC + web_search results.
Content BetaCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.CodeExecutionToolResult `json:"type" default:"code_execution_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCodeExecutionToolResultBlock) RawJSON ¶ added in v1.2.0
func (r BetaCodeExecutionToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaCodeExecutionToolResultBlock) ToParam ¶ added in v1.20.0
func (r BetaCodeExecutionToolResultBlock) ToParam() BetaCodeExecutionToolResultBlockParam
func (*BetaCodeExecutionToolResultBlock) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error
type BetaCodeExecutionToolResultBlockContentUnion ¶ added in v1.2.0
type BetaCodeExecutionToolResultBlockContentUnion struct {
// This field is from variant [BetaCodeExecutionToolResultError].
ErrorCode BetaCodeExecutionToolResultErrorCode `json:"error_code"`
Type string `json:"type"`
Content []BetaCodeExecutionOutputBlock `json:"content"`
ReturnCode int64 `json:"return_code"`
Stderr string `json:"stderr"`
// This field is from variant [BetaCodeExecutionResultBlock].
Stdout string `json:"stdout"`
// This field is from variant [BetaEncryptedCodeExecutionResultBlock].
EncryptedStdout string `json:"encrypted_stdout"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
EncryptedStdout respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaCodeExecutionToolResultBlockContentUnion contains all possible properties and values from BetaCodeExecutionToolResultError, BetaCodeExecutionResultBlock, BetaEncryptedCodeExecutionResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock() (v BetaCodeExecutionResultBlock)
func (BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError() (v BetaCodeExecutionToolResultError)
func (BetaCodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock ¶ added in v1.23.0
func (u BetaCodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock() (v BetaEncryptedCodeExecutionResultBlock)
func (BetaCodeExecutionToolResultBlockContentUnion) RawJSON ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCodeExecutionToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaCodeExecutionToolResultBlockParam ¶ added in v1.2.0
type BetaCodeExecutionToolResultBlockParam struct {
// Code execution result with encrypted stdout for PFC + web_search results.
Content BetaCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "code_execution_tool_result".
Type constant.CodeExecutionToolResult `json:"type" default:"code_execution_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaCodeExecutionToolResultBlockParam) MarshalJSON ¶ added in v1.2.0
func (r BetaCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionToolResultBlockParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaCodeExecutionToolResultBlockParamContentUnion ¶ added in v1.2.0
type BetaCodeExecutionToolResultBlockParamContentUnion struct {
OfError *BetaCodeExecutionToolResultErrorParam `json:",omitzero,inline"`
OfResultBlock *BetaCodeExecutionResultBlockParam `json:",omitzero,inline"`
OfRequestEncryptedCodeExecutionResultBlock *BetaEncryptedCodeExecutionResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaNewCodeExecutionToolRequestError ¶ added in v1.2.0
func BetaNewCodeExecutionToolRequestError(errorCode BetaCodeExecutionToolResultErrorCode) BetaCodeExecutionToolResultBlockParamContentUnion
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetContent ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetContent() []BetaCodeExecutionOutputBlockParam
Returns a pointer to the underlying variant's Content property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout ¶ added in v1.23.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetReturnCode ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetStderr ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetStdout ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) GetType ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaCodeExecutionToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.2.0
func (u BetaCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.2.0
func (u *BetaCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaCodeExecutionToolResultError ¶ added in v1.2.0
type BetaCodeExecutionToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode BetaCodeExecutionToolResultErrorCode `json:"error_code" api:"required"`
Type constant.CodeExecutionToolResultError `json:"type" default:"code_execution_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCodeExecutionToolResultError) RawJSON ¶ added in v1.2.0
func (r BetaCodeExecutionToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCodeExecutionToolResultError) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionToolResultError) UnmarshalJSON(data []byte) error
type BetaCodeExecutionToolResultErrorCode ¶ added in v1.2.0
type BetaCodeExecutionToolResultErrorCode string
const ( BetaCodeExecutionToolResultErrorCodeInvalidToolInput BetaCodeExecutionToolResultErrorCode = "invalid_tool_input" BetaCodeExecutionToolResultErrorCodeTooManyRequests BetaCodeExecutionToolResultErrorCode = "too_many_requests" BetaCodeExecutionToolResultErrorCodeExecutionTimeExceeded BetaCodeExecutionToolResultErrorCode = "execution_time_exceeded" )
type BetaCodeExecutionToolResultErrorParam ¶ added in v1.2.0
type BetaCodeExecutionToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode BetaCodeExecutionToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_tool_result_error".
Type constant.CodeExecutionToolResultError `json:"type" default:"code_execution_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaCodeExecutionToolResultErrorParam) MarshalJSON ¶ added in v1.2.0
func (r BetaCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*BetaCodeExecutionToolResultErrorParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error
type BetaCompact20260112EditParam ¶ added in v1.21.0
type BetaCompact20260112EditParam struct {
// Additional instructions for summarization.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Whether to pause after compaction and return the compaction block to the user.
PauseAfterCompaction param.Opt[bool] `json:"pause_after_compaction,omitzero"`
// When to trigger compaction. Defaults to 150000 input tokens.
Trigger BetaInputTokensTriggerParam `json:"trigger,omitzero"`
// This field can be elided, and will marshal its zero value as "compact_20260112".
Type constant.Compact20260112 `json:"type" default:"compact_20260112"`
// contains filtered or unexported fields
}
Automatically compact older context when reaching the configured trigger threshold.
The property Type is required.
func (BetaCompact20260112EditParam) MarshalJSON ¶ added in v1.21.0
func (r BetaCompact20260112EditParam) MarshalJSON() (data []byte, err error)
func (*BetaCompact20260112EditParam) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaCompact20260112EditParam) UnmarshalJSON(data []byte) error
type BetaCompactionBlock ¶ added in v1.21.0
type BetaCompactionBlock struct {
// Summary of compacted content, or null if compaction failed
Content string `json:"content" api:"required"`
// Opaque metadata from prior compaction, to be round-tripped verbatim
EncryptedContent string `json:"encrypted_content" api:"required"`
Type constant.Compaction `json:"type" default:"compaction"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
EncryptedContent respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A compaction block returned when autocompact is triggered.
When content is None, it indicates the compaction failed to produce a valid summary (e.g., malformed output from the model). Clients may round-trip compaction blocks with null content; the server treats them as no-ops.
func (BetaCompactionBlock) RawJSON ¶ added in v1.21.0
func (r BetaCompactionBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaCompactionBlock) ToParam ¶ added in v1.21.0
func (r BetaCompactionBlock) ToParam() BetaCompactionBlockParam
func (*BetaCompactionBlock) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaCompactionBlock) UnmarshalJSON(data []byte) error
type BetaCompactionBlockParam ¶ added in v1.21.0
type BetaCompactionBlockParam struct {
// Summary of previously compacted content, or null if compaction failed
Content param.Opt[string] `json:"content,omitzero" api:"required"`
// Opaque metadata from prior compaction, to be round-tripped verbatim
EncryptedContent param.Opt[string] `json:"encrypted_content,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "compaction".
Type constant.Compaction `json:"type" default:"compaction"`
// contains filtered or unexported fields
}
A compaction block containing summary of previous context.
Users should round-trip these blocks from responses to subsequent requests to maintain context across compaction boundaries.
When content is None, the block represents a failed compaction. The server treats these as no-ops. Empty string content is not allowed.
The properties Content, Type are required.
func (BetaCompactionBlockParam) MarshalJSON ¶ added in v1.21.0
func (r BetaCompactionBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaCompactionBlockParam) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaCompactionBlockParam) UnmarshalJSON(data []byte) error
type BetaCompactionContentBlockDelta ¶ added in v1.21.0
type BetaCompactionContentBlockDelta struct {
Content string `json:"content" api:"required"`
// Opaque metadata from prior compaction, to be round-tripped verbatim
EncryptedContent string `json:"encrypted_content" api:"required"`
Type constant.CompactionDelta `json:"type" default:"compaction_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
EncryptedContent respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCompactionContentBlockDelta) RawJSON ¶ added in v1.21.0
func (r BetaCompactionContentBlockDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCompactionContentBlockDelta) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaCompactionContentBlockDelta) UnmarshalJSON(data []byte) error
type BetaCompactionIterationUsage ¶ added in v1.21.0
type BetaCompactionIterationUsage struct {
// Breakdown of cached tokens by TTL
CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
// The number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// The number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// Usage for a compaction iteration
Type constant.Compaction `json:"type" default:"compaction"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreation respjson.Field
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token usage for a compaction iteration.
func (BetaCompactionIterationUsage) RawJSON ¶ added in v1.21.0
func (r BetaCompactionIterationUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCompactionIterationUsage) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaCompactionIterationUsage) UnmarshalJSON(data []byte) error
type BetaContainer ¶ added in v1.2.0
type BetaContainer struct {
// Identifier for the container used in this request
ID string `json:"id" api:"required"`
// The time at which the container will expire.
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// Skills loaded in the container
Skills []BetaSkill `json:"skills" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ExpiresAt respjson.Field
Skills respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Information about the container used in the request (for the code execution tool)
func (BetaContainer) RawJSON ¶ added in v1.2.0
func (r BetaContainer) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaContainer) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaContainer) UnmarshalJSON(data []byte) error
type BetaContainerParams ¶ added in v1.15.0
type BetaContainerParams struct {
// Container id
ID param.Opt[string] `json:"id,omitzero"`
// List of skills to load in the container
Skills []BetaSkillParams `json:"skills,omitzero"`
// contains filtered or unexported fields
}
Container parameters with skills to be loaded.
func (BetaContainerParams) MarshalJSON ¶ added in v1.15.0
func (r BetaContainerParams) MarshalJSON() (data []byte, err error)
func (*BetaContainerParams) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaContainerParams) UnmarshalJSON(data []byte) error
type BetaContainerUploadBlock ¶ added in v1.2.0
type BetaContainerUploadBlock struct {
FileID string `json:"file_id" api:"required"`
Type constant.ContainerUpload `json:"type" default:"container_upload"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response model for a file uploaded to the container.
func (BetaContainerUploadBlock) RawJSON ¶ added in v1.2.0
func (r BetaContainerUploadBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaContainerUploadBlock) ToParam ¶ added in v1.20.0
func (r BetaContainerUploadBlock) ToParam() BetaContainerUploadBlockParam
func (*BetaContainerUploadBlock) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaContainerUploadBlock) UnmarshalJSON(data []byte) error
type BetaContainerUploadBlockParam ¶ added in v1.2.0
type BetaContainerUploadBlockParam struct {
FileID string `json:"file_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "container_upload".
Type constant.ContainerUpload `json:"type" default:"container_upload"`
// contains filtered or unexported fields
}
A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.
The properties FileID, Type are required.
func (BetaContainerUploadBlockParam) MarshalJSON ¶ added in v1.2.0
func (r BetaContainerUploadBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaContainerUploadBlockParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaContainerUploadBlockParam) UnmarshalJSON(data []byte) error
type BetaContentBlockParamUnion ¶
type BetaContentBlockParamUnion struct {
OfText *BetaTextBlockParam `json:",omitzero,inline"`
OfImage *BetaImageBlockParam `json:",omitzero,inline"`
OfDocument *BetaRequestDocumentBlockParam `json:",omitzero,inline"`
OfSearchResult *BetaSearchResultBlockParam `json:",omitzero,inline"`
OfThinking *BetaThinkingBlockParam `json:",omitzero,inline"`
OfRedactedThinking *BetaRedactedThinkingBlockParam `json:",omitzero,inline"`
OfToolUse *BetaToolUseBlockParam `json:",omitzero,inline"`
OfToolResult *BetaToolResultBlockParam `json:",omitzero,inline"`
OfServerToolUse *BetaServerToolUseBlockParam `json:",omitzero,inline"`
OfWebSearchToolResult *BetaWebSearchToolResultBlockParam `json:",omitzero,inline"`
OfWebFetchToolResult *BetaWebFetchToolResultBlockParam `json:",omitzero,inline"`
OfAdvisorToolResult *BetaAdvisorToolResultBlockParam `json:",omitzero,inline"`
OfCodeExecutionToolResult *BetaCodeExecutionToolResultBlockParam `json:",omitzero,inline"`
OfBashCodeExecutionToolResult *BetaBashCodeExecutionToolResultBlockParam `json:",omitzero,inline"`
OfTextEditorCodeExecutionToolResult *BetaTextEditorCodeExecutionToolResultBlockParam `json:",omitzero,inline"`
OfToolSearchToolResult *BetaToolSearchToolResultBlockParam `json:",omitzero,inline"`
OfMCPToolUse *BetaMCPToolUseBlockParam `json:",omitzero,inline"`
OfMCPToolResult *BetaRequestMCPToolResultBlockParam `json:",omitzero,inline"`
OfContainerUpload *BetaContainerUploadBlockParam `json:",omitzero,inline"`
OfCompaction *BetaCompactionBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func NewBetaAdvisorToolResultBlock ¶ added in v1.34.0
func NewBetaAdvisorToolResultBlock[ T BetaAdvisorToolResultErrorParam | BetaAdvisorResultBlockParam | BetaAdvisorRedactedResultBlockParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func NewBetaBashCodeExecutionToolResultBlock ¶ added in v1.10.0
func NewBetaBashCodeExecutionToolResultBlock[ T BetaBashCodeExecutionToolResultErrorParam | BetaBashCodeExecutionResultBlockParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func NewBetaCodeExecutionToolResultBlock ¶ added in v1.2.0
func NewBetaCodeExecutionToolResultBlock[ T BetaCodeExecutionToolResultErrorParam | BetaCodeExecutionResultBlockParam | BetaEncryptedCodeExecutionResultBlockParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func NewBetaCompactionBlock ¶ added in v1.21.0
func NewBetaCompactionBlock(content string) BetaContentBlockParamUnion
func NewBetaContainerUploadBlock ¶ added in v1.2.0
func NewBetaContainerUploadBlock(fileID string) BetaContentBlockParamUnion
func NewBetaDocumentBlock ¶
func NewBetaDocumentBlock[ T BetaBase64PDFSourceParam | BetaPlainTextSourceParam | BetaContentBlockSourceParam | BetaURLPDFSourceParam | BetaFileDocumentSourceParam, ](source T) BetaContentBlockParamUnion
func NewBetaImageBlock ¶
func NewBetaImageBlock[ T BetaBase64ImageSourceParam | BetaURLImageSourceParam | BetaFileImageSourceParam, ](source T) BetaContentBlockParamUnion
func NewBetaMCPToolResultBlock ¶ added in v1.2.0
func NewBetaMCPToolResultBlock(toolUseID string) BetaContentBlockParamUnion
func NewBetaRedactedThinkingBlock ¶
func NewBetaRedactedThinkingBlock(data string) BetaContentBlockParamUnion
func NewBetaSearchResultBlock ¶ added in v1.5.0
func NewBetaSearchResultBlock(content []BetaTextBlockParam, source string, title string) BetaContentBlockParamUnion
func NewBetaServerToolUseBlock ¶
func NewBetaServerToolUseBlock(id string, input any, name BetaServerToolUseBlockParamName) BetaContentBlockParamUnion
func NewBetaTextBlock ¶
func NewBetaTextBlock(text string) BetaContentBlockParamUnion
func NewBetaTextEditorCodeExecutionToolResultBlock ¶ added in v1.10.0
func NewBetaTextEditorCodeExecutionToolResultBlock[ T BetaTextEditorCodeExecutionToolResultErrorParam | BetaTextEditorCodeExecutionViewResultBlockParam | BetaTextEditorCodeExecutionCreateResultBlockParam | BetaTextEditorCodeExecutionStrReplaceResultBlockParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func NewBetaThinkingBlock ¶
func NewBetaThinkingBlock(signature string, thinking string) BetaContentBlockParamUnion
func NewBetaToolResultBlock ¶
func NewBetaToolResultBlock(toolUseID string, content string, isError bool) BetaContentBlockParamUnion
func NewBetaToolSearchToolResultBlock ¶ added in v1.19.0
func NewBetaToolSearchToolResultBlock[ T BetaToolSearchToolResultErrorParam | BetaToolSearchToolSearchResultBlockParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func NewBetaToolUseBlock ¶
func NewBetaToolUseBlock(id string, input any, name string) BetaContentBlockParamUnion
func NewBetaWebFetchToolResultBlock ¶ added in v1.12.0
func NewBetaWebFetchToolResultBlock[ T BetaWebFetchToolResultErrorBlockParam | BetaWebFetchBlockParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func NewBetaWebSearchToolResultBlock ¶
func NewBetaWebSearchToolResultBlock[ T []BetaWebSearchResultBlockParam | BetaWebSearchToolRequestErrorParam, ](content T, toolUseID string) BetaContentBlockParamUnion
func (BetaContentBlockParamUnion) GetCacheControl ¶
func (u BetaContentBlockParamUnion) GetCacheControl() *BetaCacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (BetaContentBlockParamUnion) GetCaller ¶ added in v1.19.0
func (u BetaContentBlockParamUnion) GetCaller() (res betaContentBlockParamUnionCaller)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaContentBlockParamUnion) GetCitations ¶
func (u BetaContentBlockParamUnion) GetCitations() (res betaContentBlockParamUnionCitations)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaContentBlockParamUnion) GetContent ¶
func (u BetaContentBlockParamUnion) GetContent() (res betaContentBlockParamUnionContent)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaContentBlockParamUnion) GetContext ¶
func (u BetaContentBlockParamUnion) GetContext() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetData ¶
func (u BetaContentBlockParamUnion) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetEncryptedContent ¶ added in v1.37.0
func (u BetaContentBlockParamUnion) GetEncryptedContent() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetFileID ¶ added in v1.2.0
func (u BetaContentBlockParamUnion) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetID ¶
func (u BetaContentBlockParamUnion) GetID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetInput ¶
func (u BetaContentBlockParamUnion) GetInput() *any
Returns a pointer to the underlying variant's Input property, if present.
func (BetaContentBlockParamUnion) GetIsError ¶
func (u BetaContentBlockParamUnion) GetIsError() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetName ¶
func (u BetaContentBlockParamUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetServerName ¶ added in v1.2.0
func (u BetaContentBlockParamUnion) GetServerName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetSignature ¶
func (u BetaContentBlockParamUnion) GetSignature() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetSource ¶
func (u BetaContentBlockParamUnion) GetSource() (res betaContentBlockParamUnionSource)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaContentBlockParamUnion) GetText ¶
func (u BetaContentBlockParamUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetThinking ¶
func (u BetaContentBlockParamUnion) GetThinking() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetTitle ¶
func (u BetaContentBlockParamUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetToolUseID ¶
func (u BetaContentBlockParamUnion) GetToolUseID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) GetType ¶
func (u BetaContentBlockParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContentBlockParamUnion) MarshalJSON ¶
func (u BetaContentBlockParamUnion) MarshalJSON() ([]byte, error)
func (*BetaContentBlockParamUnion) UnmarshalJSON ¶
func (u *BetaContentBlockParamUnion) UnmarshalJSON(data []byte) error
type BetaContentBlockSourceContentUnionParam ¶
type BetaContentBlockSourceContentUnionParam struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfBetaContentBlockSourceContent []BetaContentBlockSourceContentUnionParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaContentBlockSourceContentUnionParam) MarshalJSON ¶
func (u BetaContentBlockSourceContentUnionParam) MarshalJSON() ([]byte, error)
func (*BetaContentBlockSourceContentUnionParam) UnmarshalJSON ¶
func (u *BetaContentBlockSourceContentUnionParam) UnmarshalJSON(data []byte) error
type BetaContentBlockSourceParam ¶
type BetaContentBlockSourceParam struct {
Content BetaContentBlockSourceContentUnionParam `json:"content,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as "content".
Type constant.Content `json:"type" default:"content"`
// contains filtered or unexported fields
}
The properties Content, Type are required.
func (BetaContentBlockSourceParam) MarshalJSON ¶
func (r BetaContentBlockSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaContentBlockSourceParam) UnmarshalJSON ¶
func (r *BetaContentBlockSourceParam) UnmarshalJSON(data []byte) error
type BetaContentBlockUnion ¶
type BetaContentBlockUnion struct {
// This field is from variant [BetaTextBlock].
Citations []BetaTextCitationUnion `json:"citations"`
// This field is from variant [BetaTextBlock].
Text string `json:"text"`
// Any of "text", "thinking", "redacted_thinking", "tool_use", "server_tool_use",
// "web_search_tool_result", "web_fetch_tool_result", "advisor_tool_result",
// "code_execution_tool_result", "bash_code_execution_tool_result",
// "text_editor_code_execution_tool_result", "tool_search_tool_result",
// "mcp_tool_use", "mcp_tool_result", "container_upload", "compaction".
Type string `json:"type"`
// This field is from variant [BetaThinkingBlock].
Signature string `json:"signature"`
// This field is from variant [BetaThinkingBlock].
Thinking string `json:"thinking"`
// This field is from variant [BetaRedactedThinkingBlock].
Data string `json:"data"`
ID string `json:"id"`
// necessary custom code modification
Input json.RawMessage `json:"input"`
Name string `json:"name"`
// This field is a union of [BetaToolUseBlockCallerUnion],
// [BetaServerToolUseBlockCallerUnion], [BetaWebSearchToolResultBlockCallerUnion],
// [BetaWebFetchToolResultBlockCallerUnion]
Caller BetaContentBlockUnionCaller `json:"caller"`
// This field is a union of [BetaWebSearchToolResultBlockContentUnion],
// [BetaWebFetchToolResultBlockContentUnion],
// [BetaAdvisorToolResultBlockContentUnion],
// [BetaCodeExecutionToolResultBlockContentUnion],
// [BetaBashCodeExecutionToolResultBlockContentUnion],
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion],
// [BetaToolSearchToolResultBlockContentUnion],
// [BetaMCPToolResultBlockContentUnion], [string]
Content BetaContentBlockUnionContent `json:"content"`
ToolUseID string `json:"tool_use_id"`
// This field is from variant [BetaMCPToolUseBlock].
ServerName string `json:"server_name"`
// This field is from variant [BetaMCPToolResultBlock].
IsError bool `json:"is_error"`
// This field is from variant [BetaContainerUploadBlock].
FileID string `json:"file_id"`
// This field is from variant [BetaCompactionBlock].
EncryptedContent string `json:"encrypted_content"`
JSON struct {
Citations respjson.Field
Text respjson.Field
Type respjson.Field
Signature respjson.Field
Thinking respjson.Field
Data respjson.Field
ID respjson.Field
Input respjson.Field
Name respjson.Field
Caller respjson.Field
Content respjson.Field
ToolUseID respjson.Field
ServerName respjson.Field
IsError respjson.Field
FileID respjson.Field
EncryptedContent respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaContentBlockUnion contains all possible properties and values from BetaTextBlock, BetaThinkingBlock, BetaRedactedThinkingBlock, BetaToolUseBlock, BetaServerToolUseBlock, BetaWebSearchToolResultBlock, BetaWebFetchToolResultBlock, BetaAdvisorToolResultBlock, BetaCodeExecutionToolResultBlock, BetaBashCodeExecutionToolResultBlock, BetaTextEditorCodeExecutionToolResultBlock, BetaToolSearchToolResultBlock, BetaMCPToolUseBlock, BetaMCPToolResultBlock, BetaContainerUploadBlock, BetaCompactionBlock.
Use the BetaContentBlockUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaContentBlockUnion) AsAdvisorToolResult ¶ added in v1.34.0
func (u BetaContentBlockUnion) AsAdvisorToolResult() (v BetaAdvisorToolResultBlock)
func (BetaContentBlockUnion) AsAny ¶
func (u BetaContentBlockUnion) AsAny() anyBetaContentBlock
Use the following switch statement to find the correct variant
switch variant := BetaContentBlockUnion.AsAny().(type) {
case anthropic.BetaTextBlock:
case anthropic.BetaThinkingBlock:
case anthropic.BetaRedactedThinkingBlock:
case anthropic.BetaToolUseBlock:
case anthropic.BetaServerToolUseBlock:
case anthropic.BetaWebSearchToolResultBlock:
case anthropic.BetaWebFetchToolResultBlock:
case anthropic.BetaAdvisorToolResultBlock:
case anthropic.BetaCodeExecutionToolResultBlock:
case anthropic.BetaBashCodeExecutionToolResultBlock:
case anthropic.BetaTextEditorCodeExecutionToolResultBlock:
case anthropic.BetaToolSearchToolResultBlock:
case anthropic.BetaMCPToolUseBlock:
case anthropic.BetaMCPToolResultBlock:
case anthropic.BetaContainerUploadBlock:
case anthropic.BetaCompactionBlock:
default:
fmt.Errorf("no variant present")
}
func (BetaContentBlockUnion) AsBashCodeExecutionToolResult ¶ added in v1.10.0
func (u BetaContentBlockUnion) AsBashCodeExecutionToolResult() (v BetaBashCodeExecutionToolResultBlock)
func (BetaContentBlockUnion) AsCodeExecutionToolResult ¶ added in v1.2.0
func (u BetaContentBlockUnion) AsCodeExecutionToolResult() (v BetaCodeExecutionToolResultBlock)
func (BetaContentBlockUnion) AsCompaction ¶ added in v1.21.0
func (u BetaContentBlockUnion) AsCompaction() (v BetaCompactionBlock)
func (BetaContentBlockUnion) AsContainerUpload ¶ added in v1.2.0
func (u BetaContentBlockUnion) AsContainerUpload() (v BetaContainerUploadBlock)
func (BetaContentBlockUnion) AsMCPToolResult ¶ added in v1.2.0
func (u BetaContentBlockUnion) AsMCPToolResult() (v BetaMCPToolResultBlock)
func (BetaContentBlockUnion) AsMCPToolUse ¶ added in v1.2.0
func (u BetaContentBlockUnion) AsMCPToolUse() (v BetaMCPToolUseBlock)
func (BetaContentBlockUnion) AsRedactedThinking ¶
func (u BetaContentBlockUnion) AsRedactedThinking() (v BetaRedactedThinkingBlock)
func (BetaContentBlockUnion) AsServerToolUse ¶
func (u BetaContentBlockUnion) AsServerToolUse() (v BetaServerToolUseBlock)
func (BetaContentBlockUnion) AsText ¶
func (u BetaContentBlockUnion) AsText() (v BetaTextBlock)
func (BetaContentBlockUnion) AsTextEditorCodeExecutionToolResult ¶ added in v1.10.0
func (u BetaContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v BetaTextEditorCodeExecutionToolResultBlock)
func (BetaContentBlockUnion) AsThinking ¶
func (u BetaContentBlockUnion) AsThinking() (v BetaThinkingBlock)
func (BetaContentBlockUnion) AsToolSearchToolResult ¶ added in v1.19.0
func (u BetaContentBlockUnion) AsToolSearchToolResult() (v BetaToolSearchToolResultBlock)
func (BetaContentBlockUnion) AsToolUse ¶
func (u BetaContentBlockUnion) AsToolUse() (v BetaToolUseBlock)
func (BetaContentBlockUnion) AsWebFetchToolResult ¶ added in v1.12.0
func (u BetaContentBlockUnion) AsWebFetchToolResult() (v BetaWebFetchToolResultBlock)
func (BetaContentBlockUnion) AsWebSearchToolResult ¶
func (u BetaContentBlockUnion) AsWebSearchToolResult() (v BetaWebSearchToolResultBlock)
func (BetaContentBlockUnion) RawJSON ¶
func (u BetaContentBlockUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaContentBlockUnion) ToParam ¶
func (r BetaContentBlockUnion) ToParam() BetaContentBlockParamUnion
func (*BetaContentBlockUnion) UnmarshalJSON ¶
func (r *BetaContentBlockUnion) UnmarshalJSON(data []byte) error
type BetaContentBlockUnionCaller ¶ added in v1.19.0
type BetaContentBlockUnionCaller struct {
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaContentBlockUnionCaller is an implicit subunion of BetaContentBlockUnion. BetaContentBlockUnionCaller provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaContentBlockUnion.
func (*BetaContentBlockUnionCaller) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaContentBlockUnionCaller) UnmarshalJSON(data []byte) error
type BetaContentBlockUnionContent ¶ added in v1.2.0
type BetaContentBlockUnionContent struct {
// This field will be present if the value is a [[]BetaWebSearchResultBlock]
// instead of an object.
OfBetaWebSearchResultBlockArray []BetaWebSearchResultBlock `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]BetaTextBlock] instead of an
// object.
OfBetaMCPToolResultBlockContent []BetaTextBlock `json:",inline"`
ErrorCode string `json:"error_code"`
Type string `json:"type"`
// This field is a union of [BetaDocumentBlock], [[]BetaCodeExecutionOutputBlock],
// [[]BetaCodeExecutionOutputBlock], [[]BetaBashCodeExecutionOutputBlock], [string]
Content BetaContentBlockUnionContentContent `json:"content"`
// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
RetrievedAt string `json:"retrieved_at"`
// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
URL string `json:"url"`
// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
Text string `json:"text"`
// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
EncryptedContent string `json:"encrypted_content"`
ReturnCode int64 `json:"return_code"`
Stderr string `json:"stderr"`
Stdout string `json:"stdout"`
// This field is from variant [BetaCodeExecutionToolResultBlockContentUnion].
EncryptedStdout string `json:"encrypted_stdout"`
ErrorMessage string `json:"error_message"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
NumLines int64 `json:"num_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
StartLine int64 `json:"start_line"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
TotalLines int64 `json:"total_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
IsFileUpdate bool `json:"is_file_update"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
Lines []string `json:"lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
NewLines int64 `json:"new_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
NewStart int64 `json:"new_start"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
OldLines int64 `json:"old_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
OldStart int64 `json:"old_start"`
// This field is from variant [BetaToolSearchToolResultBlockContentUnion].
ToolReferences []BetaToolReferenceBlock `json:"tool_references"`
JSON struct {
OfBetaWebSearchResultBlockArray respjson.Field
OfString respjson.Field
OfBetaMCPToolResultBlockContent respjson.Field
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
RetrievedAt respjson.Field
URL respjson.Field
Text respjson.Field
EncryptedContent respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
EncryptedStdout respjson.Field
ErrorMessage respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
IsFileUpdate respjson.Field
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
ToolReferences respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaContentBlockUnionContent is an implicit subunion of BetaContentBlockUnion. BetaContentBlockUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaWebSearchResultBlockArray OfString OfBetaMCPToolResultBlockContent]
func (*BetaContentBlockUnionContent) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaContentBlockUnionContent) UnmarshalJSON(data []byte) error
type BetaContentBlockUnionContentContent ¶ added in v1.10.0
type BetaContentBlockUnionContentContent struct {
// This field will be present if the value is a [[]BetaCodeExecutionOutputBlock]
// instead of an object.
OfContent []BetaCodeExecutionOutputBlock `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [BetaDocumentBlock].
Citations BetaCitationConfig `json:"citations"`
// This field is from variant [BetaDocumentBlock].
Source BetaDocumentBlockSourceUnion `json:"source"`
// This field is from variant [BetaDocumentBlock].
Title string `json:"title"`
// This field is from variant [BetaDocumentBlock].
Type constant.Document `json:"type"`
JSON struct {
OfContent respjson.Field
OfString respjson.Field
Citations respjson.Field
Source respjson.Field
Title respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaContentBlockUnionContentContent is an implicit subunion of BetaContentBlockUnion. BetaContentBlockUnionContentContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfContent OfString]
func (*BetaContentBlockUnionContentContent) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaContentBlockUnionContentContent) UnmarshalJSON(data []byte) error
type BetaContextManagementCapability ¶ added in v1.27.1
type BetaContextManagementCapability struct {
// Indicates whether a capability is supported.
ClearThinking20251015 BetaCapabilitySupport `json:"clear_thinking_20251015" api:"required"`
// Indicates whether a capability is supported.
ClearToolUses20250919 BetaCapabilitySupport `json:"clear_tool_uses_20250919" api:"required"`
// Indicates whether a capability is supported.
Compact20260112 BetaCapabilitySupport `json:"compact_20260112" api:"required"`
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClearThinking20251015 respjson.Field
ClearToolUses20250919 respjson.Field
Compact20260112 respjson.Field
Supported respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Context management capability details.
func (BetaContextManagementCapability) RawJSON ¶ added in v1.27.1
func (r BetaContextManagementCapability) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaContextManagementCapability) UnmarshalJSON ¶ added in v1.27.1
func (r *BetaContextManagementCapability) UnmarshalJSON(data []byte) error
type BetaContextManagementConfigEditUnionParam ¶ added in v1.16.0
type BetaContextManagementConfigEditUnionParam struct {
OfClearToolUses20250919 *BetaClearToolUses20250919EditParam `json:",omitzero,inline"`
OfClearThinking20251015 *BetaClearThinking20251015EditParam `json:",omitzero,inline"`
OfCompact20260112 *BetaCompact20260112EditParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaContextManagementConfigEditUnionParam) GetClearAtLeast ¶ added in v1.16.0
func (u BetaContextManagementConfigEditUnionParam) GetClearAtLeast() *BetaInputTokensClearAtLeastParam
Returns a pointer to the underlying variant's property, if present.
func (BetaContextManagementConfigEditUnionParam) GetClearToolInputs ¶ added in v1.16.0
func (u BetaContextManagementConfigEditUnionParam) GetClearToolInputs() *BetaClearToolUses20250919EditClearToolInputsUnionParam
Returns a pointer to the underlying variant's property, if present.
func (BetaContextManagementConfigEditUnionParam) GetExcludeTools ¶ added in v1.16.0
func (u BetaContextManagementConfigEditUnionParam) GetExcludeTools() []string
Returns a pointer to the underlying variant's property, if present.
func (BetaContextManagementConfigEditUnionParam) GetInstructions ¶ added in v1.21.0
func (u BetaContextManagementConfigEditUnionParam) GetInstructions() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContextManagementConfigEditUnionParam) GetKeep ¶ added in v1.16.0
func (u BetaContextManagementConfigEditUnionParam) GetKeep() (res betaContextManagementConfigEditUnionParamKeep)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaContextManagementConfigEditUnionParam) GetPauseAfterCompaction ¶ added in v1.21.0
func (u BetaContextManagementConfigEditUnionParam) GetPauseAfterCompaction() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaContextManagementConfigEditUnionParam) GetType ¶ added in v1.16.0
func (u BetaContextManagementConfigEditUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaContextManagementConfigEditUnionParam) MarshalJSON ¶ added in v1.16.0
func (u BetaContextManagementConfigEditUnionParam) MarshalJSON() ([]byte, error)
func (*BetaContextManagementConfigEditUnionParam) UnmarshalJSON ¶ added in v1.16.0
func (u *BetaContextManagementConfigEditUnionParam) UnmarshalJSON(data []byte) error
type BetaContextManagementConfigParam ¶ added in v1.13.0
type BetaContextManagementConfigParam struct {
// List of context management edits to apply
Edits []BetaContextManagementConfigEditUnionParam `json:"edits,omitzero"`
// contains filtered or unexported fields
}
func (BetaContextManagementConfigParam) MarshalJSON ¶ added in v1.13.0
func (r BetaContextManagementConfigParam) MarshalJSON() (data []byte, err error)
func (*BetaContextManagementConfigParam) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaContextManagementConfigParam) UnmarshalJSON(data []byte) error
type BetaContextManagementResponse ¶ added in v1.13.0
type BetaContextManagementResponse struct {
// List of context management edits that were applied.
AppliedEdits []BetaContextManagementResponseAppliedEditUnion `json:"applied_edits" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AppliedEdits respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaContextManagementResponse) RawJSON ¶ added in v1.13.0
func (r BetaContextManagementResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaContextManagementResponse) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaContextManagementResponse) UnmarshalJSON(data []byte) error
type BetaContextManagementResponseAppliedEditUnion ¶ added in v1.16.0
type BetaContextManagementResponseAppliedEditUnion struct {
ClearedInputTokens int64 `json:"cleared_input_tokens"`
// This field is from variant [BetaClearToolUses20250919EditResponse].
ClearedToolUses int64 `json:"cleared_tool_uses"`
// Any of "clear_tool_uses_20250919", "clear_thinking_20251015".
Type string `json:"type"`
// This field is from variant [BetaClearThinking20251015EditResponse].
ClearedThinkingTurns int64 `json:"cleared_thinking_turns"`
JSON struct {
ClearedInputTokens respjson.Field
ClearedToolUses respjson.Field
Type respjson.Field
ClearedThinkingTurns respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaContextManagementResponseAppliedEditUnion contains all possible properties and values from BetaClearToolUses20250919EditResponse, BetaClearThinking20251015EditResponse.
Use the BetaContextManagementResponseAppliedEditUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaContextManagementResponseAppliedEditUnion) AsAny ¶ added in v1.16.0
func (u BetaContextManagementResponseAppliedEditUnion) AsAny() anyBetaContextManagementResponseAppliedEdit
Use the following switch statement to find the correct variant
switch variant := BetaContextManagementResponseAppliedEditUnion.AsAny().(type) {
case anthropic.BetaClearToolUses20250919EditResponse:
case anthropic.BetaClearThinking20251015EditResponse:
default:
fmt.Errorf("no variant present")
}
func (BetaContextManagementResponseAppliedEditUnion) AsClearThinking20251015 ¶ added in v1.16.0
func (u BetaContextManagementResponseAppliedEditUnion) AsClearThinking20251015() (v BetaClearThinking20251015EditResponse)
func (BetaContextManagementResponseAppliedEditUnion) AsClearToolUses20250919 ¶ added in v1.16.0
func (u BetaContextManagementResponseAppliedEditUnion) AsClearToolUses20250919() (v BetaClearToolUses20250919EditResponse)
func (BetaContextManagementResponseAppliedEditUnion) RawJSON ¶ added in v1.16.0
func (u BetaContextManagementResponseAppliedEditUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaContextManagementResponseAppliedEditUnion) UnmarshalJSON ¶ added in v1.16.0
func (r *BetaContextManagementResponseAppliedEditUnion) UnmarshalJSON(data []byte) error
type BetaCountTokensContextManagementResponse ¶ added in v1.13.0
type BetaCountTokensContextManagementResponse struct {
// The original token count before context management was applied
OriginalInputTokens int64 `json:"original_input_tokens" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
OriginalInputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaCountTokensContextManagementResponse) RawJSON ¶ added in v1.13.0
func (r BetaCountTokensContextManagementResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaCountTokensContextManagementResponse) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaCountTokensContextManagementResponse) UnmarshalJSON(data []byte) error
type BetaDeletedMessageBatch ¶
type BetaDeletedMessageBatch struct {
// ID of the Message Batch.
ID string `json:"id" api:"required"`
// Deleted object type.
//
// For Message Batches, this is always `"message_batch_deleted"`.
Type constant.MessageBatchDeleted `json:"type" default:"message_batch_deleted"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaDeletedMessageBatch) RawJSON ¶
func (r BetaDeletedMessageBatch) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaDeletedMessageBatch) UnmarshalJSON ¶
func (r *BetaDeletedMessageBatch) UnmarshalJSON(data []byte) error
type BetaDirectCaller ¶ added in v1.19.0
type BetaDirectCaller struct {
Type constant.Direct `json:"type" default:"direct"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Tool invocation directly from the model.
func (BetaDirectCaller) RawJSON ¶ added in v1.19.0
func (r BetaDirectCaller) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaDirectCaller) ToParam ¶ added in v1.19.0
func (r BetaDirectCaller) ToParam() BetaDirectCallerParam
ToParam converts this BetaDirectCaller to a BetaDirectCallerParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaDirectCallerParam.Overrides()
func (*BetaDirectCaller) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaDirectCaller) UnmarshalJSON(data []byte) error
type BetaDirectCallerParam ¶ added in v1.19.0
type BetaDirectCallerParam struct {
Type constant.Direct `json:"type" default:"direct"`
// contains filtered or unexported fields
}
Tool invocation directly from the model.
This struct has a constant value, construct it with NewBetaDirectCallerParam.
func NewBetaDirectCallerParam ¶ added in v1.19.0
func NewBetaDirectCallerParam() BetaDirectCallerParam
func (BetaDirectCallerParam) MarshalJSON ¶ added in v1.19.0
func (r BetaDirectCallerParam) MarshalJSON() (data []byte, err error)
func (*BetaDirectCallerParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaDirectCallerParam) UnmarshalJSON(data []byte) error
type BetaDocumentBlock ¶ added in v1.12.0
type BetaDocumentBlock struct {
// Citation configuration for the document
Citations BetaCitationConfig `json:"citations" api:"required"`
Source BetaDocumentBlockSourceUnion `json:"source" api:"required"`
// The title of the document
Title string `json:"title" api:"required"`
Type constant.Document `json:"type" default:"document"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Citations respjson.Field
Source respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaDocumentBlock) RawJSON ¶ added in v1.12.0
func (r BetaDocumentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaDocumentBlock) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaDocumentBlock) UnmarshalJSON(data []byte) error
type BetaDocumentBlockSourceUnion ¶ added in v1.12.0
type BetaDocumentBlockSourceUnion struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
// Any of "base64", "text".
Type string `json:"type"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaDocumentBlockSourceUnion contains all possible properties and values from BetaBase64PDFSource, BetaPlainTextSource.
Use the BetaDocumentBlockSourceUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaDocumentBlockSourceUnion) AsAny ¶ added in v1.12.0
func (u BetaDocumentBlockSourceUnion) AsAny() anyBetaDocumentBlockSource
Use the following switch statement to find the correct variant
switch variant := BetaDocumentBlockSourceUnion.AsAny().(type) {
case anthropic.BetaBase64PDFSource:
case anthropic.BetaPlainTextSource:
default:
fmt.Errorf("no variant present")
}
func (BetaDocumentBlockSourceUnion) AsBase64 ¶ added in v1.12.0
func (u BetaDocumentBlockSourceUnion) AsBase64() (v BetaBase64PDFSource)
func (BetaDocumentBlockSourceUnion) AsText ¶ added in v1.12.0
func (u BetaDocumentBlockSourceUnion) AsText() (v BetaPlainTextSource)
func (BetaDocumentBlockSourceUnion) RawJSON ¶ added in v1.12.0
func (u BetaDocumentBlockSourceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaDocumentBlockSourceUnion) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaDocumentBlockSourceUnion) UnmarshalJSON(data []byte) error
type BetaEffortCapability ¶ added in v1.27.1
type BetaEffortCapability struct {
// Whether the model supports high effort level.
High BetaCapabilitySupport `json:"high" api:"required"`
// Whether the model supports low effort level.
Low BetaCapabilitySupport `json:"low" api:"required"`
// Whether the model supports max effort level.
Max BetaCapabilitySupport `json:"max" api:"required"`
// Whether the model supports medium effort level.
Medium BetaCapabilitySupport `json:"medium" api:"required"`
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// Indicates whether a capability is supported.
Xhigh BetaCapabilitySupport `json:"xhigh" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
High respjson.Field
Low respjson.Field
Max respjson.Field
Medium respjson.Field
Supported respjson.Field
Xhigh respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Effort (reasoning_effort) capability details.
func (BetaEffortCapability) RawJSON ¶ added in v1.27.1
func (r BetaEffortCapability) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaEffortCapability) UnmarshalJSON ¶ added in v1.27.1
func (r *BetaEffortCapability) UnmarshalJSON(data []byte) error
type BetaEncryptedCodeExecutionResultBlock ¶ added in v1.23.0
type BetaEncryptedCodeExecutionResultBlock struct {
Content []BetaCodeExecutionOutputBlock `json:"content" api:"required"`
EncryptedStdout string `json:"encrypted_stdout" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Type constant.EncryptedCodeExecutionResult `json:"type" default:"encrypted_code_execution_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
EncryptedStdout respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Code execution result with encrypted stdout for PFC + web_search results.
func (BetaEncryptedCodeExecutionResultBlock) RawJSON ¶ added in v1.23.0
func (r BetaEncryptedCodeExecutionResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaEncryptedCodeExecutionResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaEncryptedCodeExecutionResultBlock) UnmarshalJSON(data []byte) error
type BetaEncryptedCodeExecutionResultBlockParam ¶ added in v1.23.0
type BetaEncryptedCodeExecutionResultBlockParam struct {
Content []BetaCodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
EncryptedStdout string `json:"encrypted_stdout" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
// This field can be elided, and will marshal its zero value as
// "encrypted_code_execution_result".
Type constant.EncryptedCodeExecutionResult `json:"type" default:"encrypted_code_execution_result"`
// contains filtered or unexported fields
}
Code execution result with encrypted stdout for PFC + web_search results.
The properties Content, EncryptedStdout, ReturnCode, Stderr, Type are required.
func (BetaEncryptedCodeExecutionResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r BetaEncryptedCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaEncryptedCodeExecutionResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaEncryptedCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error
type BetaEnvironment ¶ added in v1.33.0
type BetaEnvironment struct {
// Environment identifier (e.g., 'env\_...')
ID string `json:"id" api:"required"`
// RFC 3339 timestamp when environment was archived, or null if not archived
ArchivedAt string `json:"archived_at" api:"required"`
// `cloud` environment configuration.
Config BetaCloudConfig `json:"config" api:"required"`
// RFC 3339 timestamp when environment was created
CreatedAt string `json:"created_at" api:"required"`
// User-provided description for the environment
Description string `json:"description" api:"required"`
// User-provided metadata key-value pairs
Metadata map[string]string `json:"metadata" api:"required"`
// Human-readable name for the environment
Name string `json:"name" api:"required"`
// The type of object (always 'environment')
Type constant.Environment `json:"type" default:"environment"`
// RFC 3339 timestamp when environment was last updated
UpdatedAt string `json:"updated_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ArchivedAt respjson.Field
Config respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Metadata respjson.Field
Name respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Unified Environment resource for both cloud and BYOC environments.
func (BetaEnvironment) RawJSON ¶ added in v1.33.0
func (r BetaEnvironment) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaEnvironment) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaEnvironment) UnmarshalJSON(data []byte) error
type BetaEnvironmentArchiveParams ¶ added in v1.33.0
type BetaEnvironmentArchiveParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaEnvironmentDeleteParams ¶ added in v1.33.0
type BetaEnvironmentDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaEnvironmentDeleteResponse ¶ added in v1.33.0
type BetaEnvironmentDeleteResponse struct {
// Environment identifier
ID string `json:"id" api:"required"`
// The type of response
Type constant.EnvironmentDeleted `json:"type" default:"environment_deleted"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response after deleting an environment.
func (BetaEnvironmentDeleteResponse) RawJSON ¶ added in v1.33.0
func (r BetaEnvironmentDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaEnvironmentDeleteResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaEnvironmentDeleteResponse) UnmarshalJSON(data []byte) error
type BetaEnvironmentGetParams ¶ added in v1.33.0
type BetaEnvironmentGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaEnvironmentListParams ¶ added in v1.33.0
type BetaEnvironmentListParams struct {
// Opaque cursor from previous response for pagination. Pass the `next_page` value
// from the previous response.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Include archived environments in the response
IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
// Maximum number of environments to return
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaEnvironmentListParams) URLQuery ¶ added in v1.33.0
func (r BetaEnvironmentListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaEnvironmentListParams's query parameters as `url.Values`.
type BetaEnvironmentNewParams ¶ added in v1.33.0
type BetaEnvironmentNewParams struct {
// Human-readable name for the environment
Name string `json:"name" api:"required"`
// Optional description of the environment
Description param.Opt[string] `json:"description,omitzero"`
// Request params for `cloud` environment configuration.
//
// Fields default to null; on update, omitted fields preserve the existing value.
Config BetaCloudConfigParams `json:"config,omitzero"`
// User-provided metadata key-value pairs
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaEnvironmentNewParams) MarshalJSON ¶ added in v1.33.0
func (r BetaEnvironmentNewParams) MarshalJSON() (data []byte, err error)
func (*BetaEnvironmentNewParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaEnvironmentNewParams) UnmarshalJSON(data []byte) error
type BetaEnvironmentService ¶ added in v1.33.0
type BetaEnvironmentService struct {
Options []option.RequestOption
}
BetaEnvironmentService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaEnvironmentService method instead.
func NewBetaEnvironmentService ¶ added in v1.33.0
func NewBetaEnvironmentService(opts ...option.RequestOption) (r BetaEnvironmentService)
NewBetaEnvironmentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaEnvironmentService) Archive ¶ added in v1.33.0
func (r *BetaEnvironmentService) Archive(ctx context.Context, environmentID string, body BetaEnvironmentArchiveParams, opts ...option.RequestOption) (res *BetaEnvironment, err error)
Archive an environment by ID. Archived environments cannot be used to create new sessions.
func (*BetaEnvironmentService) Delete ¶ added in v1.33.0
func (r *BetaEnvironmentService) Delete(ctx context.Context, environmentID string, body BetaEnvironmentDeleteParams, opts ...option.RequestOption) (res *BetaEnvironmentDeleteResponse, err error)
Delete an environment by ID. Returns a confirmation of the deletion.
func (*BetaEnvironmentService) Get ¶ added in v1.33.0
func (r *BetaEnvironmentService) Get(ctx context.Context, environmentID string, query BetaEnvironmentGetParams, opts ...option.RequestOption) (res *BetaEnvironment, err error)
Retrieve a specific environment by ID.
func (*BetaEnvironmentService) List ¶ added in v1.33.0
func (r *BetaEnvironmentService) List(ctx context.Context, params BetaEnvironmentListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaEnvironment], err error)
List environments with pagination support.
func (*BetaEnvironmentService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaEnvironmentService) ListAutoPaging(ctx context.Context, params BetaEnvironmentListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaEnvironment]
List environments with pagination support.
func (*BetaEnvironmentService) New ¶ added in v1.33.0
func (r *BetaEnvironmentService) New(ctx context.Context, params BetaEnvironmentNewParams, opts ...option.RequestOption) (res *BetaEnvironment, err error)
Create a new environment with the specified configuration.
func (*BetaEnvironmentService) Update ¶ added in v1.33.0
func (r *BetaEnvironmentService) Update(ctx context.Context, environmentID string, params BetaEnvironmentUpdateParams, opts ...option.RequestOption) (res *BetaEnvironment, err error)
Update an existing environment's configuration.
type BetaEnvironmentUpdateParams ¶ added in v1.33.0
type BetaEnvironmentUpdateParams struct {
// Updated description of the environment
Description param.Opt[string] `json:"description,omitzero"`
// Updated name for the environment
Name param.Opt[string] `json:"name,omitzero"`
// Request params for `cloud` environment configuration.
//
// Fields default to null; on update, omitted fields preserve the existing value.
Config BetaCloudConfigParams `json:"config,omitzero"`
// User-provided metadata key-value pairs. Set a value to null or empty string to
// delete the key.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaEnvironmentUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaEnvironmentUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaEnvironmentUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaEnvironmentUpdateParams) UnmarshalJSON(data []byte) error
type BetaErrorResponse ¶
type BetaErrorResponse struct {
Error BetaErrorUnion `json:"error" api:"required"`
RequestID string `json:"request_id" api:"required"`
Type constant.Error `json:"type" default:"error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Error respjson.Field
RequestID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaErrorResponse) RawJSON ¶
func (r BetaErrorResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaErrorResponse) UnmarshalJSON ¶
func (r *BetaErrorResponse) UnmarshalJSON(data []byte) error
type BetaErrorUnion ¶
type BetaErrorUnion struct {
Message string `json:"message"`
// Any of "invalid_request_error", "authentication_error", "billing_error",
// "permission_error", "not_found_error", "rate_limit_error", "timeout_error",
// "api_error", "overloaded_error".
Type string `json:"type"`
JSON struct {
Message respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaErrorUnion contains all possible properties and values from BetaInvalidRequestError, BetaAuthenticationError, BetaBillingError, BetaPermissionError, BetaNotFoundError, BetaRateLimitError, BetaGatewayTimeoutError, BetaAPIError, BetaOverloadedError.
Use the BetaErrorUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaErrorUnion) AsAPIError ¶
func (u BetaErrorUnion) AsAPIError() (v BetaAPIError)
func (BetaErrorUnion) AsAny ¶
func (u BetaErrorUnion) AsAny() anyBetaError
Use the following switch statement to find the correct variant
switch variant := BetaErrorUnion.AsAny().(type) {
case anthropic.BetaInvalidRequestError:
case anthropic.BetaAuthenticationError:
case anthropic.BetaBillingError:
case anthropic.BetaPermissionError:
case anthropic.BetaNotFoundError:
case anthropic.BetaRateLimitError:
case anthropic.BetaGatewayTimeoutError:
case anthropic.BetaAPIError:
case anthropic.BetaOverloadedError:
default:
fmt.Errorf("no variant present")
}
func (BetaErrorUnion) AsAuthenticationError ¶
func (u BetaErrorUnion) AsAuthenticationError() (v BetaAuthenticationError)
func (BetaErrorUnion) AsBillingError ¶
func (u BetaErrorUnion) AsBillingError() (v BetaBillingError)
func (BetaErrorUnion) AsInvalidRequestError ¶
func (u BetaErrorUnion) AsInvalidRequestError() (v BetaInvalidRequestError)
func (BetaErrorUnion) AsNotFoundError ¶
func (u BetaErrorUnion) AsNotFoundError() (v BetaNotFoundError)
func (BetaErrorUnion) AsOverloadedError ¶
func (u BetaErrorUnion) AsOverloadedError() (v BetaOverloadedError)
func (BetaErrorUnion) AsPermissionError ¶
func (u BetaErrorUnion) AsPermissionError() (v BetaPermissionError)
func (BetaErrorUnion) AsRateLimitError ¶
func (u BetaErrorUnion) AsRateLimitError() (v BetaRateLimitError)
func (BetaErrorUnion) AsTimeoutError ¶
func (u BetaErrorUnion) AsTimeoutError() (v BetaGatewayTimeoutError)
func (BetaErrorUnion) RawJSON ¶
func (u BetaErrorUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaErrorUnion) UnmarshalJSON ¶
func (r *BetaErrorUnion) UnmarshalJSON(data []byte) error
type BetaFileDeleteParams ¶ added in v1.2.0
type BetaFileDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaFileDocumentSourceParam ¶ added in v1.2.0
type BetaFileDocumentSourceParam struct {
FileID string `json:"file_id" api:"required"`
// This field can be elided, and will marshal its zero value as "file".
Type constant.File `json:"type" default:"file"`
// contains filtered or unexported fields
}
The properties FileID, Type are required.
func (BetaFileDocumentSourceParam) MarshalJSON ¶ added in v1.2.0
func (r BetaFileDocumentSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaFileDocumentSourceParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaFileDocumentSourceParam) UnmarshalJSON(data []byte) error
type BetaFileDownloadParams ¶ added in v1.2.0
type BetaFileDownloadParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaFileGetMetadataParams ¶ added in v1.2.0
type BetaFileGetMetadataParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaFileImageSourceParam ¶ added in v1.2.0
type BetaFileImageSourceParam struct {
FileID string `json:"file_id" api:"required"`
// This field can be elided, and will marshal its zero value as "file".
Type constant.File `json:"type" default:"file"`
// contains filtered or unexported fields
}
The properties FileID, Type are required.
func (BetaFileImageSourceParam) MarshalJSON ¶ added in v1.2.0
func (r BetaFileImageSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaFileImageSourceParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaFileImageSourceParam) UnmarshalJSON(data []byte) error
type BetaFileListParams ¶ added in v1.2.0
type BetaFileListParams struct {
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately after this object.
AfterID param.Opt[string] `query:"after_id,omitzero" json:"-"`
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately before this object.
BeforeID param.Opt[string] `query:"before_id,omitzero" json:"-"`
// Number of items to return per page.
//
// Defaults to `20`. Ranges from `1` to `1000`.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter by scope ID. Only returns files associated with the specified scope
// (e.g., a session ID).
ScopeID param.Opt[string] `query:"scope_id,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaFileListParams) URLQuery ¶ added in v1.2.0
func (r BetaFileListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaFileListParams's query parameters as `url.Values`.
type BetaFileScope ¶ added in v1.33.0
type BetaFileScope struct {
// The ID of the scoping resource (e.g., the session ID).
ID string `json:"id" api:"required"`
// The type of scope (e.g., `"session"`).
Type constant.Session `json:"type" default:"session"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaFileScope) RawJSON ¶ added in v1.33.0
func (r BetaFileScope) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaFileScope) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaFileScope) UnmarshalJSON(data []byte) error
type BetaFileService ¶ added in v1.2.0
type BetaFileService struct {
Options []option.RequestOption
}
BetaFileService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaFileService method instead.
func NewBetaFileService ¶ added in v1.2.0
func NewBetaFileService(opts ...option.RequestOption) (r BetaFileService)
NewBetaFileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaFileService) Delete ¶ added in v1.2.0
func (r *BetaFileService) Delete(ctx context.Context, fileID string, body BetaFileDeleteParams, opts ...option.RequestOption) (res *DeletedFile, err error)
Delete File
func (*BetaFileService) Download ¶ added in v1.2.0
func (r *BetaFileService) Download(ctx context.Context, fileID string, query BetaFileDownloadParams, opts ...option.RequestOption) (res *http.Response, err error)
Download File
func (*BetaFileService) GetMetadata ¶ added in v1.2.0
func (r *BetaFileService) GetMetadata(ctx context.Context, fileID string, query BetaFileGetMetadataParams, opts ...option.RequestOption) (res *FileMetadata, err error)
Get File Metadata
func (*BetaFileService) List ¶ added in v1.2.0
func (r *BetaFileService) List(ctx context.Context, params BetaFileListParams, opts ...option.RequestOption) (res *pagination.Page[FileMetadata], err error)
List Files
func (*BetaFileService) ListAutoPaging ¶ added in v1.2.0
func (r *BetaFileService) ListAutoPaging(ctx context.Context, params BetaFileListParams, opts ...option.RequestOption) *pagination.PageAutoPager[FileMetadata]
List Files
func (*BetaFileService) Upload ¶ added in v1.2.0
func (r *BetaFileService) Upload(ctx context.Context, params BetaFileUploadParams, opts ...option.RequestOption) (res *FileMetadata, err error)
Upload File
type BetaFileUploadParams ¶ added in v1.2.0
type BetaFileUploadParams struct {
// The file to upload
File io.Reader `json:"file,omitzero" api:"required" format:"binary"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaFileUploadParams) MarshalMultipart ¶ added in v1.2.0
func (r BetaFileUploadParams) MarshalMultipart() (data []byte, contentType string, err error)
type BetaGatewayTimeoutError ¶
type BetaGatewayTimeoutError struct {
Message string `json:"message" api:"required"`
Type constant.TimeoutError `json:"type" default:"timeout_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaGatewayTimeoutError) RawJSON ¶
func (r BetaGatewayTimeoutError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaGatewayTimeoutError) UnmarshalJSON ¶
func (r *BetaGatewayTimeoutError) UnmarshalJSON(data []byte) error
type BetaImageBlockParam ¶
type BetaImageBlockParam struct {
Source BetaImageBlockParamSourceUnion `json:"source,omitzero" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "image".
Type constant.Image `json:"type" default:"image"`
// contains filtered or unexported fields
}
The properties Source, Type are required.
func (BetaImageBlockParam) MarshalJSON ¶
func (r BetaImageBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaImageBlockParam) UnmarshalJSON ¶
func (r *BetaImageBlockParam) UnmarshalJSON(data []byte) error
type BetaImageBlockParamSourceUnion ¶
type BetaImageBlockParamSourceUnion struct {
OfBase64 *BetaBase64ImageSourceParam `json:",omitzero,inline"`
OfURL *BetaURLImageSourceParam `json:",omitzero,inline"`
OfFile *BetaFileImageSourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaImageBlockParamSourceUnion) GetData ¶
func (u BetaImageBlockParamSourceUnion) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaImageBlockParamSourceUnion) GetFileID ¶ added in v1.2.0
func (u BetaImageBlockParamSourceUnion) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaImageBlockParamSourceUnion) GetMediaType ¶
func (u BetaImageBlockParamSourceUnion) GetMediaType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaImageBlockParamSourceUnion) GetType ¶
func (u BetaImageBlockParamSourceUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaImageBlockParamSourceUnion) GetURL ¶
func (u BetaImageBlockParamSourceUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaImageBlockParamSourceUnion) MarshalJSON ¶
func (u BetaImageBlockParamSourceUnion) MarshalJSON() ([]byte, error)
func (*BetaImageBlockParamSourceUnion) UnmarshalJSON ¶
func (u *BetaImageBlockParamSourceUnion) UnmarshalJSON(data []byte) error
type BetaInputJSONDelta ¶
type BetaInputJSONDelta struct {
PartialJSON string `json:"partial_json" api:"required"`
Type constant.InputJSONDelta `json:"type" default:"input_json_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PartialJSON respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaInputJSONDelta) RawJSON ¶
func (r BetaInputJSONDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaInputJSONDelta) UnmarshalJSON ¶
func (r *BetaInputJSONDelta) UnmarshalJSON(data []byte) error
type BetaInputTokensClearAtLeastParam ¶ added in v1.13.0
type BetaInputTokensClearAtLeastParam struct {
Value int64 `json:"value" api:"required"`
// This field can be elided, and will marshal its zero value as "input_tokens".
Type constant.InputTokens `json:"type" default:"input_tokens"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (BetaInputTokensClearAtLeastParam) MarshalJSON ¶ added in v1.13.0
func (r BetaInputTokensClearAtLeastParam) MarshalJSON() (data []byte, err error)
func (*BetaInputTokensClearAtLeastParam) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaInputTokensClearAtLeastParam) UnmarshalJSON(data []byte) error
type BetaInputTokensTriggerParam ¶ added in v1.13.0
type BetaInputTokensTriggerParam struct {
Value int64 `json:"value" api:"required"`
// This field can be elided, and will marshal its zero value as "input_tokens".
Type constant.InputTokens `json:"type" default:"input_tokens"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (BetaInputTokensTriggerParam) MarshalJSON ¶ added in v1.13.0
func (r BetaInputTokensTriggerParam) MarshalJSON() (data []byte, err error)
func (*BetaInputTokensTriggerParam) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaInputTokensTriggerParam) UnmarshalJSON(data []byte) error
type BetaInvalidRequestError ¶
type BetaInvalidRequestError struct {
Message string `json:"message" api:"required"`
Type constant.InvalidRequestError `json:"type" default:"invalid_request_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaInvalidRequestError) RawJSON ¶
func (r BetaInvalidRequestError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaInvalidRequestError) UnmarshalJSON ¶
func (r *BetaInvalidRequestError) UnmarshalJSON(data []byte) error
type BetaIterationsUsage ¶ added in v1.21.0
type BetaIterationsUsage []BetaIterationsUsageItemUnion
type BetaIterationsUsageItemUnion ¶ added in v1.21.0
type BetaIterationsUsageItemUnion struct {
// This field is from variant [BetaMessageIterationUsage].
CacheCreation BetaCacheCreation `json:"cache_creation"`
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens"`
CacheReadInputTokens int64 `json:"cache_read_input_tokens"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
// Any of "message", "compaction", "advisor_message".
Type string `json:"type"`
// This field is from variant [BetaAdvisorMessageIterationUsage].
Model Model `json:"model"`
JSON struct {
CacheCreation respjson.Field
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
Type respjson.Field
Model respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaIterationsUsageItemUnion contains all possible properties and values from BetaMessageIterationUsage, BetaCompactionIterationUsage, BetaAdvisorMessageIterationUsage.
Use the BetaIterationsUsageItemUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaIterationsUsageItemUnion) AsAdvisorMessage ¶ added in v1.34.0
func (u BetaIterationsUsageItemUnion) AsAdvisorMessage() (v BetaAdvisorMessageIterationUsage)
func (BetaIterationsUsageItemUnion) AsAny ¶ added in v1.27.0
func (u BetaIterationsUsageItemUnion) AsAny() anyBetaIterationsUsageItem
Use the following switch statement to find the correct variant
switch variant := BetaIterationsUsageItemUnion.AsAny().(type) {
case anthropic.BetaMessageIterationUsage:
case anthropic.BetaCompactionIterationUsage:
case anthropic.BetaAdvisorMessageIterationUsage:
default:
fmt.Errorf("no variant present")
}
func (BetaIterationsUsageItemUnion) AsCompaction ¶ added in v1.27.0
func (u BetaIterationsUsageItemUnion) AsCompaction() (v BetaCompactionIterationUsage)
func (BetaIterationsUsageItemUnion) AsMessage ¶ added in v1.27.0
func (u BetaIterationsUsageItemUnion) AsMessage() (v BetaMessageIterationUsage)
func (BetaIterationsUsageItemUnion) RawJSON ¶ added in v1.21.0
func (u BetaIterationsUsageItemUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaIterationsUsageItemUnion) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaIterationsUsageItemUnion) UnmarshalJSON(data []byte) error
type BetaJSONOutputFormatParam ¶ added in v1.18.0
type BetaJSONOutputFormatParam struct {
// The JSON schema of the format.
//
// This can be a map[string]any, json.RawMessage, or a pointer to a Go struct.
// When a struct pointer is provided, the SDK automatically generates the JSON
// schema on the wire and can auto-parse the response back into the struct.
// A struct pointer is preferred over map[string]any because it provides
// auto-parsing and type safety. If you already have a JSON schema as bytes,
// use json.RawMessage to avoid unnecessary marshaling overhead.
//
// Set the schema on either BetaMessageNewParams.OutputFormat or
// BetaMessageNewParams.OutputConfig.Format, not both. If both carry a struct
// pointer, OutputFormat wins for auto-parse.
Schema any `json:"schema,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as "json_schema".
Type constant.JSONSchema `json:"type" default:"json_schema"`
// contains filtered or unexported fields
}
BetaJSONOutputFormatParam configures JSON structured output for a message request. The preferred usage is to pass a pointer to a Go struct as Schema. The SDK will auto-generate the JSON schema on the wire and auto-parse the response back into the struct after the request completes:
var result MyStruct
msg, _ := client.Beta.Messages.New(ctx, anthropic.BetaMessageNewParams{
OutputFormat: anthropic.BetaJSONOutputFormatParam{Schema: &result},
...
})
For streaming, call ParseOutput after accumulating the message:
msg.ParseOutput(&result)
The properties Schema, Type are required.
func BetaJSONSchemaOutputFormat ¶ added in v1.18.0
func BetaJSONSchemaOutputFormat(jsonSchema map[string]any) BetaJSONOutputFormatParam
BetaJSONSchemaOutputFormat creates a BetaJSONOutputFormatParam from a JSON schema map. It transforms the schema to ensure compatibility with Anthropic's JSON schema requirements.
Example:
schema := map[string]any{
"type": "object",
"properties": map[string]any{
"name": map[string]any{"type": "string"},
"age": map[string]any{"type": "integer", "minimum": 0},
},
"required": []string{"name"},
}
outputFormat := BetaJSONSchemaOutputFormat(schema)
msg, _ := client.Beta.Messages.New(ctx, anthropic.BetaMessageNewParams{
Model: anthropic.Model("claude-sonnet-4-5"),
Messages: anthropic.F([]anthropic.BetaMessageParam{...}),
MaxTokens: 1024,
OutputFormat: outputFormat,
})
func (BetaJSONOutputFormatParam) MarshalJSON ¶ added in v1.18.0
func (r BetaJSONOutputFormatParam) MarshalJSON() (data []byte, err error)
func (*BetaJSONOutputFormatParam) UnmarshalJSON ¶ added in v1.18.0
func (r *BetaJSONOutputFormatParam) UnmarshalJSON(data []byte) error
type BetaLimitedNetwork ¶ added in v1.33.0
type BetaLimitedNetwork struct {
// Permits outbound access to MCP server endpoints configured on the agent, beyond
// those listed in the `allowed_hosts` array.
AllowMCPServers bool `json:"allow_mcp_servers" api:"required"`
// Permits outbound access to public package registries (PyPI, npm, etc.) beyond
// those listed in the `allowed_hosts` array.
AllowPackageManagers bool `json:"allow_package_managers" api:"required"`
// Specifies domains the container can reach.
AllowedHosts []string `json:"allowed_hosts" api:"required"`
// Network policy type
Type constant.Limited `json:"type" default:"limited"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AllowMCPServers respjson.Field
AllowPackageManagers respjson.Field
AllowedHosts respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Limited network access.
func (BetaLimitedNetwork) RawJSON ¶ added in v1.33.0
func (r BetaLimitedNetwork) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaLimitedNetwork) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaLimitedNetwork) UnmarshalJSON(data []byte) error
type BetaLimitedNetworkParams ¶ added in v1.33.0
type BetaLimitedNetworkParams struct {
// Permits outbound access to MCP server endpoints configured on the agent, beyond
// those listed in the `allowed_hosts` array. Defaults to `false`.
AllowMCPServers param.Opt[bool] `json:"allow_mcp_servers,omitzero"`
// Permits outbound access to public package registries (PyPI, npm, etc.) beyond
// those listed in the `allowed_hosts` array. Defaults to `false`.
AllowPackageManagers param.Opt[bool] `json:"allow_package_managers,omitzero"`
// Specifies domains the container can reach.
AllowedHosts []string `json:"allowed_hosts,omitzero"`
// Network policy type
//
// This field can be elided, and will marshal its zero value as "limited".
Type constant.Limited `json:"type" default:"limited"`
// contains filtered or unexported fields
}
Limited network request params.
Fields default to null; on update, omitted fields preserve the existing value.
The property Type is required.
func (BetaLimitedNetworkParams) MarshalJSON ¶ added in v1.33.0
func (r BetaLimitedNetworkParams) MarshalJSON() (data []byte, err error)
func (*BetaLimitedNetworkParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaLimitedNetworkParams) UnmarshalJSON(data []byte) error
type BetaMCPToolConfigParam ¶ added in v1.19.0
type BetaMCPToolConfigParam struct {
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// contains filtered or unexported fields
}
Configuration for a specific tool in an MCP toolset.
func (BetaMCPToolConfigParam) MarshalJSON ¶ added in v1.19.0
func (r BetaMCPToolConfigParam) MarshalJSON() (data []byte, err error)
func (*BetaMCPToolConfigParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaMCPToolConfigParam) UnmarshalJSON(data []byte) error
type BetaMCPToolDefaultConfigParam ¶ added in v1.19.0
type BetaMCPToolDefaultConfigParam struct {
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// contains filtered or unexported fields
}
Default configuration for tools in an MCP toolset.
func (BetaMCPToolDefaultConfigParam) MarshalJSON ¶ added in v1.19.0
func (r BetaMCPToolDefaultConfigParam) MarshalJSON() (data []byte, err error)
func (*BetaMCPToolDefaultConfigParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaMCPToolDefaultConfigParam) UnmarshalJSON(data []byte) error
type BetaMCPToolResultBlock ¶ added in v1.2.0
type BetaMCPToolResultBlock struct {
Content BetaMCPToolResultBlockContentUnion `json:"content" api:"required"`
IsError bool `json:"is_error" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.MCPToolResult `json:"type" default:"mcp_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
IsError respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMCPToolResultBlock) RawJSON ¶ added in v1.2.0
func (r BetaMCPToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaMCPToolResultBlock) ToParam ¶ added in v1.20.0
func (r BetaMCPToolResultBlock) ToParam() BetaRequestMCPToolResultBlockParam
func (*BetaMCPToolResultBlock) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaMCPToolResultBlock) UnmarshalJSON(data []byte) error
type BetaMCPToolResultBlockContentUnion ¶ added in v1.2.0
type BetaMCPToolResultBlockContentUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]BetaTextBlock] instead of an
// object.
OfBetaMCPToolResultBlockContent []BetaTextBlock `json:",inline"`
JSON struct {
OfString respjson.Field
OfBetaMCPToolResultBlockContent respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaMCPToolResultBlockContentUnion contains all possible properties and values from [string], [[]BetaTextBlock].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfBetaMCPToolResultBlockContent]
func (BetaMCPToolResultBlockContentUnion) AsBetaMCPToolResultBlockContent ¶ added in v1.2.0
func (u BetaMCPToolResultBlockContentUnion) AsBetaMCPToolResultBlockContent() (v []BetaTextBlock)
func (BetaMCPToolResultBlockContentUnion) AsString ¶ added in v1.2.0
func (u BetaMCPToolResultBlockContentUnion) AsString() (v string)
func (BetaMCPToolResultBlockContentUnion) RawJSON ¶ added in v1.2.0
func (u BetaMCPToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMCPToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaMCPToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaMCPToolUseBlock ¶ added in v1.2.0
type BetaMCPToolUseBlock struct {
ID string `json:"id" api:"required"`
Input any `json:"input" api:"required"`
// The name of the MCP tool
Name string `json:"name" api:"required"`
// The name of the MCP server
ServerName string `json:"server_name" api:"required"`
Type constant.MCPToolUse `json:"type" default:"mcp_tool_use"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Input respjson.Field
Name respjson.Field
ServerName respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMCPToolUseBlock) RawJSON ¶ added in v1.2.0
func (r BetaMCPToolUseBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaMCPToolUseBlock) ToParam ¶ added in v1.20.0
func (r BetaMCPToolUseBlock) ToParam() BetaMCPToolUseBlockParam
func (*BetaMCPToolUseBlock) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaMCPToolUseBlock) UnmarshalJSON(data []byte) error
type BetaMCPToolUseBlockParam ¶ added in v1.2.0
type BetaMCPToolUseBlockParam struct {
ID string `json:"id" api:"required"`
Input any `json:"input,omitzero" api:"required"`
Name string `json:"name" api:"required"`
// The name of the MCP server
ServerName string `json:"server_name" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "mcp_tool_use".
Type constant.MCPToolUse `json:"type" default:"mcp_tool_use"`
// contains filtered or unexported fields
}
The properties ID, Input, Name, ServerName, Type are required.
func (BetaMCPToolUseBlockParam) MarshalJSON ¶ added in v1.2.0
func (r BetaMCPToolUseBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaMCPToolUseBlockParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaMCPToolUseBlockParam) UnmarshalJSON(data []byte) error
type BetaMCPToolsetParam ¶ added in v1.19.0
type BetaMCPToolsetParam struct {
// Name of the MCP server to configure tools for
MCPServerName string `json:"mcp_server_name" api:"required"`
// Configuration overrides for specific tools, keyed by tool name
Configs map[string]BetaMCPToolConfigParam `json:"configs,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Default configuration applied to all tools from this server
DefaultConfig BetaMCPToolDefaultConfigParam `json:"default_config,omitzero"`
// This field can be elided, and will marshal its zero value as "mcp_toolset".
Type constant.MCPToolset `json:"type" default:"mcp_toolset"`
// contains filtered or unexported fields
}
Configuration for a group of tools from an MCP server.
Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
The properties MCPServerName, Type are required.
func (BetaMCPToolsetParam) MarshalJSON ¶ added in v1.19.0
func (r BetaMCPToolsetParam) MarshalJSON() (data []byte, err error)
func (*BetaMCPToolsetParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaMCPToolsetParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAPIActor ¶ added in v1.38.0
type BetaManagedAgentsAPIActor struct {
APIKeyID string `json:"api_key_id" api:"required"`
// Any of "api_actor".
Type BetaManagedAgentsAPIActorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
APIKeyID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsAPIActor) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsAPIActor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAPIActor) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsAPIActor) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAPIActorType ¶ added in v1.38.0
type BetaManagedAgentsAPIActorType string
const (
BetaManagedAgentsAPIActorTypeAPIActor BetaManagedAgentsAPIActorType = "api_actor"
)
type BetaManagedAgentsActorUnion ¶ added in v1.38.0
type BetaManagedAgentsActorUnion struct {
// This field is from variant [BetaManagedAgentsSessionActor].
SessionID string `json:"session_id"`
// Any of "session_actor", "api_actor", "user_actor".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsAPIActor].
APIKeyID string `json:"api_key_id"`
// This field is from variant [BetaManagedAgentsUserActor].
UserID string `json:"user_id"`
JSON struct {
SessionID respjson.Field
Type respjson.Field
APIKeyID respjson.Field
UserID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsActorUnion contains all possible properties and values from BetaManagedAgentsSessionActor, BetaManagedAgentsAPIActor, BetaManagedAgentsUserActor.
Use the BetaManagedAgentsActorUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsActorUnion) AsAPIActor ¶ added in v1.38.0
func (u BetaManagedAgentsActorUnion) AsAPIActor() (v BetaManagedAgentsAPIActor)
func (BetaManagedAgentsActorUnion) AsAny ¶ added in v1.38.0
func (u BetaManagedAgentsActorUnion) AsAny() anyBetaManagedAgentsActor
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsActorUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsSessionActor:
case anthropic.BetaManagedAgentsAPIActor:
case anthropic.BetaManagedAgentsUserActor:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsActorUnion) AsSessionActor ¶ added in v1.38.0
func (u BetaManagedAgentsActorUnion) AsSessionActor() (v BetaManagedAgentsSessionActor)
func (BetaManagedAgentsActorUnion) AsUserActor ¶ added in v1.38.0
func (u BetaManagedAgentsActorUnion) AsUserActor() (v BetaManagedAgentsUserActor)
func (BetaManagedAgentsActorUnion) RawJSON ¶ added in v1.38.0
func (u BetaManagedAgentsActorUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsActorUnion) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsActorUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgent ¶ added in v1.33.0
type BetaManagedAgentsAgent struct {
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
Description string `json:"description" api:"required"`
MCPServers []BetaManagedAgentsMCPServerURLDefinition `json:"mcp_servers" api:"required"`
Metadata map[string]string `json:"metadata" api:"required"`
// Model identifier and configuration.
Model BetaManagedAgentsModelConfig `json:"model" api:"required"`
Name string `json:"name" api:"required"`
Skills []BetaManagedAgentsAgentSkillUnion `json:"skills" api:"required"`
System string `json:"system" api:"required"`
Tools []BetaManagedAgentsAgentToolUnion `json:"tools" api:"required"`
// Any of "agent".
Type BetaManagedAgentsAgentType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// The agent's current version. Starts at 1 and increments when the agent is
// modified.
Version int64 `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ArchivedAt respjson.Field
CreatedAt respjson.Field
Description respjson.Field
MCPServers respjson.Field
Metadata respjson.Field
Model respjson.Field
Name respjson.Field
Skills respjson.Field
System respjson.Field
Tools respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A Managed Agents `agent`.
func (BetaManagedAgentsAgent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentCustomToolUseEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentCustomToolUseEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Input parameters for the tool call.
Input map[string]any `json:"input" api:"required"`
// Name of the custom tool being called.
Name string `json:"name" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.custom_tool_use".
Type BetaManagedAgentsAgentCustomToolUseEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Input respjson.Field
Name respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.
func (BetaManagedAgentsAgentCustomToolUseEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentCustomToolUseEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentCustomToolUseEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentCustomToolUseEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentCustomToolUseEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentCustomToolUseEventType string
const (
BetaManagedAgentsAgentCustomToolUseEventTypeAgentCustomToolUse BetaManagedAgentsAgentCustomToolUseEventType = "agent.custom_tool_use"
)
type BetaManagedAgentsAgentMCPToolResultEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolResultEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// The id of the `agent.mcp_tool_use` event this result corresponds to.
MCPToolUseID string `json:"mcp_tool_use_id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.mcp_tool_result".
Type BetaManagedAgentsAgentMCPToolResultEventType `json:"type" api:"required"`
// The result content returned by the tool.
Content []BetaManagedAgentsAgentMCPToolResultEventContentUnion `json:"content"`
// Whether the tool execution resulted in an error.
IsError bool `json:"is_error" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
MCPToolUseID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
Content respjson.Field
IsError respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Event representing the result of an MCP tool execution.
func (BetaManagedAgentsAgentMCPToolResultEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentMCPToolResultEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentMCPToolResultEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentMCPToolResultEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentMCPToolResultEventContentUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolResultEventContentUnion struct {
// This field is from variant [BetaManagedAgentsTextBlock].
Text string `json:"text"`
// Any of "text", "image", "document".
Type string `json:"type"`
// This field is a union of [BetaManagedAgentsImageBlockSourceUnion],
// [BetaManagedAgentsDocumentBlockSourceUnion]
Source BetaManagedAgentsAgentMCPToolResultEventContentUnionSource `json:"source"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Context string `json:"context"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Title string `json:"title"`
JSON struct {
Text respjson.Field
Type respjson.Field
Source respjson.Field
Context respjson.Field
Title respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentMCPToolResultEventContentUnion contains all possible properties and values from BetaManagedAgentsTextBlock, BetaManagedAgentsImageBlock, BetaManagedAgentsDocumentBlock.
Use the BetaManagedAgentsAgentMCPToolResultEventContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsAny() anyBetaManagedAgentsAgentMCPToolResultEventContent
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsAgentMCPToolResultEventContentUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsTextBlock:
case anthropic.BetaManagedAgentsImageBlock:
case anthropic.BetaManagedAgentsDocumentBlock:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsDocument ¶ added in v1.33.0
func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
func (BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsImage ¶ added in v1.33.0
func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
func (BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsText ¶ added in v1.33.0
func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
func (BetaManagedAgentsAgentMCPToolResultEventContentUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentMCPToolResultEventContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentMCPToolResultEventContentUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentMCPToolResultEventContentUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentMCPToolResultEventContentUnionSource ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolResultEventContentUnionSource struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
Type string `json:"type"`
URL string `json:"url"`
FileID string `json:"file_id"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
URL respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentMCPToolResultEventContentUnionSource is an implicit subunion of BetaManagedAgentsAgentMCPToolResultEventContentUnion. BetaManagedAgentsAgentMCPToolResultEventContentUnionSource provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsAgentMCPToolResultEventContentUnion.
func (*BetaManagedAgentsAgentMCPToolResultEventContentUnionSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentMCPToolResultEventContentUnionSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentMCPToolResultEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolResultEventType string
const (
BetaManagedAgentsAgentMCPToolResultEventTypeAgentMCPToolResult BetaManagedAgentsAgentMCPToolResultEventType = "agent.mcp_tool_result"
)
type BetaManagedAgentsAgentMCPToolUseEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolUseEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Input parameters for the tool call.
Input map[string]any `json:"input" api:"required"`
// Name of the MCP server providing the tool.
MCPServerName string `json:"mcp_server_name" api:"required"`
// Name of the MCP tool being used.
Name string `json:"name" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.mcp_tool_use".
Type BetaManagedAgentsAgentMCPToolUseEventType `json:"type" api:"required"`
// AgentEvaluatedPermission enum
//
// Any of "allow", "ask", "deny".
EvaluatedPermission BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission `json:"evaluated_permission"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Input respjson.Field
MCPServerName respjson.Field
Name respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
EvaluatedPermission respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Event emitted when the agent invokes a tool provided by an MCP server.
func (BetaManagedAgentsAgentMCPToolUseEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentMCPToolUseEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentMCPToolUseEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentMCPToolUseEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission string
AgentEvaluatedPermission enum
const ( BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "allow" BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "ask" BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentMCPToolUseEventEvaluatedPermission = "deny" )
type BetaManagedAgentsAgentMCPToolUseEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentMCPToolUseEventType string
const (
BetaManagedAgentsAgentMCPToolUseEventTypeAgentMCPToolUse BetaManagedAgentsAgentMCPToolUseEventType = "agent.mcp_tool_use"
)
type BetaManagedAgentsAgentMessageEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentMessageEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Array of text blocks comprising the agent response.
Content []BetaManagedAgentsTextBlock `json:"content" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.message".
Type BetaManagedAgentsAgentMessageEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Content respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An agent response event in the session conversation.
func (BetaManagedAgentsAgentMessageEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentMessageEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentMessageEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentMessageEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentMessageEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentMessageEventType string
const (
BetaManagedAgentsAgentMessageEventTypeAgentMessage BetaManagedAgentsAgentMessageEventType = "agent.message"
)
type BetaManagedAgentsAgentParams ¶ added in v1.33.0
type BetaManagedAgentsAgentParams struct {
// The `agent` ID.
ID string `json:"id" api:"required"`
// Any of "agent".
Type BetaManagedAgentsAgentParamsType `json:"type,omitzero" api:"required"`
// The specific `agent` version to use. Omit to use the latest version. Must be at
// least 1 if specified.
Version param.Opt[int64] `json:"version,omitzero"`
// contains filtered or unexported fields
}
Specification for an Agent. Provide a specific `version` or use the short-form `agent="agent_id"` for the most recent version
The properties ID, Type are required.
func (BetaManagedAgentsAgentParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAgentParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentParamsType ¶ added in v1.33.0
type BetaManagedAgentsAgentParamsType string
const (
BetaManagedAgentsAgentParamsTypeAgent BetaManagedAgentsAgentParamsType = "agent"
)
type BetaManagedAgentsAgentSkillUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentSkillUnion struct {
SkillID string `json:"skill_id"`
// Any of "anthropic", "custom".
Type string `json:"type"`
Version string `json:"version"`
JSON struct {
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentSkillUnion contains all possible properties and values from BetaManagedAgentsAnthropicSkill, BetaManagedAgentsCustomSkill.
Use the BetaManagedAgentsAgentSkillUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsAgentSkillUnion) AsAnthropic ¶ added in v1.33.0
func (u BetaManagedAgentsAgentSkillUnion) AsAnthropic() (v BetaManagedAgentsAnthropicSkill)
func (BetaManagedAgentsAgentSkillUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsAgentSkillUnion) AsAny() anyBetaManagedAgentsAgentSkill
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsAgentSkillUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAnthropicSkill:
case anthropic.BetaManagedAgentsCustomSkill:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsAgentSkillUnion) AsCustom ¶ added in v1.33.0
func (u BetaManagedAgentsAgentSkillUnion) AsCustom() (v BetaManagedAgentsCustomSkill)
func (BetaManagedAgentsAgentSkillUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentSkillUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentSkillUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentSkillUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentThinkingEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentThinkingEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.thinking".
Type BetaManagedAgentsAgentThinkingEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.
func (BetaManagedAgentsAgentThinkingEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentThinkingEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentThinkingEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentThinkingEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentThinkingEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentThinkingEventType string
const (
BetaManagedAgentsAgentThinkingEventTypeAgentThinking BetaManagedAgentsAgentThinkingEventType = "agent.thinking"
)
type BetaManagedAgentsAgentThreadContextCompactedEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentThreadContextCompactedEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.thread_context_compacted".
Type BetaManagedAgentsAgentThreadContextCompactedEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates that context compaction (summarization) occurred during the session.
func (BetaManagedAgentsAgentThreadContextCompactedEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentThreadContextCompactedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentThreadContextCompactedEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentThreadContextCompactedEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentThreadContextCompactedEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentThreadContextCompactedEventType string
const (
BetaManagedAgentsAgentThreadContextCompactedEventTypeAgentThreadContextCompacted BetaManagedAgentsAgentThreadContextCompactedEventType = "agent.thread_context_compacted"
)
type BetaManagedAgentsAgentToolConfig ¶ added in v1.33.0
type BetaManagedAgentsAgentToolConfig struct {
Enabled bool `json:"enabled" api:"required"`
// Built-in agent tool identifier.
//
// Any of "bash", "edit", "read", "write", "glob", "grep", "web_fetch",
// "web_search".
Name BetaManagedAgentsAgentToolConfigName `json:"name" api:"required"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsAgentToolConfigPermissionPolicyUnion `json:"permission_policy" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Name respjson.Field
PermissionPolicy respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Configuration for a specific agent tool.
func (BetaManagedAgentsAgentToolConfig) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolConfigName ¶ added in v1.33.0
type BetaManagedAgentsAgentToolConfigName string
Built-in agent tool identifier.
const ( BetaManagedAgentsAgentToolConfigNameBash BetaManagedAgentsAgentToolConfigName = "bash" BetaManagedAgentsAgentToolConfigNameEdit BetaManagedAgentsAgentToolConfigName = "edit" BetaManagedAgentsAgentToolConfigNameRead BetaManagedAgentsAgentToolConfigName = "read" BetaManagedAgentsAgentToolConfigNameWrite BetaManagedAgentsAgentToolConfigName = "write" BetaManagedAgentsAgentToolConfigNameGlob BetaManagedAgentsAgentToolConfigName = "glob" BetaManagedAgentsAgentToolConfigNameGrep BetaManagedAgentsAgentToolConfigName = "grep" BetaManagedAgentsAgentToolConfigNameWebFetch BetaManagedAgentsAgentToolConfigName = "web_fetch" BetaManagedAgentsAgentToolConfigNameWebSearch BetaManagedAgentsAgentToolConfigName = "web_search" )
type BetaManagedAgentsAgentToolConfigParams ¶ added in v1.33.0
type BetaManagedAgentsAgentToolConfigParams struct {
// Built-in agent tool identifier.
//
// Any of "bash", "edit", "read", "write", "glob", "grep", "web_fetch",
// "web_search".
Name BetaManagedAgentsAgentToolConfigParamsName `json:"name,omitzero" api:"required"`
// Whether this tool is enabled and available to Claude. Overrides the
// default_config setting.
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion `json:"permission_policy,omitzero"`
// contains filtered or unexported fields
}
Configuration override for a specific tool within a toolset.
The property Name is required.
func (BetaManagedAgentsAgentToolConfigParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolConfigParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAgentToolConfigParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolConfigParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolConfigParamsName ¶ added in v1.33.0
type BetaManagedAgentsAgentToolConfigParamsName string
Built-in agent tool identifier.
const ( BetaManagedAgentsAgentToolConfigParamsNameBash BetaManagedAgentsAgentToolConfigParamsName = "bash" BetaManagedAgentsAgentToolConfigParamsNameEdit BetaManagedAgentsAgentToolConfigParamsName = "edit" BetaManagedAgentsAgentToolConfigParamsNameRead BetaManagedAgentsAgentToolConfigParamsName = "read" BetaManagedAgentsAgentToolConfigParamsNameWrite BetaManagedAgentsAgentToolConfigParamsName = "write" BetaManagedAgentsAgentToolConfigParamsNameGlob BetaManagedAgentsAgentToolConfigParamsName = "glob" BetaManagedAgentsAgentToolConfigParamsNameGrep BetaManagedAgentsAgentToolConfigParamsName = "grep" BetaManagedAgentsAgentToolConfigParamsNameWebFetch BetaManagedAgentsAgentToolConfigParamsName = "web_fetch" BetaManagedAgentsAgentToolConfigParamsNameWebSearch BetaManagedAgentsAgentToolConfigParamsName = "web_search" )
type BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion struct {
OfAlwaysAllow *BetaManagedAgentsAlwaysAllowPolicyParam `json:",omitzero,inline"`
OfAlwaysAsk *BetaManagedAgentsAlwaysAskPolicyParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsAgentToolConfigParamsPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolConfigPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentToolConfigPermissionPolicyUnion struct {
// Any of "always_allow", "always_ask".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolConfigPermissionPolicyUnion contains all possible properties and values from BetaManagedAgentsAlwaysAllowPolicy, BetaManagedAgentsAlwaysAskPolicy.
Use the BetaManagedAgentsAgentToolConfigPermissionPolicyUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAlwaysAllow ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
func (BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAlwaysAsk ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
func (BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsAgentToolConfigPermissionPolicy
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsAgentToolConfigPermissionPolicyUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAlwaysAllowPolicy:
case anthropic.BetaManagedAgentsAlwaysAskPolicy:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolResultEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentToolResultEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// The id of the `agent.tool_use` event this result corresponds to.
ToolUseID string `json:"tool_use_id" api:"required"`
// Any of "agent.tool_result".
Type BetaManagedAgentsAgentToolResultEventType `json:"type" api:"required"`
// The result content returned by the tool.
Content []BetaManagedAgentsAgentToolResultEventContentUnion `json:"content"`
// Whether the tool execution resulted in an error.
IsError bool `json:"is_error" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
ToolUseID respjson.Field
Type respjson.Field
Content respjson.Field
IsError respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Event representing the result of an agent tool execution.
func (BetaManagedAgentsAgentToolResultEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolResultEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolResultEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolResultEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolResultEventContentUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentToolResultEventContentUnion struct {
// This field is from variant [BetaManagedAgentsTextBlock].
Text string `json:"text"`
// Any of "text", "image", "document".
Type string `json:"type"`
// This field is a union of [BetaManagedAgentsImageBlockSourceUnion],
// [BetaManagedAgentsDocumentBlockSourceUnion]
Source BetaManagedAgentsAgentToolResultEventContentUnionSource `json:"source"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Context string `json:"context"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Title string `json:"title"`
JSON struct {
Text respjson.Field
Type respjson.Field
Source respjson.Field
Context respjson.Field
Title respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolResultEventContentUnion contains all possible properties and values from BetaManagedAgentsTextBlock, BetaManagedAgentsImageBlock, BetaManagedAgentsDocumentBlock.
Use the BetaManagedAgentsAgentToolResultEventContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsAgentToolResultEventContentUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsAny() anyBetaManagedAgentsAgentToolResultEventContent
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsAgentToolResultEventContentUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsTextBlock:
case anthropic.BetaManagedAgentsImageBlock:
case anthropic.BetaManagedAgentsDocumentBlock:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsAgentToolResultEventContentUnion) AsDocument ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
func (BetaManagedAgentsAgentToolResultEventContentUnion) AsImage ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
func (BetaManagedAgentsAgentToolResultEventContentUnion) AsText ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolResultEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
func (BetaManagedAgentsAgentToolResultEventContentUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolResultEventContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolResultEventContentUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolResultEventContentUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolResultEventContentUnionSource ¶ added in v1.33.0
type BetaManagedAgentsAgentToolResultEventContentUnionSource struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
Type string `json:"type"`
URL string `json:"url"`
FileID string `json:"file_id"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
URL respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolResultEventContentUnionSource is an implicit subunion of BetaManagedAgentsAgentToolResultEventContentUnion. BetaManagedAgentsAgentToolResultEventContentUnionSource provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsAgentToolResultEventContentUnion.
func (*BetaManagedAgentsAgentToolResultEventContentUnionSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolResultEventContentUnionSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolResultEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentToolResultEventType string
const (
BetaManagedAgentsAgentToolResultEventTypeAgentToolResult BetaManagedAgentsAgentToolResultEventType = "agent.tool_result"
)
type BetaManagedAgentsAgentToolUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUnion struct {
// This field is a union of [[]BetaManagedAgentsAgentToolConfig],
// [[]BetaManagedAgentsMCPToolConfig]
Configs BetaManagedAgentsAgentToolUnionConfigs `json:"configs"`
// This field is a union of [BetaManagedAgentsAgentToolsetDefaultConfig],
// [BetaManagedAgentsMCPToolsetDefaultConfig]
DefaultConfig BetaManagedAgentsAgentToolUnionDefaultConfig `json:"default_config"`
// Any of "agent_toolset_20260401", "mcp_toolset", "custom".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsMCPToolset].
MCPServerName string `json:"mcp_server_name"`
// This field is from variant [BetaManagedAgentsCustomTool].
Description string `json:"description"`
// This field is from variant [BetaManagedAgentsCustomTool].
InputSchema BetaManagedAgentsCustomToolInputSchema `json:"input_schema"`
// This field is from variant [BetaManagedAgentsCustomTool].
Name string `json:"name"`
JSON struct {
Configs respjson.Field
DefaultConfig respjson.Field
Type respjson.Field
MCPServerName respjson.Field
Description respjson.Field
InputSchema respjson.Field
Name respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolUnion contains all possible properties and values from BetaManagedAgentsAgentToolset20260401, BetaManagedAgentsMCPToolset, BetaManagedAgentsCustomTool.
Use the BetaManagedAgentsAgentToolUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsAgentToolUnion) AsAgentToolset20260401 ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolUnion) AsAgentToolset20260401() (v BetaManagedAgentsAgentToolset20260401)
func (BetaManagedAgentsAgentToolUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolUnion) AsAny() anyBetaManagedAgentsAgentTool
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsAgentToolUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAgentToolset20260401:
case anthropic.BetaManagedAgentsMCPToolset:
case anthropic.BetaManagedAgentsCustomTool:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsAgentToolUnion) AsCustom ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolUnion) AsCustom() (v BetaManagedAgentsCustomTool)
func (BetaManagedAgentsAgentToolUnion) AsMCPToolset ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolUnion) AsMCPToolset() (v BetaManagedAgentsMCPToolset)
func (BetaManagedAgentsAgentToolUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolUnionConfigs ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUnionConfigs struct {
// This field will be present if the value is a
// [[]BetaManagedAgentsAgentToolConfig] instead of an object.
OfBetaManagedAgentsAgentToolConfigArray []BetaManagedAgentsAgentToolConfig `json:",inline"`
// This field will be present if the value is a [[]BetaManagedAgentsMCPToolConfig]
// instead of an object.
OfBetaManagedAgentsMCPToolConfigArray []BetaManagedAgentsMCPToolConfig `json:",inline"`
JSON struct {
OfBetaManagedAgentsAgentToolConfigArray respjson.Field
OfBetaManagedAgentsMCPToolConfigArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolUnionConfigs is an implicit subunion of BetaManagedAgentsAgentToolUnion. BetaManagedAgentsAgentToolUnionConfigs provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsAgentToolUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaManagedAgentsAgentToolConfigArray OfBetaManagedAgentsMCPToolConfigArray]
func (*BetaManagedAgentsAgentToolUnionConfigs) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolUnionConfigs) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolUnionDefaultConfig ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUnionDefaultConfig struct {
Enabled bool `json:"enabled"`
// This field is a union of
// [BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion],
// [BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion]
PermissionPolicy BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy `json:"permission_policy"`
JSON struct {
Enabled respjson.Field
PermissionPolicy respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolUnionDefaultConfig is an implicit subunion of BetaManagedAgentsAgentToolUnion. BetaManagedAgentsAgentToolUnionDefaultConfig provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsAgentToolUnion.
func (*BetaManagedAgentsAgentToolUnionDefaultConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolUnionDefaultConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy struct {
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy is an implicit subunion of BetaManagedAgentsAgentToolUnion. BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsAgentToolUnion.
func (*BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolUnionDefaultConfigPermissionPolicy) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolUseEvent ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUseEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Input parameters for the tool call.
Input map[string]any `json:"input" api:"required"`
// Name of the agent tool being used.
Name string `json:"name" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "agent.tool_use".
Type BetaManagedAgentsAgentToolUseEventType `json:"type" api:"required"`
// AgentEvaluatedPermission enum
//
// Any of "allow", "ask", "deny".
EvaluatedPermission BetaManagedAgentsAgentToolUseEventEvaluatedPermission `json:"evaluated_permission"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Input respjson.Field
Name respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
EvaluatedPermission respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Event emitted when the agent invokes a built-in agent tool.
func (BetaManagedAgentsAgentToolUseEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolUseEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolUseEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolUseEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolUseEventEvaluatedPermission ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUseEventEvaluatedPermission string
AgentEvaluatedPermission enum
const ( BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAllow BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "allow" BetaManagedAgentsAgentToolUseEventEvaluatedPermissionAsk BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "ask" BetaManagedAgentsAgentToolUseEventEvaluatedPermissionDeny BetaManagedAgentsAgentToolUseEventEvaluatedPermission = "deny" )
type BetaManagedAgentsAgentToolUseEventType ¶ added in v1.33.0
type BetaManagedAgentsAgentToolUseEventType string
const (
BetaManagedAgentsAgentToolUseEventTypeAgentToolUse BetaManagedAgentsAgentToolUseEventType = "agent.tool_use"
)
type BetaManagedAgentsAgentToolset20260401 ¶ added in v1.33.0
type BetaManagedAgentsAgentToolset20260401 struct {
Configs []BetaManagedAgentsAgentToolConfig `json:"configs" api:"required"`
// Resolved default configuration for agent tools.
DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfig `json:"default_config" api:"required"`
// Any of "agent_toolset_20260401".
Type BetaManagedAgentsAgentToolset20260401Type `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Configs respjson.Field
DefaultConfig respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsAgentToolset20260401) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolset20260401) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolset20260401) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolset20260401) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolset20260401Params ¶ added in v1.33.0
type BetaManagedAgentsAgentToolset20260401Params struct {
// Any of "agent_toolset_20260401".
Type BetaManagedAgentsAgentToolset20260401ParamsType `json:"type,omitzero" api:"required"`
// Per-tool configuration overrides.
Configs []BetaManagedAgentsAgentToolConfigParams `json:"configs,omitzero"`
// Default configuration for all tools in a toolset.
DefaultConfig BetaManagedAgentsAgentToolsetDefaultConfigParams `json:"default_config,omitzero"`
// contains filtered or unexported fields
}
Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.
The property Type is required.
func (BetaManagedAgentsAgentToolset20260401Params) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolset20260401Params) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAgentToolset20260401Params) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolset20260401Params) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolset20260401ParamsType ¶ added in v1.33.0
type BetaManagedAgentsAgentToolset20260401ParamsType string
const (
BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401ParamsType = "agent_toolset_20260401"
)
type BetaManagedAgentsAgentToolset20260401Type ¶ added in v1.33.0
type BetaManagedAgentsAgentToolset20260401Type string
const (
BetaManagedAgentsAgentToolset20260401TypeAgentToolset20260401 BetaManagedAgentsAgentToolset20260401Type = "agent_toolset_20260401"
)
type BetaManagedAgentsAgentToolsetDefaultConfig ¶ added in v1.33.0
type BetaManagedAgentsAgentToolsetDefaultConfig struct {
Enabled bool `json:"enabled" api:"required"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion `json:"permission_policy" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
PermissionPolicy respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolved default configuration for agent tools.
func (BetaManagedAgentsAgentToolsetDefaultConfig) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolsetDefaultConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolsetDefaultConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolsetDefaultConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolsetDefaultConfigParams ¶ added in v1.33.0
type BetaManagedAgentsAgentToolsetDefaultConfigParams struct {
// Whether tools are enabled and available to Claude by default. Defaults to true
// if not specified.
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion `json:"permission_policy,omitzero"`
// contains filtered or unexported fields
}
Default configuration for all tools in a toolset.
func (BetaManagedAgentsAgentToolsetDefaultConfigParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAgentToolsetDefaultConfigParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAgentToolsetDefaultConfigParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolsetDefaultConfigParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion struct {
OfAlwaysAllow *BetaManagedAgentsAlwaysAllowPolicyParam `json:",omitzero,inline"`
OfAlwaysAsk *BetaManagedAgentsAlwaysAskPolicyParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsAgentToolsetDefaultConfigParamsPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion struct {
// Any of "always_allow", "always_ask".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion contains all possible properties and values from BetaManagedAgentsAlwaysAllowPolicy, BetaManagedAgentsAlwaysAskPolicy.
Use the BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAllow ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
func (BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAsk ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
func (BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicy
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAlwaysAllowPolicy:
case anthropic.BetaManagedAgentsAlwaysAskPolicy:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAgentType ¶ added in v1.33.0
type BetaManagedAgentsAgentType string
const (
BetaManagedAgentsAgentTypeAgent BetaManagedAgentsAgentType = "agent"
)
type BetaManagedAgentsAlwaysAllowPolicy ¶ added in v1.33.0
type BetaManagedAgentsAlwaysAllowPolicy struct {
// Any of "always_allow".
Type BetaManagedAgentsAlwaysAllowPolicyType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Tool calls are automatically approved without user confirmation.
func (BetaManagedAgentsAlwaysAllowPolicy) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAlwaysAllowPolicy) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsAlwaysAllowPolicy) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsAlwaysAllowPolicy) ToParam() BetaManagedAgentsAlwaysAllowPolicyParam
ToParam converts this BetaManagedAgentsAlwaysAllowPolicy to a BetaManagedAgentsAlwaysAllowPolicyParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsAlwaysAllowPolicyParam.Overrides()
func (*BetaManagedAgentsAlwaysAllowPolicy) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAlwaysAllowPolicy) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAlwaysAllowPolicyParam ¶ added in v1.33.0
type BetaManagedAgentsAlwaysAllowPolicyParam struct {
// Any of "always_allow".
Type BetaManagedAgentsAlwaysAllowPolicyType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Tool calls are automatically approved without user confirmation.
The property Type is required.
func (BetaManagedAgentsAlwaysAllowPolicyParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAlwaysAllowPolicyParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAlwaysAllowPolicyParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAlwaysAllowPolicyParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAlwaysAllowPolicyType ¶ added in v1.33.0
type BetaManagedAgentsAlwaysAllowPolicyType string
const (
BetaManagedAgentsAlwaysAllowPolicyTypeAlwaysAllow BetaManagedAgentsAlwaysAllowPolicyType = "always_allow"
)
type BetaManagedAgentsAlwaysAskPolicy ¶ added in v1.33.0
type BetaManagedAgentsAlwaysAskPolicy struct {
// Any of "always_ask".
Type BetaManagedAgentsAlwaysAskPolicyType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Tool calls require user confirmation before execution.
func (BetaManagedAgentsAlwaysAskPolicy) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAlwaysAskPolicy) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsAlwaysAskPolicy) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsAlwaysAskPolicy) ToParam() BetaManagedAgentsAlwaysAskPolicyParam
ToParam converts this BetaManagedAgentsAlwaysAskPolicy to a BetaManagedAgentsAlwaysAskPolicyParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsAlwaysAskPolicyParam.Overrides()
func (*BetaManagedAgentsAlwaysAskPolicy) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAlwaysAskPolicy) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAlwaysAskPolicyParam ¶ added in v1.33.0
type BetaManagedAgentsAlwaysAskPolicyParam struct {
// Any of "always_ask".
Type BetaManagedAgentsAlwaysAskPolicyType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Tool calls require user confirmation before execution.
The property Type is required.
func (BetaManagedAgentsAlwaysAskPolicyParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAlwaysAskPolicyParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAlwaysAskPolicyParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAlwaysAskPolicyParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAlwaysAskPolicyType ¶ added in v1.33.0
type BetaManagedAgentsAlwaysAskPolicyType string
const (
BetaManagedAgentsAlwaysAskPolicyTypeAlwaysAsk BetaManagedAgentsAlwaysAskPolicyType = "always_ask"
)
type BetaManagedAgentsAnthropicSkill ¶ added in v1.33.0
type BetaManagedAgentsAnthropicSkill struct {
SkillID string `json:"skill_id" api:"required"`
// Any of "anthropic".
Type BetaManagedAgentsAnthropicSkillType `json:"type" api:"required"`
Version string `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A resolved Anthropic-managed skill.
func (BetaManagedAgentsAnthropicSkill) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAnthropicSkill) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsAnthropicSkill) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAnthropicSkill) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAnthropicSkillParams ¶ added in v1.33.0
type BetaManagedAgentsAnthropicSkillParams struct {
// Identifier of the Anthropic skill (e.g., "xlsx").
SkillID string `json:"skill_id" api:"required"`
// Any of "anthropic".
Type BetaManagedAgentsAnthropicSkillParamsType `json:"type,omitzero" api:"required"`
// Version to pin. Defaults to latest if omitted.
Version param.Opt[string] `json:"version,omitzero"`
// contains filtered or unexported fields
}
An Anthropic-managed skill.
The properties SkillID, Type are required.
func (BetaManagedAgentsAnthropicSkillParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsAnthropicSkillParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsAnthropicSkillParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsAnthropicSkillParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsAnthropicSkillParamsType ¶ added in v1.33.0
type BetaManagedAgentsAnthropicSkillParamsType string
const (
BetaManagedAgentsAnthropicSkillParamsTypeAnthropic BetaManagedAgentsAnthropicSkillParamsType = "anthropic"
)
type BetaManagedAgentsAnthropicSkillType ¶ added in v1.33.0
type BetaManagedAgentsAnthropicSkillType string
const (
BetaManagedAgentsAnthropicSkillTypeAnthropic BetaManagedAgentsAnthropicSkillType = "anthropic"
)
type BetaManagedAgentsBase64DocumentSource ¶ added in v1.33.0
type BetaManagedAgentsBase64DocumentSource struct {
// Base64-encoded document data.
Data string `json:"data" api:"required"`
// MIME type of the document (e.g., "application/pdf").
MediaType string `json:"media_type" api:"required"`
// Any of "base64".
Type BetaManagedAgentsBase64DocumentSourceType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Base64-encoded document data.
func (BetaManagedAgentsBase64DocumentSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBase64DocumentSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsBase64DocumentSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsBase64DocumentSource) ToParam() BetaManagedAgentsBase64DocumentSourceParam
ToParam converts this BetaManagedAgentsBase64DocumentSource to a BetaManagedAgentsBase64DocumentSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsBase64DocumentSourceParam.Overrides()
func (*BetaManagedAgentsBase64DocumentSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBase64DocumentSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBase64DocumentSourceParam ¶ added in v1.33.0
type BetaManagedAgentsBase64DocumentSourceParam struct {
// Base64-encoded document data.
Data string `json:"data" api:"required"`
// MIME type of the document (e.g., "application/pdf").
MediaType string `json:"media_type" api:"required"`
// Any of "base64".
Type BetaManagedAgentsBase64DocumentSourceType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Base64-encoded document data.
The properties Data, MediaType, Type are required.
func (BetaManagedAgentsBase64DocumentSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBase64DocumentSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsBase64DocumentSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBase64DocumentSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBase64DocumentSourceType ¶ added in v1.33.0
type BetaManagedAgentsBase64DocumentSourceType string
const (
BetaManagedAgentsBase64DocumentSourceTypeBase64 BetaManagedAgentsBase64DocumentSourceType = "base64"
)
type BetaManagedAgentsBase64ImageSource ¶ added in v1.33.0
type BetaManagedAgentsBase64ImageSource struct {
// Base64-encoded image data.
Data string `json:"data" api:"required"`
// MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif",
// "image/webp").
MediaType string `json:"media_type" api:"required"`
// Any of "base64".
Type BetaManagedAgentsBase64ImageSourceType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Base64-encoded image data.
func (BetaManagedAgentsBase64ImageSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBase64ImageSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsBase64ImageSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsBase64ImageSource) ToParam() BetaManagedAgentsBase64ImageSourceParam
ToParam converts this BetaManagedAgentsBase64ImageSource to a BetaManagedAgentsBase64ImageSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsBase64ImageSourceParam.Overrides()
func (*BetaManagedAgentsBase64ImageSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBase64ImageSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBase64ImageSourceParam ¶ added in v1.33.0
type BetaManagedAgentsBase64ImageSourceParam struct {
// Base64-encoded image data.
Data string `json:"data" api:"required"`
// MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif",
// "image/webp").
MediaType string `json:"media_type" api:"required"`
// Any of "base64".
Type BetaManagedAgentsBase64ImageSourceType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Base64-encoded image data.
The properties Data, MediaType, Type are required.
func (BetaManagedAgentsBase64ImageSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBase64ImageSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsBase64ImageSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBase64ImageSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBase64ImageSourceType ¶ added in v1.33.0
type BetaManagedAgentsBase64ImageSourceType string
const (
BetaManagedAgentsBase64ImageSourceTypeBase64 BetaManagedAgentsBase64ImageSourceType = "base64"
)
type BetaManagedAgentsBillingError ¶ added in v1.33.0
type BetaManagedAgentsBillingError struct {
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsBillingErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "billing_error".
Type BetaManagedAgentsBillingErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.
func (BetaManagedAgentsBillingError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBillingError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsBillingError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBillingError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBillingErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsBillingErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsBillingErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsBillingErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsBillingErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsBillingErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsBillingErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsBillingErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsBillingErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsBillingErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsBillingErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsBillingErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsBillingErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsBillingErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBillingErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBillingErrorType ¶ added in v1.33.0
type BetaManagedAgentsBillingErrorType string
const (
BetaManagedAgentsBillingErrorTypeBillingError BetaManagedAgentsBillingErrorType = "billing_error"
)
type BetaManagedAgentsBranchCheckout ¶ added in v1.33.0
type BetaManagedAgentsBranchCheckout struct {
// Branch name to check out.
Name string `json:"name" api:"required"`
// Any of "branch".
Type BetaManagedAgentsBranchCheckoutType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsBranchCheckout) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBranchCheckout) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsBranchCheckout) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsBranchCheckout) ToParam() BetaManagedAgentsBranchCheckoutParam
ToParam converts this BetaManagedAgentsBranchCheckout to a BetaManagedAgentsBranchCheckoutParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsBranchCheckoutParam.Overrides()
func (*BetaManagedAgentsBranchCheckout) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBranchCheckout) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBranchCheckoutParam ¶ added in v1.33.0
type BetaManagedAgentsBranchCheckoutParam struct {
// Branch name to check out.
Name string `json:"name" api:"required"`
// Any of "branch".
Type BetaManagedAgentsBranchCheckoutType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaManagedAgentsBranchCheckoutParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsBranchCheckoutParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsBranchCheckoutParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsBranchCheckoutParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsBranchCheckoutType ¶ added in v1.33.0
type BetaManagedAgentsBranchCheckoutType string
const (
BetaManagedAgentsBranchCheckoutTypeBranch BetaManagedAgentsBranchCheckoutType = "branch"
)
type BetaManagedAgentsCacheCreationUsage ¶ added in v1.33.0
type BetaManagedAgentsCacheCreationUsage struct {
// Tokens used to create 1-hour ephemeral cache entries.
Ephemeral1hInputTokens int64 `json:"ephemeral_1h_input_tokens"`
// Tokens used to create 5-minute ephemeral cache entries.
Ephemeral5mInputTokens int64 `json:"ephemeral_5m_input_tokens"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Ephemeral1hInputTokens respjson.Field
Ephemeral5mInputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Prompt-cache creation token usage broken down by cache lifetime.
func (BetaManagedAgentsCacheCreationUsage) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCacheCreationUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsCacheCreationUsage) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCacheCreationUsage) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCommitCheckout ¶ added in v1.33.0
type BetaManagedAgentsCommitCheckout struct {
// Full commit SHA to check out.
Sha string `json:"sha" api:"required"`
// Any of "commit".
Type BetaManagedAgentsCommitCheckoutType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Sha respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsCommitCheckout) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCommitCheckout) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsCommitCheckout) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsCommitCheckout) ToParam() BetaManagedAgentsCommitCheckoutParam
ToParam converts this BetaManagedAgentsCommitCheckout to a BetaManagedAgentsCommitCheckoutParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsCommitCheckoutParam.Overrides()
func (*BetaManagedAgentsCommitCheckout) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCommitCheckout) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCommitCheckoutParam ¶ added in v1.33.0
type BetaManagedAgentsCommitCheckoutParam struct {
// Full commit SHA to check out.
Sha string `json:"sha" api:"required"`
// Any of "commit".
Type BetaManagedAgentsCommitCheckoutType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
The properties Sha, Type are required.
func (BetaManagedAgentsCommitCheckoutParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCommitCheckoutParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsCommitCheckoutParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCommitCheckoutParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCommitCheckoutType ¶ added in v1.33.0
type BetaManagedAgentsCommitCheckoutType string
const (
BetaManagedAgentsCommitCheckoutTypeCommit BetaManagedAgentsCommitCheckoutType = "commit"
)
type BetaManagedAgentsCredential ¶ added in v1.33.0
type BetaManagedAgentsCredential struct {
// Unique identifier for the credential.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
// Authentication details for a credential.
Auth BetaManagedAgentsCredentialAuthUnion `json:"auth" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Arbitrary key-value metadata attached to the credential.
Metadata map[string]string `json:"metadata" api:"required"`
// Any of "vault_credential".
Type BetaManagedAgentsCredentialType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Identifier of the vault this credential belongs to.
VaultID string `json:"vault_id" api:"required"`
// Human-readable name for the credential.
DisplayName string `json:"display_name" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ArchivedAt respjson.Field
Auth respjson.Field
CreatedAt respjson.Field
Metadata respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
VaultID respjson.Field
DisplayName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A credential stored in a vault. Sensitive fields are never returned in responses.
func (BetaManagedAgentsCredential) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCredential) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsCredential) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCredential) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCredentialAuthUnion ¶ added in v1.33.0
type BetaManagedAgentsCredentialAuthUnion struct {
MCPServerURL string `json:"mcp_server_url"`
// Any of "mcp_oauth", "static_bearer".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsMCPOAuthAuthResponse].
ExpiresAt time.Time `json:"expires_at"`
// This field is from variant [BetaManagedAgentsMCPOAuthAuthResponse].
Refresh BetaManagedAgentsMCPOAuthRefreshResponse `json:"refresh"`
JSON struct {
MCPServerURL respjson.Field
Type respjson.Field
ExpiresAt respjson.Field
Refresh respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsCredentialAuthUnion contains all possible properties and values from BetaManagedAgentsMCPOAuthAuthResponse, BetaManagedAgentsStaticBearerAuthResponse.
Use the BetaManagedAgentsCredentialAuthUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsCredentialAuthUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsCredentialAuthUnion) AsAny() anyBetaManagedAgentsCredentialAuth
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsCredentialAuthUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsMCPOAuthAuthResponse:
case anthropic.BetaManagedAgentsStaticBearerAuthResponse:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsCredentialAuthUnion) AsMCPOAuth ¶ added in v1.33.0
func (u BetaManagedAgentsCredentialAuthUnion) AsMCPOAuth() (v BetaManagedAgentsMCPOAuthAuthResponse)
func (BetaManagedAgentsCredentialAuthUnion) AsStaticBearer ¶ added in v1.33.0
func (u BetaManagedAgentsCredentialAuthUnion) AsStaticBearer() (v BetaManagedAgentsStaticBearerAuthResponse)
func (BetaManagedAgentsCredentialAuthUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsCredentialAuthUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsCredentialAuthUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCredentialAuthUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCredentialType ¶ added in v1.33.0
type BetaManagedAgentsCredentialType string
const (
BetaManagedAgentsCredentialTypeVaultCredential BetaManagedAgentsCredentialType = "vault_credential"
)
type BetaManagedAgentsCustomSkill ¶ added in v1.33.0
type BetaManagedAgentsCustomSkill struct {
SkillID string `json:"skill_id" api:"required"`
// Any of "custom".
Type BetaManagedAgentsCustomSkillType `json:"type" api:"required"`
Version string `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A resolved user-created custom skill.
func (BetaManagedAgentsCustomSkill) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCustomSkill) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsCustomSkill) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCustomSkill) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCustomSkillParams ¶ added in v1.33.0
type BetaManagedAgentsCustomSkillParams struct {
// Tagged ID of the custom skill (e.g., "skill_01XJ5...").
SkillID string `json:"skill_id" api:"required"`
// Any of "custom".
Type BetaManagedAgentsCustomSkillParamsType `json:"type,omitzero" api:"required"`
// Version to pin. Defaults to latest if omitted.
Version param.Opt[string] `json:"version,omitzero"`
// contains filtered or unexported fields
}
A user-created custom skill.
The properties SkillID, Type are required.
func (BetaManagedAgentsCustomSkillParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCustomSkillParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsCustomSkillParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCustomSkillParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCustomSkillParamsType ¶ added in v1.33.0
type BetaManagedAgentsCustomSkillParamsType string
const (
BetaManagedAgentsCustomSkillParamsTypeCustom BetaManagedAgentsCustomSkillParamsType = "custom"
)
type BetaManagedAgentsCustomSkillType ¶ added in v1.33.0
type BetaManagedAgentsCustomSkillType string
const (
BetaManagedAgentsCustomSkillTypeCustom BetaManagedAgentsCustomSkillType = "custom"
)
type BetaManagedAgentsCustomTool ¶ added in v1.33.0
type BetaManagedAgentsCustomTool struct {
Description string `json:"description" api:"required"`
// JSON Schema for custom tool input parameters.
InputSchema BetaManagedAgentsCustomToolInputSchema `json:"input_schema" api:"required"`
Name string `json:"name" api:"required"`
// Any of "custom".
Type BetaManagedAgentsCustomToolType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
InputSchema respjson.Field
Name respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A custom tool as returned in API responses.
func (BetaManagedAgentsCustomTool) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCustomTool) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsCustomTool) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCustomTool) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCustomToolInputSchema ¶ added in v1.33.0
type BetaManagedAgentsCustomToolInputSchema struct {
// JSON Schema properties defining the tool's input parameters.
Properties map[string]any `json:"properties" api:"nullable"`
// List of required property names.
Required []string `json:"required"`
// Must be 'object' for tool input schemas.
//
// Any of "object".
Type BetaManagedAgentsCustomToolInputSchemaType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Properties respjson.Field
Required respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
JSON Schema for custom tool input parameters.
func (BetaManagedAgentsCustomToolInputSchema) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCustomToolInputSchema) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsCustomToolInputSchema) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsCustomToolInputSchema) ToParam() BetaManagedAgentsCustomToolInputSchemaParam
ToParam converts this BetaManagedAgentsCustomToolInputSchema to a BetaManagedAgentsCustomToolInputSchemaParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsCustomToolInputSchemaParam.Overrides()
func (*BetaManagedAgentsCustomToolInputSchema) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCustomToolInputSchema) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCustomToolInputSchemaParam ¶ added in v1.33.0
type BetaManagedAgentsCustomToolInputSchemaParam struct {
// JSON Schema properties defining the tool's input parameters.
Properties map[string]any `json:"properties,omitzero"`
// List of required property names.
Required []string `json:"required,omitzero"`
// Must be 'object' for tool input schemas.
//
// Any of "object".
Type BetaManagedAgentsCustomToolInputSchemaType `json:"type,omitzero"`
// contains filtered or unexported fields
}
JSON Schema for custom tool input parameters.
func (BetaManagedAgentsCustomToolInputSchemaParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCustomToolInputSchemaParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsCustomToolInputSchemaParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCustomToolInputSchemaParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCustomToolInputSchemaType ¶ added in v1.33.0
type BetaManagedAgentsCustomToolInputSchemaType string
Must be 'object' for tool input schemas.
const (
BetaManagedAgentsCustomToolInputSchemaTypeObject BetaManagedAgentsCustomToolInputSchemaType = "object"
)
type BetaManagedAgentsCustomToolParams ¶ added in v1.33.0
type BetaManagedAgentsCustomToolParams struct {
// Description of what the tool does, shown to the agent to help it decide when to
// use the tool. 1-1024 characters.
Description string `json:"description" api:"required"`
// JSON Schema for custom tool input parameters.
InputSchema BetaManagedAgentsCustomToolInputSchemaParam `json:"input_schema,omitzero" api:"required"`
// Unique name for the tool. 1-128 characters; letters, digits, underscores, and
// hyphens.
Name string `json:"name" api:"required"`
// Any of "custom".
Type BetaManagedAgentsCustomToolParamsType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an `agent.custom_tool_use` event is emitted and the session goes idle, waiting for the client to provide the result via a `user.custom_tool_result` event.
The properties Description, InputSchema, Name, Type are required.
func (BetaManagedAgentsCustomToolParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsCustomToolParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsCustomToolParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsCustomToolParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsCustomToolParamsType ¶ added in v1.33.0
type BetaManagedAgentsCustomToolParamsType string
const (
BetaManagedAgentsCustomToolParamsTypeCustom BetaManagedAgentsCustomToolParamsType = "custom"
)
type BetaManagedAgentsCustomToolType ¶ added in v1.33.0
type BetaManagedAgentsCustomToolType string
const (
BetaManagedAgentsCustomToolTypeCustom BetaManagedAgentsCustomToolType = "custom"
)
type BetaManagedAgentsDeleteSessionResource ¶ added in v1.33.0
type BetaManagedAgentsDeleteSessionResource struct {
ID string `json:"id" api:"required"`
// Any of "session_resource_deleted".
Type BetaManagedAgentsDeleteSessionResourceType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Confirmation of resource deletion.
func (BetaManagedAgentsDeleteSessionResource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsDeleteSessionResource) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDeleteSessionResource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDeleteSessionResource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDeleteSessionResourceType ¶ added in v1.33.0
type BetaManagedAgentsDeleteSessionResourceType string
const (
BetaManagedAgentsDeleteSessionResourceTypeSessionResourceDeleted BetaManagedAgentsDeleteSessionResourceType = "session_resource_deleted"
)
type BetaManagedAgentsDeletedCredential ¶ added in v1.33.0
type BetaManagedAgentsDeletedCredential struct {
// Unique identifier of the deleted credential.
ID string `json:"id" api:"required"`
// Any of "vault_credential_deleted".
Type BetaManagedAgentsDeletedCredentialType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Confirmation of a deleted credential.
func (BetaManagedAgentsDeletedCredential) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsDeletedCredential) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDeletedCredential) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDeletedCredential) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDeletedCredentialType ¶ added in v1.33.0
type BetaManagedAgentsDeletedCredentialType string
const (
BetaManagedAgentsDeletedCredentialTypeVaultCredentialDeleted BetaManagedAgentsDeletedCredentialType = "vault_credential_deleted"
)
type BetaManagedAgentsDeletedMemory ¶ added in v1.38.0
type BetaManagedAgentsDeletedMemory struct {
ID string `json:"id" api:"required"`
// Any of "memory_deleted".
Type BetaManagedAgentsDeletedMemoryType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsDeletedMemory) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsDeletedMemory) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDeletedMemory) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsDeletedMemory) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDeletedMemoryStore ¶ added in v1.38.0
type BetaManagedAgentsDeletedMemoryStore struct {
ID string `json:"id" api:"required"`
// Any of "memory_store_deleted".
Type BetaManagedAgentsDeletedMemoryStoreType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsDeletedMemoryStore) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsDeletedMemoryStore) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDeletedMemoryStore) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsDeletedMemoryStore) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDeletedMemoryStoreType ¶ added in v1.38.0
type BetaManagedAgentsDeletedMemoryStoreType string
const (
BetaManagedAgentsDeletedMemoryStoreTypeMemoryStoreDeleted BetaManagedAgentsDeletedMemoryStoreType = "memory_store_deleted"
)
type BetaManagedAgentsDeletedMemoryType ¶ added in v1.38.0
type BetaManagedAgentsDeletedMemoryType string
const (
BetaManagedAgentsDeletedMemoryTypeMemoryDeleted BetaManagedAgentsDeletedMemoryType = "memory_deleted"
)
type BetaManagedAgentsDeletedSession ¶ added in v1.33.0
type BetaManagedAgentsDeletedSession struct {
ID string `json:"id" api:"required"`
// Any of "session_deleted".
Type BetaManagedAgentsDeletedSessionType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Confirmation that a `session` has been permanently deleted.
func (BetaManagedAgentsDeletedSession) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsDeletedSession) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDeletedSession) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDeletedSession) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDeletedSessionType ¶ added in v1.33.0
type BetaManagedAgentsDeletedSessionType string
const (
BetaManagedAgentsDeletedSessionTypeSessionDeleted BetaManagedAgentsDeletedSessionType = "session_deleted"
)
type BetaManagedAgentsDeletedVault ¶ added in v1.33.0
type BetaManagedAgentsDeletedVault struct {
// Unique identifier of the deleted vault.
ID string `json:"id" api:"required"`
// Any of "vault_deleted".
Type BetaManagedAgentsDeletedVaultType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Confirmation of a deleted vault.
func (BetaManagedAgentsDeletedVault) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsDeletedVault) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDeletedVault) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDeletedVault) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDeletedVaultType ¶ added in v1.33.0
type BetaManagedAgentsDeletedVaultType string
const (
BetaManagedAgentsDeletedVaultTypeVaultDeleted BetaManagedAgentsDeletedVaultType = "vault_deleted"
)
type BetaManagedAgentsDocumentBlock ¶ added in v1.33.0
type BetaManagedAgentsDocumentBlock struct {
// Union type for document source variants.
Source BetaManagedAgentsDocumentBlockSourceUnion `json:"source" api:"required"`
// Any of "document".
Type BetaManagedAgentsDocumentBlockType `json:"type" api:"required"`
// Additional context about the document for the model.
Context string `json:"context" api:"nullable"`
// The title of the document.
Title string `json:"title" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Source respjson.Field
Type respjson.Field
Context respjson.Field
Title respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Document content, either specified directly as base64 data, as text, or as a reference via a URL.
func (BetaManagedAgentsDocumentBlock) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsDocumentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsDocumentBlock) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsDocumentBlock) ToParam() BetaManagedAgentsDocumentBlockParam
ToParam converts this BetaManagedAgentsDocumentBlock to a BetaManagedAgentsDocumentBlockParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsDocumentBlockParam.Overrides()
func (*BetaManagedAgentsDocumentBlock) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDocumentBlock) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDocumentBlockParam ¶ added in v1.33.0
type BetaManagedAgentsDocumentBlockParam struct {
// Union type for document source variants.
Source BetaManagedAgentsDocumentBlockSourceUnionParam `json:"source,omitzero" api:"required"`
// Any of "document".
Type BetaManagedAgentsDocumentBlockType `json:"type,omitzero" api:"required"`
// Additional context about the document for the model.
Context param.Opt[string] `json:"context,omitzero"`
// The title of the document.
Title param.Opt[string] `json:"title,omitzero"`
// contains filtered or unexported fields
}
Document content, either specified directly as base64 data, as text, or as a reference via a URL.
The properties Source, Type are required.
func (BetaManagedAgentsDocumentBlockParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsDocumentBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsDocumentBlockParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDocumentBlockParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDocumentBlockSourceUnion ¶ added in v1.33.0
type BetaManagedAgentsDocumentBlockSourceUnion struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
// Any of "base64", "text", "url", "file".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsURLDocumentSource].
URL string `json:"url"`
// This field is from variant [BetaManagedAgentsFileDocumentSource].
FileID string `json:"file_id"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
URL respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsDocumentBlockSourceUnion contains all possible properties and values from BetaManagedAgentsBase64DocumentSource, BetaManagedAgentsPlainTextDocumentSource, BetaManagedAgentsURLDocumentSource, BetaManagedAgentsFileDocumentSource.
Use the BetaManagedAgentsDocumentBlockSourceUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsDocumentBlockSourceUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnion) AsAny() anyBetaManagedAgentsDocumentBlockSource
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsDocumentBlockSourceUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsBase64DocumentSource:
case anthropic.BetaManagedAgentsPlainTextDocumentSource:
case anthropic.BetaManagedAgentsURLDocumentSource:
case anthropic.BetaManagedAgentsFileDocumentSource:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsDocumentBlockSourceUnion) AsBase64 ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnion) AsBase64() (v BetaManagedAgentsBase64DocumentSource)
func (BetaManagedAgentsDocumentBlockSourceUnion) AsFile ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnion) AsFile() (v BetaManagedAgentsFileDocumentSource)
func (BetaManagedAgentsDocumentBlockSourceUnion) AsText ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnion) AsText() (v BetaManagedAgentsPlainTextDocumentSource)
func (BetaManagedAgentsDocumentBlockSourceUnion) AsURL ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnion) AsURL() (v BetaManagedAgentsURLDocumentSource)
func (BetaManagedAgentsDocumentBlockSourceUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsDocumentBlockSourceUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsDocumentBlockSourceUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDocumentBlockSourceUnionParam ¶ added in v1.33.0
type BetaManagedAgentsDocumentBlockSourceUnionParam struct {
OfBase64 *BetaManagedAgentsBase64DocumentSourceParam `json:",omitzero,inline"`
OfText *BetaManagedAgentsPlainTextDocumentSourceParam `json:",omitzero,inline"`
OfURL *BetaManagedAgentsURLDocumentSourceParam `json:",omitzero,inline"`
OfFile *BetaManagedAgentsFileDocumentSourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsDocumentBlockSourceUnionParam) GetData ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsDocumentBlockSourceUnionParam) GetFileID ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsDocumentBlockSourceUnionParam) GetMediaType ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetMediaType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsDocumentBlockSourceUnionParam) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsDocumentBlockSourceUnionParam) GetURL ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnionParam) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsDocumentBlockSourceUnionParam) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsDocumentBlockSourceUnionParam) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsDocumentBlockSourceUnionParam) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsDocumentBlockSourceUnionParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsDocumentBlockType ¶ added in v1.33.0
type BetaManagedAgentsDocumentBlockType string
const (
BetaManagedAgentsDocumentBlockTypeDocument BetaManagedAgentsDocumentBlockType = "document"
)
type BetaManagedAgentsEventParamsUnion ¶ added in v1.33.0
type BetaManagedAgentsEventParamsUnion struct {
OfUserMessage *BetaManagedAgentsUserMessageEventParams `json:",omitzero,inline"`
OfUserInterrupt *BetaManagedAgentsUserInterruptEventParams `json:",omitzero,inline"`
OfUserToolConfirmation *BetaManagedAgentsUserToolConfirmationEventParams `json:",omitzero,inline"`
OfUserCustomToolResult *BetaManagedAgentsUserCustomToolResultEventParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaManagedAgentsEventParamsOfUserCustomToolResult ¶ added in v1.33.0
func BetaManagedAgentsEventParamsOfUserCustomToolResult(customToolUseID string) BetaManagedAgentsEventParamsUnion
func BetaManagedAgentsEventParamsOfUserInterrupt ¶ added in v1.33.0
func BetaManagedAgentsEventParamsOfUserInterrupt(type_ BetaManagedAgentsUserInterruptEventParamsType) BetaManagedAgentsEventParamsUnion
func BetaManagedAgentsEventParamsOfUserMessage ¶ added in v1.33.0
func BetaManagedAgentsEventParamsOfUserMessage(content []BetaManagedAgentsUserMessageEventParamsContentUnion) BetaManagedAgentsEventParamsUnion
func BetaManagedAgentsEventParamsOfUserToolConfirmation ¶ added in v1.33.0
func BetaManagedAgentsEventParamsOfUserToolConfirmation(result BetaManagedAgentsUserToolConfirmationEventParamsResult, toolUseID string, type_ BetaManagedAgentsUserToolConfirmationEventParamsType) BetaManagedAgentsEventParamsUnion
func (BetaManagedAgentsEventParamsUnion) GetContent ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetContent() (res betaManagedAgentsEventParamsUnionContent)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaManagedAgentsEventParamsUnion) GetCustomToolUseID ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetCustomToolUseID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsEventParamsUnion) GetDenyMessage ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetDenyMessage() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsEventParamsUnion) GetIsError ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetIsError() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsEventParamsUnion) GetResult ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetResult() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsEventParamsUnion) GetToolUseID ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetToolUseID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsEventParamsUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsEventParamsUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsEventParamsUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsEventParamsUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsEventParamsUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileDocumentSource ¶ added in v1.33.0
type BetaManagedAgentsFileDocumentSource struct {
// ID of a previously uploaded file.
FileID string `json:"file_id" api:"required"`
// Any of "file".
Type BetaManagedAgentsFileDocumentSourceType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Document referenced by file ID.
func (BetaManagedAgentsFileDocumentSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsFileDocumentSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsFileDocumentSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsFileDocumentSource) ToParam() BetaManagedAgentsFileDocumentSourceParam
ToParam converts this BetaManagedAgentsFileDocumentSource to a BetaManagedAgentsFileDocumentSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsFileDocumentSourceParam.Overrides()
func (*BetaManagedAgentsFileDocumentSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsFileDocumentSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileDocumentSourceParam ¶ added in v1.33.0
type BetaManagedAgentsFileDocumentSourceParam struct {
// ID of a previously uploaded file.
FileID string `json:"file_id" api:"required"`
// Any of "file".
Type BetaManagedAgentsFileDocumentSourceType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Document referenced by file ID.
The properties FileID, Type are required.
func (BetaManagedAgentsFileDocumentSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsFileDocumentSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsFileDocumentSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsFileDocumentSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileDocumentSourceType ¶ added in v1.33.0
type BetaManagedAgentsFileDocumentSourceType string
const (
BetaManagedAgentsFileDocumentSourceTypeFile BetaManagedAgentsFileDocumentSourceType = "file"
)
type BetaManagedAgentsFileImageSource ¶ added in v1.33.0
type BetaManagedAgentsFileImageSource struct {
// ID of a previously uploaded file.
FileID string `json:"file_id" api:"required"`
// Any of "file".
Type BetaManagedAgentsFileImageSourceType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Image referenced by file ID.
func (BetaManagedAgentsFileImageSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsFileImageSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsFileImageSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsFileImageSource) ToParam() BetaManagedAgentsFileImageSourceParam
ToParam converts this BetaManagedAgentsFileImageSource to a BetaManagedAgentsFileImageSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsFileImageSourceParam.Overrides()
func (*BetaManagedAgentsFileImageSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsFileImageSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileImageSourceParam ¶ added in v1.33.0
type BetaManagedAgentsFileImageSourceParam struct {
// ID of a previously uploaded file.
FileID string `json:"file_id" api:"required"`
// Any of "file".
Type BetaManagedAgentsFileImageSourceType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Image referenced by file ID.
The properties FileID, Type are required.
func (BetaManagedAgentsFileImageSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsFileImageSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsFileImageSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsFileImageSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileImageSourceType ¶ added in v1.33.0
type BetaManagedAgentsFileImageSourceType string
const (
BetaManagedAgentsFileImageSourceTypeFile BetaManagedAgentsFileImageSourceType = "file"
)
type BetaManagedAgentsFileResource ¶ added in v1.33.0
type BetaManagedAgentsFileResource struct {
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
FileID string `json:"file_id" api:"required"`
MountPath string `json:"mount_path" api:"required"`
// Any of "file".
Type BetaManagedAgentsFileResourceType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
FileID respjson.Field
MountPath respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsFileResource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsFileResource) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsFileResource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsFileResource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileResourceParams ¶ added in v1.33.0
type BetaManagedAgentsFileResourceParams struct {
// ID of a previously uploaded file.
FileID string `json:"file_id" api:"required"`
// Any of "file".
Type BetaManagedAgentsFileResourceParamsType `json:"type,omitzero" api:"required"`
// Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
MountPath param.Opt[string] `json:"mount_path,omitzero"`
// contains filtered or unexported fields
}
Mount a file uploaded via the Files API into the session.
The properties FileID, Type are required.
func (BetaManagedAgentsFileResourceParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsFileResourceParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsFileResourceParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsFileResourceParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsFileResourceParamsType ¶ added in v1.33.0
type BetaManagedAgentsFileResourceParamsType string
const (
BetaManagedAgentsFileResourceParamsTypeFile BetaManagedAgentsFileResourceParamsType = "file"
)
type BetaManagedAgentsFileResourceType ¶ added in v1.33.0
type BetaManagedAgentsFileResourceType string
const (
BetaManagedAgentsFileResourceTypeFile BetaManagedAgentsFileResourceType = "file"
)
type BetaManagedAgentsGitHubRepositoryResource ¶ added in v1.33.0
type BetaManagedAgentsGitHubRepositoryResource struct {
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
MountPath string `json:"mount_path" api:"required"`
// Any of "github_repository".
Type BetaManagedAgentsGitHubRepositoryResourceType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
URL string `json:"url" api:"required"`
Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion `json:"checkout" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
MountPath respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
URL respjson.Field
Checkout respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsGitHubRepositoryResource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsGitHubRepositoryResource) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsGitHubRepositoryResource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsGitHubRepositoryResource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion ¶ added in v1.33.0
type BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion struct {
// This field is from variant [BetaManagedAgentsBranchCheckout].
Name string `json:"name"`
// Any of "branch", "commit".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsCommitCheckout].
Sha string `json:"sha"`
JSON struct {
Name respjson.Field
Type respjson.Field
Sha respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion contains all possible properties and values from BetaManagedAgentsBranchCheckout, BetaManagedAgentsCommitCheckout.
Use the BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsAny() anyBetaManagedAgentsGitHubRepositoryResourceCheckout
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsBranchCheckout:
case anthropic.BetaManagedAgentsCommitCheckout:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsBranch ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsBranch() (v BetaManagedAgentsBranchCheckout)
func (BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsCommit ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) AsCommit() (v BetaManagedAgentsCommitCheckout)
func (BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsGitHubRepositoryResourceParams ¶ added in v1.33.0
type BetaManagedAgentsGitHubRepositoryResourceParams struct {
// GitHub authorization token used to clone the repository.
AuthorizationToken string `json:"authorization_token" api:"required"`
// Any of "github_repository".
Type BetaManagedAgentsGitHubRepositoryResourceParamsType `json:"type,omitzero" api:"required"`
// Github URL of the repository
URL string `json:"url" api:"required"`
// Mount path in the container. Defaults to `/workspace/<repo-name>`.
MountPath param.Opt[string] `json:"mount_path,omitzero"`
// Branch or commit to check out. Defaults to the repository's default branch.
Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion `json:"checkout,omitzero"`
// contains filtered or unexported fields
}
Mount a GitHub repository into the session's container.
The properties AuthorizationToken, Type, URL are required.
func (BetaManagedAgentsGitHubRepositoryResourceParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsGitHubRepositoryResourceParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsGitHubRepositoryResourceParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsGitHubRepositoryResourceParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion ¶ added in v1.33.0
type BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion struct {
OfBranch *BetaManagedAgentsBranchCheckoutParam `json:",omitzero,inline"`
OfCommit *BetaManagedAgentsCommitCheckoutParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetName ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetSha ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetSha() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsGitHubRepositoryResourceParamsType ¶ added in v1.33.0
type BetaManagedAgentsGitHubRepositoryResourceParamsType string
const (
BetaManagedAgentsGitHubRepositoryResourceParamsTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceParamsType = "github_repository"
)
type BetaManagedAgentsGitHubRepositoryResourceType ¶ added in v1.33.0
type BetaManagedAgentsGitHubRepositoryResourceType string
const (
BetaManagedAgentsGitHubRepositoryResourceTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceType = "github_repository"
)
type BetaManagedAgentsImageBlock ¶ added in v1.33.0
type BetaManagedAgentsImageBlock struct {
// Union type for image source variants.
Source BetaManagedAgentsImageBlockSourceUnion `json:"source" api:"required"`
// Any of "image".
Type BetaManagedAgentsImageBlockType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Source respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Image content specified directly as base64 data or as a reference via a URL.
func (BetaManagedAgentsImageBlock) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsImageBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsImageBlock) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsImageBlock) ToParam() BetaManagedAgentsImageBlockParam
ToParam converts this BetaManagedAgentsImageBlock to a BetaManagedAgentsImageBlockParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsImageBlockParam.Overrides()
func (*BetaManagedAgentsImageBlock) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsImageBlock) UnmarshalJSON(data []byte) error
type BetaManagedAgentsImageBlockParam ¶ added in v1.33.0
type BetaManagedAgentsImageBlockParam struct {
// Union type for image source variants.
Source BetaManagedAgentsImageBlockSourceUnionParam `json:"source,omitzero" api:"required"`
// Any of "image".
Type BetaManagedAgentsImageBlockType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Image content specified directly as base64 data or as a reference via a URL.
The properties Source, Type are required.
func (BetaManagedAgentsImageBlockParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsImageBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsImageBlockParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsImageBlockParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsImageBlockSourceUnion ¶ added in v1.33.0
type BetaManagedAgentsImageBlockSourceUnion struct {
// This field is from variant [BetaManagedAgentsBase64ImageSource].
Data string `json:"data"`
// This field is from variant [BetaManagedAgentsBase64ImageSource].
MediaType string `json:"media_type"`
// Any of "base64", "url", "file".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsURLImageSource].
URL string `json:"url"`
// This field is from variant [BetaManagedAgentsFileImageSource].
FileID string `json:"file_id"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
URL respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsImageBlockSourceUnion contains all possible properties and values from BetaManagedAgentsBase64ImageSource, BetaManagedAgentsURLImageSource, BetaManagedAgentsFileImageSource.
Use the BetaManagedAgentsImageBlockSourceUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsImageBlockSourceUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnion) AsAny() anyBetaManagedAgentsImageBlockSource
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsImageBlockSourceUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsBase64ImageSource:
case anthropic.BetaManagedAgentsURLImageSource:
case anthropic.BetaManagedAgentsFileImageSource:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsImageBlockSourceUnion) AsBase64 ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnion) AsBase64() (v BetaManagedAgentsBase64ImageSource)
func (BetaManagedAgentsImageBlockSourceUnion) AsFile ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnion) AsFile() (v BetaManagedAgentsFileImageSource)
func (BetaManagedAgentsImageBlockSourceUnion) AsURL ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnion) AsURL() (v BetaManagedAgentsURLImageSource)
func (BetaManagedAgentsImageBlockSourceUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsImageBlockSourceUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsImageBlockSourceUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsImageBlockSourceUnionParam ¶ added in v1.33.0
type BetaManagedAgentsImageBlockSourceUnionParam struct {
OfBase64 *BetaManagedAgentsBase64ImageSourceParam `json:",omitzero,inline"`
OfURL *BetaManagedAgentsURLImageSourceParam `json:",omitzero,inline"`
OfFile *BetaManagedAgentsFileImageSourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsImageBlockSourceUnionParam) GetData ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnionParam) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsImageBlockSourceUnionParam) GetFileID ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnionParam) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsImageBlockSourceUnionParam) GetMediaType ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnionParam) GetMediaType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsImageBlockSourceUnionParam) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsImageBlockSourceUnionParam) GetURL ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnionParam) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsImageBlockSourceUnionParam) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsImageBlockSourceUnionParam) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsImageBlockSourceUnionParam) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsImageBlockSourceUnionParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsImageBlockType ¶ added in v1.33.0
type BetaManagedAgentsImageBlockType string
const (
BetaManagedAgentsImageBlockTypeImage BetaManagedAgentsImageBlockType = "image"
)
type BetaManagedAgentsMCPAuthenticationFailedError ¶ added in v1.33.0
type BetaManagedAgentsMCPAuthenticationFailedError struct {
// Name of the MCP server that failed authentication.
MCPServerName string `json:"mcp_server_name" api:"required"`
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "mcp_authentication_failed_error".
Type BetaManagedAgentsMCPAuthenticationFailedErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MCPServerName respjson.Field
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Authentication to an MCP server failed.
func (BetaManagedAgentsMCPAuthenticationFailedError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPAuthenticationFailedError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPAuthenticationFailedError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPAuthenticationFailedError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsMCPAuthenticationFailedErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPAuthenticationFailedErrorType ¶ added in v1.33.0
type BetaManagedAgentsMCPAuthenticationFailedErrorType string
const (
BetaManagedAgentsMCPAuthenticationFailedErrorTypeMCPAuthenticationFailedError BetaManagedAgentsMCPAuthenticationFailedErrorType = "mcp_authentication_failed_error"
)
type BetaManagedAgentsMCPConnectionFailedError ¶ added in v1.33.0
type BetaManagedAgentsMCPConnectionFailedError struct {
// Name of the MCP server that failed to connect.
MCPServerName string `json:"mcp_server_name" api:"required"`
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "mcp_connection_failed_error".
Type BetaManagedAgentsMCPConnectionFailedErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MCPServerName respjson.Field
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Failed to connect to an MCP server.
func (BetaManagedAgentsMCPConnectionFailedError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPConnectionFailedError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPConnectionFailedError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPConnectionFailedError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsMCPConnectionFailedErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPConnectionFailedErrorType ¶ added in v1.33.0
type BetaManagedAgentsMCPConnectionFailedErrorType string
const (
BetaManagedAgentsMCPConnectionFailedErrorTypeMCPConnectionFailedError BetaManagedAgentsMCPConnectionFailedErrorType = "mcp_connection_failed_error"
)
type BetaManagedAgentsMCPOAuthAuthResponse ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthAuthResponse struct {
// URL of the MCP server this credential authenticates against.
MCPServerURL string `json:"mcp_server_url" api:"required"`
// Any of "mcp_oauth".
Type BetaManagedAgentsMCPOAuthAuthResponseType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
ExpiresAt time.Time `json:"expires_at" api:"nullable" format:"date-time"`
// OAuth refresh token configuration returned in credential responses.
Refresh BetaManagedAgentsMCPOAuthRefreshResponse `json:"refresh" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MCPServerURL respjson.Field
Type respjson.Field
ExpiresAt respjson.Field
Refresh respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
OAuth credential details for an MCP server.
func (BetaManagedAgentsMCPOAuthAuthResponse) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPOAuthAuthResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPOAuthAuthResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthAuthResponse) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthAuthResponseType ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthAuthResponseType string
const (
BetaManagedAgentsMCPOAuthAuthResponseTypeMCPOAuth BetaManagedAgentsMCPOAuthAuthResponseType = "mcp_oauth"
)
type BetaManagedAgentsMCPOAuthCreateParams ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthCreateParams struct {
// OAuth access token.
AccessToken string `json:"access_token" api:"required"`
// URL of the MCP server this credential authenticates against.
MCPServerURL string `json:"mcp_server_url" api:"required"`
// Any of "mcp_oauth".
Type BetaManagedAgentsMCPOAuthCreateParamsType `json:"type,omitzero" api:"required"`
// A timestamp in RFC 3339 format
ExpiresAt param.Opt[time.Time] `json:"expires_at,omitzero" format:"date-time"`
// OAuth refresh token parameters for creating a credential with refresh support.
Refresh BetaManagedAgentsMCPOAuthRefreshParams `json:"refresh,omitzero"`
// contains filtered or unexported fields
}
Parameters for creating an MCP OAuth credential.
The properties AccessToken, MCPServerURL, Type are required.
func (BetaManagedAgentsMCPOAuthCreateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPOAuthCreateParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPOAuthCreateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthCreateParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthCreateParamsType ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthCreateParamsType string
const (
BetaManagedAgentsMCPOAuthCreateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthCreateParamsType = "mcp_oauth"
)
type BetaManagedAgentsMCPOAuthRefreshParams ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthRefreshParams struct {
// OAuth client ID.
ClientID string `json:"client_id" api:"required"`
// OAuth refresh token.
RefreshToken string `json:"refresh_token" api:"required"`
// Token endpoint URL used to refresh the access token.
TokenEndpoint string `json:"token_endpoint" api:"required"`
// Token endpoint requires no client authentication.
TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion `json:"token_endpoint_auth,omitzero" api:"required"`
// OAuth resource indicator.
Resource param.Opt[string] `json:"resource,omitzero"`
// OAuth scope for the refresh request.
Scope param.Opt[string] `json:"scope,omitzero"`
// contains filtered or unexported fields
}
OAuth refresh token parameters for creating a credential with refresh support.
The properties ClientID, RefreshToken, TokenEndpoint, TokenEndpointAuth are required.
func (BetaManagedAgentsMCPOAuthRefreshParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPOAuthRefreshParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPOAuthRefreshParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthRefreshParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion struct {
OfNone *BetaManagedAgentsTokenEndpointAuthNoneParam `json:",omitzero,inline"`
OfClientSecretBasic *BetaManagedAgentsTokenEndpointAuthBasicParam `json:",omitzero,inline"`
OfClientSecretPost *BetaManagedAgentsTokenEndpointAuthPostParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) GetClientSecret ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) GetClientSecret() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsMCPOAuthRefreshParamsTokenEndpointAuthUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthRefreshResponse ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthRefreshResponse struct {
// OAuth client ID.
ClientID string `json:"client_id" api:"required"`
// Token endpoint URL used to refresh the access token.
TokenEndpoint string `json:"token_endpoint" api:"required"`
// Token endpoint requires no client authentication.
TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion `json:"token_endpoint_auth" api:"required"`
// OAuth resource indicator.
Resource string `json:"resource" api:"nullable"`
// OAuth scope for the refresh request.
Scope string `json:"scope" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClientID respjson.Field
TokenEndpoint respjson.Field
TokenEndpointAuth respjson.Field
Resource respjson.Field
Scope respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
OAuth refresh token configuration returned in credential responses.
func (BetaManagedAgentsMCPOAuthRefreshResponse) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPOAuthRefreshResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPOAuthRefreshResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthRefreshResponse) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion struct {
// Any of "none", "client_secret_basic", "client_secret_post".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion contains all possible properties and values from BetaManagedAgentsTokenEndpointAuthNoneResponse, BetaManagedAgentsTokenEndpointAuthBasicResponse, BetaManagedAgentsTokenEndpointAuthPostResponse.
Use the BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsAny() anyBetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuth
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsTokenEndpointAuthNoneResponse:
case anthropic.BetaManagedAgentsTokenEndpointAuthBasicResponse:
case anthropic.BetaManagedAgentsTokenEndpointAuthPostResponse:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsClientSecretBasic ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsClientSecretBasic() (v BetaManagedAgentsTokenEndpointAuthBasicResponse)
func (BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsClientSecretPost ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) AsClientSecretPost() (v BetaManagedAgentsTokenEndpointAuthPostResponse)
func (BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthRefreshResponseTokenEndpointAuthUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthRefreshUpdateParams ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthRefreshUpdateParams struct {
// Updated OAuth refresh token.
RefreshToken param.Opt[string] `json:"refresh_token,omitzero"`
// Updated OAuth scope for the refresh request.
Scope param.Opt[string] `json:"scope,omitzero"`
// Updated HTTP Basic authentication parameters for the token endpoint.
TokenEndpointAuth BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion `json:"token_endpoint_auth,omitzero"`
// contains filtered or unexported fields
}
Parameters for updating OAuth refresh token configuration.
func (BetaManagedAgentsMCPOAuthRefreshUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPOAuthRefreshUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPOAuthRefreshUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthRefreshUpdateParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion struct {
OfClientSecretBasic *BetaManagedAgentsTokenEndpointAuthBasicUpdateParam `json:",omitzero,inline"`
OfClientSecretPost *BetaManagedAgentsTokenEndpointAuthPostUpdateParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) GetClientSecret ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) GetClientSecret() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsMCPOAuthRefreshUpdateParamsTokenEndpointAuthUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthUpdateParams ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthUpdateParams struct {
// Any of "mcp_oauth".
Type BetaManagedAgentsMCPOAuthUpdateParamsType `json:"type,omitzero" api:"required"`
// Updated OAuth access token.
AccessToken param.Opt[string] `json:"access_token,omitzero"`
// A timestamp in RFC 3339 format
ExpiresAt param.Opt[time.Time] `json:"expires_at,omitzero" format:"date-time"`
// Parameters for updating OAuth refresh token configuration.
Refresh BetaManagedAgentsMCPOAuthRefreshUpdateParams `json:"refresh,omitzero"`
// contains filtered or unexported fields
}
Parameters for updating an MCP OAuth credential. The `mcp_server_url` is immutable.
The property Type is required.
func (BetaManagedAgentsMCPOAuthUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPOAuthUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPOAuthUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPOAuthUpdateParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPOAuthUpdateParamsType ¶ added in v1.33.0
type BetaManagedAgentsMCPOAuthUpdateParamsType string
const (
BetaManagedAgentsMCPOAuthUpdateParamsTypeMCPOAuth BetaManagedAgentsMCPOAuthUpdateParamsType = "mcp_oauth"
)
type BetaManagedAgentsMCPServerURLDefinition ¶ added in v1.33.0
type BetaManagedAgentsMCPServerURLDefinition struct {
Name string `json:"name" api:"required"`
// Any of "url".
Type BetaManagedAgentsMCPServerURLDefinitionType `json:"type" api:"required"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
URL-based MCP server connection as returned in API responses.
func (BetaManagedAgentsMCPServerURLDefinition) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPServerURLDefinition) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPServerURLDefinition) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPServerURLDefinition) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPServerURLDefinitionType ¶ added in v1.33.0
type BetaManagedAgentsMCPServerURLDefinitionType string
const (
BetaManagedAgentsMCPServerURLDefinitionTypeURL BetaManagedAgentsMCPServerURLDefinitionType = "url"
)
type BetaManagedAgentsMCPToolConfig ¶ added in v1.33.0
type BetaManagedAgentsMCPToolConfig struct {
Enabled bool `json:"enabled" api:"required"`
Name string `json:"name" api:"required"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsMCPToolConfigPermissionPolicyUnion `json:"permission_policy" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Name respjson.Field
PermissionPolicy respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolved configuration for a specific MCP tool.
func (BetaManagedAgentsMCPToolConfig) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPToolConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPToolConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolConfigParams ¶ added in v1.33.0
type BetaManagedAgentsMCPToolConfigParams struct {
// Name of the MCP tool to configure. 1-128 characters.
Name string `json:"name" api:"required"`
// Whether this tool is enabled. Overrides the `default_config` setting.
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion `json:"permission_policy,omitzero"`
// contains filtered or unexported fields
}
Configuration override for a specific MCP tool.
The property Name is required.
func (BetaManagedAgentsMCPToolConfigParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPToolConfigParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPToolConfigParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolConfigParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion struct {
OfAlwaysAllow *BetaManagedAgentsAlwaysAllowPolicyParam `json:",omitzero,inline"`
OfAlwaysAsk *BetaManagedAgentsAlwaysAskPolicyParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsMCPToolConfigParamsPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolConfigPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPToolConfigPermissionPolicyUnion struct {
// Any of "always_allow", "always_ask".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsMCPToolConfigPermissionPolicyUnion contains all possible properties and values from BetaManagedAgentsAlwaysAllowPolicy, BetaManagedAgentsAlwaysAskPolicy.
Use the BetaManagedAgentsMCPToolConfigPermissionPolicyUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAlwaysAllow ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
func (BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAlwaysAsk ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
func (BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsMCPToolConfigPermissionPolicy
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsMCPToolConfigPermissionPolicyUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAlwaysAllowPolicy:
case anthropic.BetaManagedAgentsAlwaysAskPolicy:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolset ¶ added in v1.33.0
type BetaManagedAgentsMCPToolset struct {
Configs []BetaManagedAgentsMCPToolConfig `json:"configs" api:"required"`
// Resolved default configuration for all tools from an MCP server.
DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfig `json:"default_config" api:"required"`
MCPServerName string `json:"mcp_server_name" api:"required"`
// Any of "mcp_toolset".
Type BetaManagedAgentsMCPToolsetType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Configs respjson.Field
DefaultConfig respjson.Field
MCPServerName respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsMCPToolset) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPToolset) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPToolset) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolset) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolsetDefaultConfig ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetDefaultConfig struct {
Enabled bool `json:"enabled" api:"required"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion `json:"permission_policy" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
PermissionPolicy respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolved default configuration for all tools from an MCP server.
func (BetaManagedAgentsMCPToolsetDefaultConfig) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPToolsetDefaultConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPToolsetDefaultConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolsetDefaultConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolsetDefaultConfigParams ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetDefaultConfigParams struct {
// Whether tools are enabled by default. Defaults to true if not specified.
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// Permission policy for tool execution.
PermissionPolicy BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion `json:"permission_policy,omitzero"`
// contains filtered or unexported fields
}
Default configuration for all tools from an MCP server.
func (BetaManagedAgentsMCPToolsetDefaultConfigParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPToolsetDefaultConfigParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPToolsetDefaultConfigParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolsetDefaultConfigParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion struct {
OfAlwaysAllow *BetaManagedAgentsAlwaysAllowPolicyParam `json:",omitzero,inline"`
OfAlwaysAsk *BetaManagedAgentsAlwaysAskPolicyParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsMCPToolsetDefaultConfigParamsPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion struct {
// Any of "always_allow", "always_ask".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion contains all possible properties and values from BetaManagedAgentsAlwaysAllowPolicy, BetaManagedAgentsAlwaysAskPolicy.
Use the BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAllow ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAllow() (v BetaManagedAgentsAlwaysAllowPolicy)
func (BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAsk ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAlwaysAsk() (v BetaManagedAgentsAlwaysAskPolicy)
func (BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) AsAny() anyBetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicy
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAlwaysAllowPolicy:
case anthropic.BetaManagedAgentsAlwaysAskPolicy:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolsetParams ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetParams struct {
// Name of the MCP server. Must match a server name from the mcp_servers array.
// 1-255 characters.
MCPServerName string `json:"mcp_server_name" api:"required"`
// Any of "mcp_toolset".
Type BetaManagedAgentsMCPToolsetParamsType `json:"type,omitzero" api:"required"`
// Per-tool configuration overrides.
Configs []BetaManagedAgentsMCPToolConfigParams `json:"configs,omitzero"`
// Default configuration for all tools from an MCP server.
DefaultConfig BetaManagedAgentsMCPToolsetDefaultConfigParams `json:"default_config,omitzero"`
// contains filtered or unexported fields
}
Configuration for tools from an MCP server defined in `mcp_servers`.
The properties MCPServerName, Type are required.
func (BetaManagedAgentsMCPToolsetParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsMCPToolsetParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMCPToolsetParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsMCPToolsetParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMCPToolsetParamsType ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetParamsType string
const (
BetaManagedAgentsMCPToolsetParamsTypeMCPToolset BetaManagedAgentsMCPToolsetParamsType = "mcp_toolset"
)
type BetaManagedAgentsMCPToolsetType ¶ added in v1.33.0
type BetaManagedAgentsMCPToolsetType string
const (
BetaManagedAgentsMCPToolsetTypeMCPToolset BetaManagedAgentsMCPToolsetType = "mcp_toolset"
)
type BetaManagedAgentsMemory ¶ added in v1.38.0
type BetaManagedAgentsMemory struct {
ID string `json:"id" api:"required"`
ContentSha256 string `json:"content_sha256" api:"required"`
ContentSizeBytes int64 `json:"content_size_bytes" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
MemoryStoreID string `json:"memory_store_id" api:"required"`
MemoryVersionID string `json:"memory_version_id" api:"required"`
Path string `json:"path" api:"required"`
// Any of "memory".
Type BetaManagedAgentsMemoryType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
Content string `json:"content" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ContentSha256 respjson.Field
ContentSizeBytes respjson.Field
CreatedAt respjson.Field
MemoryStoreID respjson.Field
MemoryVersionID respjson.Field
Path respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
Content respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsMemory) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsMemory) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMemory) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemory) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryListItemUnion ¶ added in v1.38.0
type BetaManagedAgentsMemoryListItemUnion struct {
// This field is from variant [BetaManagedAgentsMemory].
ID string `json:"id"`
// This field is from variant [BetaManagedAgentsMemory].
ContentSha256 string `json:"content_sha256"`
// This field is from variant [BetaManagedAgentsMemory].
ContentSizeBytes int64 `json:"content_size_bytes"`
// This field is from variant [BetaManagedAgentsMemory].
CreatedAt time.Time `json:"created_at"`
// This field is from variant [BetaManagedAgentsMemory].
MemoryStoreID string `json:"memory_store_id"`
// This field is from variant [BetaManagedAgentsMemory].
MemoryVersionID string `json:"memory_version_id"`
Path string `json:"path"`
// Any of "memory", "memory_prefix".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsMemory].
UpdatedAt time.Time `json:"updated_at"`
// This field is from variant [BetaManagedAgentsMemory].
Content string `json:"content"`
JSON struct {
ID respjson.Field
ContentSha256 respjson.Field
ContentSizeBytes respjson.Field
CreatedAt respjson.Field
MemoryStoreID respjson.Field
MemoryVersionID respjson.Field
Path respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
Content respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsMemoryListItemUnion contains all possible properties and values from BetaManagedAgentsMemory, BetaManagedAgentsMemoryPrefix.
Use the BetaManagedAgentsMemoryListItemUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsMemoryListItemUnion) AsAny ¶ added in v1.38.0
func (u BetaManagedAgentsMemoryListItemUnion) AsAny() anyBetaManagedAgentsMemoryListItem
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsMemoryListItemUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsMemory:
case anthropic.BetaManagedAgentsMemoryPrefix:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsMemoryListItemUnion) AsMemory ¶ added in v1.38.0
func (u BetaManagedAgentsMemoryListItemUnion) AsMemory() (v BetaManagedAgentsMemory)
func (BetaManagedAgentsMemoryListItemUnion) AsMemoryPrefix ¶ added in v1.38.0
func (u BetaManagedAgentsMemoryListItemUnion) AsMemoryPrefix() (v BetaManagedAgentsMemoryPrefix)
func (BetaManagedAgentsMemoryListItemUnion) RawJSON ¶ added in v1.38.0
func (u BetaManagedAgentsMemoryListItemUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMemoryListItemUnion) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemoryListItemUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryPrefix ¶ added in v1.38.0
type BetaManagedAgentsMemoryPrefix struct {
Path string `json:"path" api:"required"`
// Any of "memory_prefix".
Type BetaManagedAgentsMemoryPrefixType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Path respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsMemoryPrefix) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsMemoryPrefix) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMemoryPrefix) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemoryPrefix) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryPrefixType ¶ added in v1.38.0
type BetaManagedAgentsMemoryPrefixType string
const (
BetaManagedAgentsMemoryPrefixTypeMemoryPrefix BetaManagedAgentsMemoryPrefixType = "memory_prefix"
)
type BetaManagedAgentsMemoryStore ¶ added in v1.38.0
type BetaManagedAgentsMemoryStore struct {
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
Name string `json:"name" api:"required"`
// Any of "memory_store".
Type BetaManagedAgentsMemoryStoreType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// A timestamp in RFC 3339 format
ArchivedAt time.Time `json:"archived_at" api:"nullable" format:"date-time"`
Description string `json:"description"`
Metadata map[string]string `json:"metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Name respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ArchivedAt respjson.Field
Description respjson.Field
Metadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsMemoryStore) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsMemoryStore) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMemoryStore) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemoryStore) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryStoreResource ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreResource struct {
// The memory store ID (memstore\_...). Must belong to the caller's organization
// and workspace.
MemoryStoreID string `json:"memory_store_id" api:"required"`
// Any of "memory_store".
Type BetaManagedAgentsMemoryStoreResourceType `json:"type" api:"required"`
// Access mode for an attached memory store.
//
// Any of "read_write", "read_only".
Access BetaManagedAgentsMemoryStoreResourceAccess `json:"access" api:"nullable"`
// Description of the memory store, snapshotted at attach time. Rendered into the
// agent's system prompt. Empty string when the store has no description.
Description string `json:"description"`
// Per-attachment guidance for the agent on how to use this store. Rendered into
// the memory section of the system prompt. Max 4096 chars.
Instructions string `json:"instructions" api:"nullable"`
// Filesystem path where the store is mounted in the session container, e.g.
// /mnt/memory/user-preferences. Derived from the store's name. Output-only.
MountPath string `json:"mount_path" api:"nullable"`
// Display name of the memory store, snapshotted at attach time. Later edits to the
// store's name do not propagate to this resource.
Name string `json:"name" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MemoryStoreID respjson.Field
Type respjson.Field
Access respjson.Field
Description respjson.Field
Instructions respjson.Field
MountPath respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A memory store attached to an agent session.
func (BetaManagedAgentsMemoryStoreResource) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsMemoryStoreResource) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMemoryStoreResource) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemoryStoreResource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryStoreResourceAccess ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreResourceAccess string
Access mode for an attached memory store.
const ( BetaManagedAgentsMemoryStoreResourceAccessReadWrite BetaManagedAgentsMemoryStoreResourceAccess = "read_write" BetaManagedAgentsMemoryStoreResourceAccessReadOnly BetaManagedAgentsMemoryStoreResourceAccess = "read_only" )
type BetaManagedAgentsMemoryStoreResourceParam ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreResourceParam struct {
// The memory store ID (memstore\_...). Must belong to the caller's organization
// and workspace.
MemoryStoreID string `json:"memory_store_id" api:"required"`
// Any of "memory_store".
Type BetaManagedAgentsMemoryStoreResourceParamType `json:"type,omitzero" api:"required"`
// Per-attachment guidance for the agent on how to use this store. Rendered into
// the memory section of the system prompt. Max 4096 chars.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Access mode for an attached memory store.
//
// Any of "read_write", "read_only".
Access BetaManagedAgentsMemoryStoreResourceParamAccess `json:"access,omitzero"`
// contains filtered or unexported fields
}
Parameters for attaching a memory store to an agent session.
The properties MemoryStoreID, Type are required.
func (BetaManagedAgentsMemoryStoreResourceParam) MarshalJSON ¶ added in v1.38.0
func (r BetaManagedAgentsMemoryStoreResourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsMemoryStoreResourceParam) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemoryStoreResourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryStoreResourceParamAccess ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreResourceParamAccess string
Access mode for an attached memory store.
const ( BetaManagedAgentsMemoryStoreResourceParamAccessReadWrite BetaManagedAgentsMemoryStoreResourceParamAccess = "read_write" BetaManagedAgentsMemoryStoreResourceParamAccessReadOnly BetaManagedAgentsMemoryStoreResourceParamAccess = "read_only" )
type BetaManagedAgentsMemoryStoreResourceParamType ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreResourceParamType string
const (
BetaManagedAgentsMemoryStoreResourceParamTypeMemoryStore BetaManagedAgentsMemoryStoreResourceParamType = "memory_store"
)
type BetaManagedAgentsMemoryStoreResourceType ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreResourceType string
const (
BetaManagedAgentsMemoryStoreResourceTypeMemoryStore BetaManagedAgentsMemoryStoreResourceType = "memory_store"
)
type BetaManagedAgentsMemoryStoreType ¶ added in v1.38.0
type BetaManagedAgentsMemoryStoreType string
const (
BetaManagedAgentsMemoryStoreTypeMemoryStore BetaManagedAgentsMemoryStoreType = "memory_store"
)
type BetaManagedAgentsMemoryType ¶ added in v1.38.0
type BetaManagedAgentsMemoryType string
const (
BetaManagedAgentsMemoryTypeMemory BetaManagedAgentsMemoryType = "memory"
)
type BetaManagedAgentsMemoryVersion ¶ added in v1.38.0
type BetaManagedAgentsMemoryVersion struct {
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
MemoryID string `json:"memory_id" api:"required"`
MemoryStoreID string `json:"memory_store_id" api:"required"`
// MemoryVersionOperation enum
//
// Any of "created", "modified", "deleted".
Operation BetaManagedAgentsMemoryVersionOperation `json:"operation" api:"required"`
// Any of "memory_version".
Type BetaManagedAgentsMemoryVersionType `json:"type" api:"required"`
Content string `json:"content" api:"nullable"`
ContentSha256 string `json:"content_sha256" api:"nullable"`
ContentSizeBytes int64 `json:"content_size_bytes" api:"nullable"`
CreatedBy BetaManagedAgentsActorUnion `json:"created_by"`
Path string `json:"path" api:"nullable"`
// A timestamp in RFC 3339 format
RedactedAt time.Time `json:"redacted_at" api:"nullable" format:"date-time"`
RedactedBy BetaManagedAgentsActorUnion `json:"redacted_by"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
MemoryID respjson.Field
MemoryStoreID respjson.Field
Operation respjson.Field
Type respjson.Field
Content respjson.Field
ContentSha256 respjson.Field
ContentSizeBytes respjson.Field
CreatedBy respjson.Field
Path respjson.Field
RedactedAt respjson.Field
RedactedBy respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsMemoryVersion) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsMemoryVersion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsMemoryVersion) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsMemoryVersion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsMemoryVersionOperation ¶ added in v1.38.0
type BetaManagedAgentsMemoryVersionOperation string
MemoryVersionOperation enum
const ( BetaManagedAgentsMemoryVersionOperationCreated BetaManagedAgentsMemoryVersionOperation = "created" BetaManagedAgentsMemoryVersionOperationModified BetaManagedAgentsMemoryVersionOperation = "modified" BetaManagedAgentsMemoryVersionOperationDeleted BetaManagedAgentsMemoryVersionOperation = "deleted" )
type BetaManagedAgentsMemoryVersionType ¶ added in v1.38.0
type BetaManagedAgentsMemoryVersionType string
const (
BetaManagedAgentsMemoryVersionTypeMemoryVersion BetaManagedAgentsMemoryVersionType = "memory_version"
)
type BetaManagedAgentsMemoryView ¶ added in v1.38.0
type BetaManagedAgentsMemoryView string
MemoryView enum
const ( BetaManagedAgentsMemoryViewBasic BetaManagedAgentsMemoryView = "basic" BetaManagedAgentsMemoryViewFull BetaManagedAgentsMemoryView = "full" )
type BetaManagedAgentsModel ¶ added in v1.33.0
type BetaManagedAgentsModel = string
The model that will power your agent.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
const ( BetaManagedAgentsModelClaudeOpus4_7 BetaManagedAgentsModel = "claude-opus-4-7" BetaManagedAgentsModelClaudeOpus4_6 BetaManagedAgentsModel = "claude-opus-4-6" BetaManagedAgentsModelClaudeSonnet4_6 BetaManagedAgentsModel = "claude-sonnet-4-6" BetaManagedAgentsModelClaudeHaiku4_5 BetaManagedAgentsModel = "claude-haiku-4-5" BetaManagedAgentsModelClaudeHaiku4_5_20251001 BetaManagedAgentsModel = "claude-haiku-4-5-20251001" BetaManagedAgentsModelClaudeOpus4_5 BetaManagedAgentsModel = "claude-opus-4-5" BetaManagedAgentsModelClaudeOpus4_5_20251101 BetaManagedAgentsModel = "claude-opus-4-5-20251101" BetaManagedAgentsModelClaudeSonnet4_5 BetaManagedAgentsModel = "claude-sonnet-4-5" BetaManagedAgentsModelClaudeSonnet4_5_20250929 BetaManagedAgentsModel = "claude-sonnet-4-5-20250929" )
type BetaManagedAgentsModelConfig ¶ added in v1.33.0
type BetaManagedAgentsModelConfig struct {
// The model that will power your agent.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
ID BetaManagedAgentsModel `json:"id" api:"required"`
// Inference speed mode. `fast` provides significantly faster output token
// generation at premium pricing. Not all models support `fast`; invalid
// combinations are rejected at create time.
//
// Any of "standard", "fast".
Speed BetaManagedAgentsModelConfigSpeed `json:"speed"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Speed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Model identifier and configuration.
func (BetaManagedAgentsModelConfig) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsModelConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelConfigParams ¶ added in v1.33.0
type BetaManagedAgentsModelConfigParams struct {
// The model that will power your agent.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
ID BetaManagedAgentsModel `json:"id,omitzero" api:"required"`
// Inference speed mode. `fast` provides significantly faster output token
// generation at premium pricing. Not all models support `fast`; invalid
// combinations are rejected at create time.
//
// Any of "standard", "fast".
Speed BetaManagedAgentsModelConfigParamsSpeed `json:"speed,omitzero"`
// contains filtered or unexported fields
}
An object that defines additional configuration control over model use
The property ID is required.
func (BetaManagedAgentsModelConfigParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsModelConfigParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsModelConfigParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelConfigParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelConfigParamsSpeed ¶ added in v1.33.0
type BetaManagedAgentsModelConfigParamsSpeed string
Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
const ( BetaManagedAgentsModelConfigParamsSpeedStandard BetaManagedAgentsModelConfigParamsSpeed = "standard" BetaManagedAgentsModelConfigParamsSpeedFast BetaManagedAgentsModelConfigParamsSpeed = "fast" )
type BetaManagedAgentsModelConfigSpeed ¶ added in v1.33.0
type BetaManagedAgentsModelConfigSpeed string
Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
const ( BetaManagedAgentsModelConfigSpeedStandard BetaManagedAgentsModelConfigSpeed = "standard" BetaManagedAgentsModelConfigSpeedFast BetaManagedAgentsModelConfigSpeed = "fast" )
type BetaManagedAgentsModelOverloadedError ¶ added in v1.33.0
type BetaManagedAgentsModelOverloadedError struct {
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsModelOverloadedErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "model_overloaded_error".
Type BetaManagedAgentsModelOverloadedErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The model is currently overloaded. Emitted after automatic retries are exhausted.
func (BetaManagedAgentsModelOverloadedError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsModelOverloadedError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelOverloadedError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelOverloadedError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelOverloadedErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsModelOverloadedErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsModelOverloadedErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsModelOverloadedErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsModelOverloadedErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsModelOverloadedErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelOverloadedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelOverloadedErrorType ¶ added in v1.33.0
type BetaManagedAgentsModelOverloadedErrorType string
const (
BetaManagedAgentsModelOverloadedErrorTypeModelOverloadedError BetaManagedAgentsModelOverloadedErrorType = "model_overloaded_error"
)
type BetaManagedAgentsModelRateLimitedError ¶ added in v1.33.0
type BetaManagedAgentsModelRateLimitedError struct {
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "model_rate_limited_error".
Type BetaManagedAgentsModelRateLimitedErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The model request was rate-limited.
func (BetaManagedAgentsModelRateLimitedError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsModelRateLimitedError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelRateLimitedError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelRateLimitedError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsModelRateLimitedErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelRateLimitedErrorType ¶ added in v1.33.0
type BetaManagedAgentsModelRateLimitedErrorType string
const (
BetaManagedAgentsModelRateLimitedErrorTypeModelRateLimitedError BetaManagedAgentsModelRateLimitedErrorType = "model_rate_limited_error"
)
type BetaManagedAgentsModelRequestFailedError ¶ added in v1.33.0
type BetaManagedAgentsModelRequestFailedError struct {
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "model_request_failed_error".
Type BetaManagedAgentsModelRequestFailedErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A model request failed for a reason other than overload or rate-limiting.
func (BetaManagedAgentsModelRequestFailedError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsModelRequestFailedError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelRequestFailedError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelRequestFailedError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsModelRequestFailedErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsModelRequestFailedErrorType ¶ added in v1.33.0
type BetaManagedAgentsModelRequestFailedErrorType string
const (
BetaManagedAgentsModelRequestFailedErrorTypeModelRequestFailedError BetaManagedAgentsModelRequestFailedErrorType = "model_request_failed_error"
)
type BetaManagedAgentsPlainTextDocumentSource ¶ added in v1.33.0
type BetaManagedAgentsPlainTextDocumentSource struct {
// The plain text content.
Data string `json:"data" api:"required"`
// MIME type of the text content. Must be "text/plain".
//
// Any of "text/plain".
MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType `json:"media_type" api:"required"`
// Any of "text".
Type BetaManagedAgentsPlainTextDocumentSourceType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Plain text document content.
func (BetaManagedAgentsPlainTextDocumentSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsPlainTextDocumentSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsPlainTextDocumentSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsPlainTextDocumentSource) ToParam() BetaManagedAgentsPlainTextDocumentSourceParam
ToParam converts this BetaManagedAgentsPlainTextDocumentSource to a BetaManagedAgentsPlainTextDocumentSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsPlainTextDocumentSourceParam.Overrides()
func (*BetaManagedAgentsPlainTextDocumentSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsPlainTextDocumentSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsPlainTextDocumentSourceMediaType ¶ added in v1.33.0
type BetaManagedAgentsPlainTextDocumentSourceMediaType string
MIME type of the text content. Must be "text/plain".
const (
BetaManagedAgentsPlainTextDocumentSourceMediaTypeTextPlain BetaManagedAgentsPlainTextDocumentSourceMediaType = "text/plain"
)
type BetaManagedAgentsPlainTextDocumentSourceParam ¶ added in v1.33.0
type BetaManagedAgentsPlainTextDocumentSourceParam struct {
// The plain text content.
Data string `json:"data" api:"required"`
// MIME type of the text content. Must be "text/plain".
//
// Any of "text/plain".
MediaType BetaManagedAgentsPlainTextDocumentSourceMediaType `json:"media_type,omitzero" api:"required"`
// Any of "text".
Type BetaManagedAgentsPlainTextDocumentSourceType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Plain text document content.
The properties Data, MediaType, Type are required.
func (BetaManagedAgentsPlainTextDocumentSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsPlainTextDocumentSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsPlainTextDocumentSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsPlainTextDocumentSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsPlainTextDocumentSourceType ¶ added in v1.33.0
type BetaManagedAgentsPlainTextDocumentSourceType string
const (
BetaManagedAgentsPlainTextDocumentSourceTypeText BetaManagedAgentsPlainTextDocumentSourceType = "text"
)
type BetaManagedAgentsPreconditionParam ¶ added in v1.38.0
type BetaManagedAgentsPreconditionParam struct {
// Any of "content_sha256".
Type BetaManagedAgentsPreconditionType `json:"type,omitzero" api:"required"`
ContentSha256 param.Opt[string] `json:"content_sha256,omitzero"`
// contains filtered or unexported fields
}
The property Type is required.
func (BetaManagedAgentsPreconditionParam) MarshalJSON ¶ added in v1.38.0
func (r BetaManagedAgentsPreconditionParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsPreconditionParam) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsPreconditionParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsPreconditionType ¶ added in v1.38.0
type BetaManagedAgentsPreconditionType string
const (
BetaManagedAgentsPreconditionTypeContentSha256 BetaManagedAgentsPreconditionType = "content_sha256"
)
type BetaManagedAgentsRetryStatusExhausted ¶ added in v1.33.0
type BetaManagedAgentsRetryStatusExhausted struct {
// Any of "exhausted".
Type BetaManagedAgentsRetryStatusExhaustedType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.
func (BetaManagedAgentsRetryStatusExhausted) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsRetryStatusExhausted) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsRetryStatusExhausted) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsRetryStatusExhausted) UnmarshalJSON(data []byte) error
type BetaManagedAgentsRetryStatusExhaustedType ¶ added in v1.33.0
type BetaManagedAgentsRetryStatusExhaustedType string
const (
BetaManagedAgentsRetryStatusExhaustedTypeExhausted BetaManagedAgentsRetryStatusExhaustedType = "exhausted"
)
type BetaManagedAgentsRetryStatusRetrying ¶ added in v1.33.0
type BetaManagedAgentsRetryStatusRetrying struct {
// Any of "retrying".
Type BetaManagedAgentsRetryStatusRetryingType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.
func (BetaManagedAgentsRetryStatusRetrying) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsRetryStatusRetrying) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsRetryStatusRetrying) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsRetryStatusRetrying) UnmarshalJSON(data []byte) error
type BetaManagedAgentsRetryStatusRetryingType ¶ added in v1.33.0
type BetaManagedAgentsRetryStatusRetryingType string
const (
BetaManagedAgentsRetryStatusRetryingTypeRetrying BetaManagedAgentsRetryStatusRetryingType = "retrying"
)
type BetaManagedAgentsRetryStatusTerminal ¶ added in v1.33.0
type BetaManagedAgentsRetryStatusTerminal struct {
// Any of "terminal".
Type BetaManagedAgentsRetryStatusTerminalType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The session encountered a terminal error and will transition to `terminated` state.
func (BetaManagedAgentsRetryStatusTerminal) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsRetryStatusTerminal) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsRetryStatusTerminal) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsRetryStatusTerminal) UnmarshalJSON(data []byte) error
type BetaManagedAgentsRetryStatusTerminalType ¶ added in v1.33.0
type BetaManagedAgentsRetryStatusTerminalType string
const (
BetaManagedAgentsRetryStatusTerminalTypeTerminal BetaManagedAgentsRetryStatusTerminalType = "terminal"
)
type BetaManagedAgentsSendSessionEvents ¶ added in v1.33.0
type BetaManagedAgentsSendSessionEvents struct {
// Sent events
Data []BetaManagedAgentsSendSessionEventsDataUnion `json:"data"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Events that were successfully sent to the session.
func (BetaManagedAgentsSendSessionEvents) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSendSessionEvents) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSendSessionEvents) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSendSessionEvents) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSendSessionEventsDataUnion ¶ added in v1.33.0
type BetaManagedAgentsSendSessionEventsDataUnion struct {
ID string `json:"id"`
// This field is a union of [[]BetaManagedAgentsUserMessageEventContentUnion],
// [[]BetaManagedAgentsUserCustomToolResultEventContentUnion]
Content BetaManagedAgentsSendSessionEventsDataUnionContent `json:"content"`
// Any of "user.message", "user.interrupt", "user.tool_confirmation",
// "user.custom_tool_result".
Type string `json:"type"`
ProcessedAt time.Time `json:"processed_at"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
Result BetaManagedAgentsUserToolConfirmationEventResult `json:"result"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
ToolUseID string `json:"tool_use_id"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
DenyMessage string `json:"deny_message"`
// This field is from variant [BetaManagedAgentsUserCustomToolResultEvent].
CustomToolUseID string `json:"custom_tool_use_id"`
// This field is from variant [BetaManagedAgentsUserCustomToolResultEvent].
IsError bool `json:"is_error"`
JSON struct {
ID respjson.Field
Content respjson.Field
Type respjson.Field
ProcessedAt respjson.Field
Result respjson.Field
ToolUseID respjson.Field
DenyMessage respjson.Field
CustomToolUseID respjson.Field
IsError respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSendSessionEventsDataUnion contains all possible properties and values from BetaManagedAgentsUserMessageEvent, BetaManagedAgentsUserInterruptEvent, BetaManagedAgentsUserToolConfirmationEvent, BetaManagedAgentsUserCustomToolResultEvent.
Use the BetaManagedAgentsSendSessionEventsDataUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSendSessionEventsDataUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSendSessionEventsDataUnion) AsAny() anyBetaManagedAgentsSendSessionEventsData
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSendSessionEventsDataUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsUserMessageEvent:
case anthropic.BetaManagedAgentsUserInterruptEvent:
case anthropic.BetaManagedAgentsUserToolConfirmationEvent:
case anthropic.BetaManagedAgentsUserCustomToolResultEvent:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSendSessionEventsDataUnion) AsUserCustomToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserCustomToolResult() (v BetaManagedAgentsUserCustomToolResultEvent)
func (BetaManagedAgentsSendSessionEventsDataUnion) AsUserInterrupt ¶ added in v1.33.0
func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserInterrupt() (v BetaManagedAgentsUserInterruptEvent)
func (BetaManagedAgentsSendSessionEventsDataUnion) AsUserMessage ¶ added in v1.33.0
func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserMessage() (v BetaManagedAgentsUserMessageEvent)
func (BetaManagedAgentsSendSessionEventsDataUnion) AsUserToolConfirmation ¶ added in v1.33.0
func (u BetaManagedAgentsSendSessionEventsDataUnion) AsUserToolConfirmation() (v BetaManagedAgentsUserToolConfirmationEvent)
func (BetaManagedAgentsSendSessionEventsDataUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSendSessionEventsDataUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSendSessionEventsDataUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSendSessionEventsDataUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSendSessionEventsDataUnionContent ¶ added in v1.33.0
type BetaManagedAgentsSendSessionEventsDataUnionContent struct {
// This field will be present if the value is a
// [[]BetaManagedAgentsUserMessageEventContentUnion] instead of an object.
OfBetaManagedAgentsUserMessageEventContentArray []BetaManagedAgentsUserMessageEventContentUnion `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsUserCustomToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsUserCustomToolResultEventContentArray []BetaManagedAgentsUserCustomToolResultEventContentUnion `json:",inline"`
JSON struct {
OfBetaManagedAgentsUserMessageEventContentArray respjson.Field
OfBetaManagedAgentsUserCustomToolResultEventContentArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSendSessionEventsDataUnionContent is an implicit subunion of BetaManagedAgentsSendSessionEventsDataUnion. BetaManagedAgentsSendSessionEventsDataUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsSendSessionEventsDataUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaManagedAgentsUserMessageEventContentArray OfBetaManagedAgentsUserCustomToolResultEventContentArray]
func (*BetaManagedAgentsSendSessionEventsDataUnionContent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSendSessionEventsDataUnionContent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSession ¶ added in v1.33.0
type BetaManagedAgentsSession struct {
ID string `json:"id" api:"required"`
// Resolved `agent` definition for a `session`. Snapshot of the `agent` at
// `session` creation time.
Agent BetaManagedAgentsSessionAgent `json:"agent" api:"required"`
// A timestamp in RFC 3339 format
ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
EnvironmentID string `json:"environment_id" api:"required"`
Metadata map[string]string `json:"metadata" api:"required"`
Resources []BetaManagedAgentsSessionResourceUnion `json:"resources" api:"required"`
// Timing statistics for a session.
Stats BetaManagedAgentsSessionStats `json:"stats" api:"required"`
// SessionStatus enum
//
// Any of "rescheduling", "running", "idle", "terminated".
Status BetaManagedAgentsSessionStatus `json:"status" api:"required"`
Title string `json:"title" api:"required"`
// Any of "session".
Type BetaManagedAgentsSessionType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Cumulative token usage for a session across all turns.
Usage BetaManagedAgentsSessionUsage `json:"usage" api:"required"`
// Vault IDs attached to the session at creation. Empty when no vaults were
// supplied.
VaultIDs []string `json:"vault_ids" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Agent respjson.Field
ArchivedAt respjson.Field
CreatedAt respjson.Field
EnvironmentID respjson.Field
Metadata respjson.Field
Resources respjson.Field
Stats respjson.Field
Status respjson.Field
Title respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
Usage respjson.Field
VaultIDs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A Managed Agents `session`.
func (BetaManagedAgentsSession) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSession) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSession) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSession) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionActor ¶ added in v1.38.0
type BetaManagedAgentsSessionActor struct {
SessionID string `json:"session_id" api:"required"`
// Any of "session_actor".
Type BetaManagedAgentsSessionActorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
SessionID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsSessionActor) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsSessionActor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionActor) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsSessionActor) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionActorType ¶ added in v1.38.0
type BetaManagedAgentsSessionActorType string
const (
BetaManagedAgentsSessionActorTypeSessionActor BetaManagedAgentsSessionActorType = "session_actor"
)
type BetaManagedAgentsSessionAgent ¶ added in v1.33.0
type BetaManagedAgentsSessionAgent struct {
ID string `json:"id" api:"required"`
Description string `json:"description" api:"required"`
MCPServers []BetaManagedAgentsMCPServerURLDefinition `json:"mcp_servers" api:"required"`
// Model identifier and configuration.
Model BetaManagedAgentsModelConfig `json:"model" api:"required"`
Name string `json:"name" api:"required"`
Skills []BetaManagedAgentsSessionAgentSkillUnion `json:"skills" api:"required"`
System string `json:"system" api:"required"`
Tools []BetaManagedAgentsSessionAgentToolUnion `json:"tools" api:"required"`
// Any of "agent".
Type BetaManagedAgentsSessionAgentType `json:"type" api:"required"`
Version int64 `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Description respjson.Field
MCPServers respjson.Field
Model respjson.Field
Name respjson.Field
Skills respjson.Field
System respjson.Field
Tools respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
func (BetaManagedAgentsSessionAgent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionAgent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionAgent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionAgent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionAgentSkillUnion ¶ added in v1.33.0
type BetaManagedAgentsSessionAgentSkillUnion struct {
SkillID string `json:"skill_id"`
// Any of "anthropic", "custom".
Type string `json:"type"`
Version string `json:"version"`
JSON struct {
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionAgentSkillUnion contains all possible properties and values from BetaManagedAgentsAnthropicSkill, BetaManagedAgentsCustomSkill.
Use the BetaManagedAgentsSessionAgentSkillUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSessionAgentSkillUnion) AsAnthropic ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentSkillUnion) AsAnthropic() (v BetaManagedAgentsAnthropicSkill)
func (BetaManagedAgentsSessionAgentSkillUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentSkillUnion) AsAny() anyBetaManagedAgentsSessionAgentSkill
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSessionAgentSkillUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAnthropicSkill:
case anthropic.BetaManagedAgentsCustomSkill:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSessionAgentSkillUnion) AsCustom ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentSkillUnion) AsCustom() (v BetaManagedAgentsCustomSkill)
func (BetaManagedAgentsSessionAgentSkillUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentSkillUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionAgentSkillUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionAgentSkillUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionAgentToolUnion ¶ added in v1.33.0
type BetaManagedAgentsSessionAgentToolUnion struct {
// This field is a union of [[]BetaManagedAgentsAgentToolConfig],
// [[]BetaManagedAgentsMCPToolConfig]
Configs BetaManagedAgentsSessionAgentToolUnionConfigs `json:"configs"`
// This field is a union of [BetaManagedAgentsAgentToolsetDefaultConfig],
// [BetaManagedAgentsMCPToolsetDefaultConfig]
DefaultConfig BetaManagedAgentsSessionAgentToolUnionDefaultConfig `json:"default_config"`
// Any of "agent_toolset_20260401", "mcp_toolset", "custom".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsMCPToolset].
MCPServerName string `json:"mcp_server_name"`
// This field is from variant [BetaManagedAgentsCustomTool].
Description string `json:"description"`
// This field is from variant [BetaManagedAgentsCustomTool].
InputSchema BetaManagedAgentsCustomToolInputSchema `json:"input_schema"`
// This field is from variant [BetaManagedAgentsCustomTool].
Name string `json:"name"`
JSON struct {
Configs respjson.Field
DefaultConfig respjson.Field
Type respjson.Field
MCPServerName respjson.Field
Description respjson.Field
InputSchema respjson.Field
Name respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionAgentToolUnion contains all possible properties and values from BetaManagedAgentsAgentToolset20260401, BetaManagedAgentsMCPToolset, BetaManagedAgentsCustomTool.
Use the BetaManagedAgentsSessionAgentToolUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSessionAgentToolUnion) AsAgentToolset20260401 ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentToolUnion) AsAgentToolset20260401() (v BetaManagedAgentsAgentToolset20260401)
func (BetaManagedAgentsSessionAgentToolUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentToolUnion) AsAny() anyBetaManagedAgentsSessionAgentTool
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSessionAgentToolUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsAgentToolset20260401:
case anthropic.BetaManagedAgentsMCPToolset:
case anthropic.BetaManagedAgentsCustomTool:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSessionAgentToolUnion) AsCustom ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentToolUnion) AsCustom() (v BetaManagedAgentsCustomTool)
func (BetaManagedAgentsSessionAgentToolUnion) AsMCPToolset ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentToolUnion) AsMCPToolset() (v BetaManagedAgentsMCPToolset)
func (BetaManagedAgentsSessionAgentToolUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSessionAgentToolUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionAgentToolUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionAgentToolUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionAgentToolUnionConfigs ¶ added in v1.33.0
type BetaManagedAgentsSessionAgentToolUnionConfigs struct {
// This field will be present if the value is a
// [[]BetaManagedAgentsAgentToolConfig] instead of an object.
OfBetaManagedAgentsAgentToolConfigArray []BetaManagedAgentsAgentToolConfig `json:",inline"`
// This field will be present if the value is a [[]BetaManagedAgentsMCPToolConfig]
// instead of an object.
OfBetaManagedAgentsMCPToolConfigArray []BetaManagedAgentsMCPToolConfig `json:",inline"`
JSON struct {
OfBetaManagedAgentsAgentToolConfigArray respjson.Field
OfBetaManagedAgentsMCPToolConfigArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionAgentToolUnionConfigs is an implicit subunion of BetaManagedAgentsSessionAgentToolUnion. BetaManagedAgentsSessionAgentToolUnionConfigs provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsSessionAgentToolUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaManagedAgentsAgentToolConfigArray OfBetaManagedAgentsMCPToolConfigArray]
func (*BetaManagedAgentsSessionAgentToolUnionConfigs) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionAgentToolUnionConfigs) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionAgentToolUnionDefaultConfig ¶ added in v1.33.0
type BetaManagedAgentsSessionAgentToolUnionDefaultConfig struct {
Enabled bool `json:"enabled"`
// This field is a union of
// [BetaManagedAgentsAgentToolsetDefaultConfigPermissionPolicyUnion],
// [BetaManagedAgentsMCPToolsetDefaultConfigPermissionPolicyUnion]
PermissionPolicy BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy `json:"permission_policy"`
JSON struct {
Enabled respjson.Field
PermissionPolicy respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionAgentToolUnionDefaultConfig is an implicit subunion of BetaManagedAgentsSessionAgentToolUnion. BetaManagedAgentsSessionAgentToolUnionDefaultConfig provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsSessionAgentToolUnion.
func (*BetaManagedAgentsSessionAgentToolUnionDefaultConfig) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionAgentToolUnionDefaultConfig) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy ¶ added in v1.33.0
type BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy struct {
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy is an implicit subunion of BetaManagedAgentsSessionAgentToolUnion. BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsSessionAgentToolUnion.
func (*BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionAgentToolUnionDefaultConfigPermissionPolicy) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionAgentType ¶ added in v1.33.0
type BetaManagedAgentsSessionAgentType string
const (
BetaManagedAgentsSessionAgentTypeAgent BetaManagedAgentsSessionAgentType = "agent"
)
type BetaManagedAgentsSessionDeletedEvent ¶ added in v1.33.0
type BetaManagedAgentsSessionDeletedEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "session.deleted".
Type BetaManagedAgentsSessionDeletedEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.
func (BetaManagedAgentsSessionDeletedEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionDeletedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionDeletedEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionDeletedEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionDeletedEventType ¶ added in v1.33.0
type BetaManagedAgentsSessionDeletedEventType string
const (
BetaManagedAgentsSessionDeletedEventTypeSessionDeleted BetaManagedAgentsSessionDeletedEventType = "session.deleted"
)
type BetaManagedAgentsSessionEndTurn ¶ added in v1.33.0
type BetaManagedAgentsSessionEndTurn struct {
// Any of "end_turn".
Type BetaManagedAgentsSessionEndTurnType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The agent completed its turn naturally and is ready for the next user message.
func (BetaManagedAgentsSessionEndTurn) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionEndTurn) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionEndTurn) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionEndTurn) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionEndTurnType ¶ added in v1.33.0
type BetaManagedAgentsSessionEndTurnType string
const (
BetaManagedAgentsSessionEndTurnTypeEndTurn BetaManagedAgentsSessionEndTurnType = "end_turn"
)
type BetaManagedAgentsSessionErrorEvent ¶ added in v1.33.0
type BetaManagedAgentsSessionErrorEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// An unknown or unexpected error occurred during session execution. A fallback
// variant; clients that don't recognize a new error code can match on
// `retry_status` and `message` alone.
Error BetaManagedAgentsSessionErrorEventErrorUnion `json:"error" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "session.error".
Type BetaManagedAgentsSessionErrorEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Error respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An error event indicating a problem occurred during session execution.
func (BetaManagedAgentsSessionErrorEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionErrorEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionErrorEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionErrorEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionErrorEventErrorUnion ¶ added in v1.33.0
type BetaManagedAgentsSessionErrorEventErrorUnion struct {
Message string `json:"message"`
// This field is a union of [BetaManagedAgentsUnknownErrorRetryStatusUnion],
// [BetaManagedAgentsModelOverloadedErrorRetryStatusUnion],
// [BetaManagedAgentsModelRateLimitedErrorRetryStatusUnion],
// [BetaManagedAgentsModelRequestFailedErrorRetryStatusUnion],
// [BetaManagedAgentsMCPConnectionFailedErrorRetryStatusUnion],
// [BetaManagedAgentsMCPAuthenticationFailedErrorRetryStatusUnion],
// [BetaManagedAgentsBillingErrorRetryStatusUnion]
RetryStatus BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus `json:"retry_status"`
// Any of "unknown_error", "model_overloaded_error", "model_rate_limited_error",
// "model_request_failed_error", "mcp_connection_failed_error",
// "mcp_authentication_failed_error", "billing_error".
Type string `json:"type"`
MCPServerName string `json:"mcp_server_name"`
JSON struct {
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
MCPServerName respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionErrorEventErrorUnion contains all possible properties and values from BetaManagedAgentsUnknownError, BetaManagedAgentsModelOverloadedError, BetaManagedAgentsModelRateLimitedError, BetaManagedAgentsModelRequestFailedError, BetaManagedAgentsMCPConnectionFailedError, BetaManagedAgentsMCPAuthenticationFailedError, BetaManagedAgentsBillingError.
Use the BetaManagedAgentsSessionErrorEventErrorUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsAny() anyBetaManagedAgentsSessionErrorEventError
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSessionErrorEventErrorUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsUnknownError:
case anthropic.BetaManagedAgentsModelOverloadedError:
case anthropic.BetaManagedAgentsModelRateLimitedError:
case anthropic.BetaManagedAgentsModelRequestFailedError:
case anthropic.BetaManagedAgentsMCPConnectionFailedError:
case anthropic.BetaManagedAgentsMCPAuthenticationFailedError:
case anthropic.BetaManagedAgentsBillingError:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsBillingError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsBillingError() (v BetaManagedAgentsBillingError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsMCPAuthenticationFailedError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsMCPAuthenticationFailedError() (v BetaManagedAgentsMCPAuthenticationFailedError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsMCPConnectionFailedError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsMCPConnectionFailedError() (v BetaManagedAgentsMCPConnectionFailedError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsModelOverloadedError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsModelOverloadedError() (v BetaManagedAgentsModelOverloadedError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsModelRateLimitedError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsModelRateLimitedError() (v BetaManagedAgentsModelRateLimitedError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsModelRequestFailedError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsModelRequestFailedError() (v BetaManagedAgentsModelRequestFailedError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) AsUnknownError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) AsUnknownError() (v BetaManagedAgentsUnknownError)
func (BetaManagedAgentsSessionErrorEventErrorUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSessionErrorEventErrorUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionErrorEventErrorUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionErrorEventErrorUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus ¶ added in v1.33.0
type BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus struct {
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus is an implicit subunion of BetaManagedAgentsSessionErrorEventErrorUnion. BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsSessionErrorEventErrorUnion.
func (*BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionErrorEventErrorUnionRetryStatus) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionErrorEventType ¶ added in v1.33.0
type BetaManagedAgentsSessionErrorEventType string
const (
BetaManagedAgentsSessionErrorEventTypeSessionError BetaManagedAgentsSessionErrorEventType = "session.error"
)
type BetaManagedAgentsSessionEventUnion ¶ added in v1.33.0
type BetaManagedAgentsSessionEventUnion struct {
ID string `json:"id"`
// This field is a union of [[]BetaManagedAgentsUserMessageEventContentUnion],
// [[]BetaManagedAgentsUserCustomToolResultEventContentUnion],
// [[]BetaManagedAgentsTextBlock],
// [[]BetaManagedAgentsAgentMCPToolResultEventContentUnion],
// [[]BetaManagedAgentsAgentToolResultEventContentUnion]
Content BetaManagedAgentsSessionEventUnionContent `json:"content"`
// Any of "user.message", "user.interrupt", "user.tool_confirmation",
// "user.custom_tool_result", "agent.custom_tool_use", "agent.message",
// "agent.thinking", "agent.mcp_tool_use", "agent.mcp_tool_result",
// "agent.tool_use", "agent.tool_result", "agent.thread_context_compacted",
// "session.error", "session.status_rescheduled", "session.status_running",
// "session.status_idle", "session.status_terminated", "span.model_request_start",
// "span.model_request_end", "session.deleted".
Type string `json:"type"`
ProcessedAt time.Time `json:"processed_at"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
Result BetaManagedAgentsUserToolConfirmationEventResult `json:"result"`
ToolUseID string `json:"tool_use_id"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
DenyMessage string `json:"deny_message"`
// This field is from variant [BetaManagedAgentsUserCustomToolResultEvent].
CustomToolUseID string `json:"custom_tool_use_id"`
IsError bool `json:"is_error"`
Input any `json:"input"`
Name string `json:"name"`
// This field is from variant [BetaManagedAgentsAgentMCPToolUseEvent].
MCPServerName string `json:"mcp_server_name"`
EvaluatedPermission string `json:"evaluated_permission"`
// This field is from variant [BetaManagedAgentsAgentMCPToolResultEvent].
MCPToolUseID string `json:"mcp_tool_use_id"`
// This field is from variant [BetaManagedAgentsSessionErrorEvent].
Error BetaManagedAgentsSessionErrorEventErrorUnion `json:"error"`
// This field is from variant [BetaManagedAgentsSessionStatusIdleEvent].
StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion `json:"stop_reason"`
// This field is from variant [BetaManagedAgentsSpanModelRequestEndEvent].
ModelRequestStartID string `json:"model_request_start_id"`
// This field is from variant [BetaManagedAgentsSpanModelRequestEndEvent].
ModelUsage BetaManagedAgentsSpanModelUsage `json:"model_usage"`
JSON struct {
ID respjson.Field
Content respjson.Field
Type respjson.Field
ProcessedAt respjson.Field
Result respjson.Field
ToolUseID respjson.Field
DenyMessage respjson.Field
CustomToolUseID respjson.Field
IsError respjson.Field
Input respjson.Field
Name respjson.Field
MCPServerName respjson.Field
EvaluatedPermission respjson.Field
MCPToolUseID respjson.Field
Error respjson.Field
StopReason respjson.Field
ModelRequestStartID respjson.Field
ModelUsage respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionEventUnion contains all possible properties and values from BetaManagedAgentsUserMessageEvent, BetaManagedAgentsUserInterruptEvent, BetaManagedAgentsUserToolConfirmationEvent, BetaManagedAgentsUserCustomToolResultEvent, BetaManagedAgentsAgentCustomToolUseEvent, BetaManagedAgentsAgentMessageEvent, BetaManagedAgentsAgentThinkingEvent, BetaManagedAgentsAgentMCPToolUseEvent, BetaManagedAgentsAgentMCPToolResultEvent, BetaManagedAgentsAgentToolUseEvent, BetaManagedAgentsAgentToolResultEvent, BetaManagedAgentsAgentThreadContextCompactedEvent, BetaManagedAgentsSessionErrorEvent, BetaManagedAgentsSessionStatusRescheduledEvent, BetaManagedAgentsSessionStatusRunningEvent, BetaManagedAgentsSessionStatusIdleEvent, BetaManagedAgentsSessionStatusTerminatedEvent, BetaManagedAgentsSpanModelRequestStartEvent, BetaManagedAgentsSpanModelRequestEndEvent, BetaManagedAgentsSessionDeletedEvent.
Use the BetaManagedAgentsSessionEventUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSessionEventUnion) AsAgentCustomToolUse ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentCustomToolUse() (v BetaManagedAgentsAgentCustomToolUseEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentMCPToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentMCPToolResult() (v BetaManagedAgentsAgentMCPToolResultEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentMCPToolUse ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentMCPToolUse() (v BetaManagedAgentsAgentMCPToolUseEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentMessage ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentMessage() (v BetaManagedAgentsAgentMessageEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentThinking ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentThinking() (v BetaManagedAgentsAgentThinkingEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentThreadContextCompacted ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentThreadContextCompacted() (v BetaManagedAgentsAgentThreadContextCompactedEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentToolResult() (v BetaManagedAgentsAgentToolResultEvent)
func (BetaManagedAgentsSessionEventUnion) AsAgentToolUse ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAgentToolUse() (v BetaManagedAgentsAgentToolUseEvent)
func (BetaManagedAgentsSessionEventUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsAny() anyBetaManagedAgentsSessionEvent
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSessionEventUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsUserMessageEvent:
case anthropic.BetaManagedAgentsUserInterruptEvent:
case anthropic.BetaManagedAgentsUserToolConfirmationEvent:
case anthropic.BetaManagedAgentsUserCustomToolResultEvent:
case anthropic.BetaManagedAgentsAgentCustomToolUseEvent:
case anthropic.BetaManagedAgentsAgentMessageEvent:
case anthropic.BetaManagedAgentsAgentThinkingEvent:
case anthropic.BetaManagedAgentsAgentMCPToolUseEvent:
case anthropic.BetaManagedAgentsAgentMCPToolResultEvent:
case anthropic.BetaManagedAgentsAgentToolUseEvent:
case anthropic.BetaManagedAgentsAgentToolResultEvent:
case anthropic.BetaManagedAgentsAgentThreadContextCompactedEvent:
case anthropic.BetaManagedAgentsSessionErrorEvent:
case anthropic.BetaManagedAgentsSessionStatusRescheduledEvent:
case anthropic.BetaManagedAgentsSessionStatusRunningEvent:
case anthropic.BetaManagedAgentsSessionStatusIdleEvent:
case anthropic.BetaManagedAgentsSessionStatusTerminatedEvent:
case anthropic.BetaManagedAgentsSpanModelRequestStartEvent:
case anthropic.BetaManagedAgentsSpanModelRequestEndEvent:
case anthropic.BetaManagedAgentsSessionDeletedEvent:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSessionEventUnion) AsSessionDeleted ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSessionDeleted() (v BetaManagedAgentsSessionDeletedEvent)
func (BetaManagedAgentsSessionEventUnion) AsSessionError ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSessionError() (v BetaManagedAgentsSessionErrorEvent)
func (BetaManagedAgentsSessionEventUnion) AsSessionStatusIdle ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusIdle() (v BetaManagedAgentsSessionStatusIdleEvent)
func (BetaManagedAgentsSessionEventUnion) AsSessionStatusRescheduled ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusRescheduled() (v BetaManagedAgentsSessionStatusRescheduledEvent)
func (BetaManagedAgentsSessionEventUnion) AsSessionStatusRunning ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusRunning() (v BetaManagedAgentsSessionStatusRunningEvent)
func (BetaManagedAgentsSessionEventUnion) AsSessionStatusTerminated ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSessionStatusTerminated() (v BetaManagedAgentsSessionStatusTerminatedEvent)
func (BetaManagedAgentsSessionEventUnion) AsSpanModelRequestEnd ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSpanModelRequestEnd() (v BetaManagedAgentsSpanModelRequestEndEvent)
func (BetaManagedAgentsSessionEventUnion) AsSpanModelRequestStart ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsSpanModelRequestStart() (v BetaManagedAgentsSpanModelRequestStartEvent)
func (BetaManagedAgentsSessionEventUnion) AsUserCustomToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsUserCustomToolResult() (v BetaManagedAgentsUserCustomToolResultEvent)
func (BetaManagedAgentsSessionEventUnion) AsUserInterrupt ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsUserInterrupt() (v BetaManagedAgentsUserInterruptEvent)
func (BetaManagedAgentsSessionEventUnion) AsUserMessage ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsUserMessage() (v BetaManagedAgentsUserMessageEvent)
func (BetaManagedAgentsSessionEventUnion) AsUserToolConfirmation ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) AsUserToolConfirmation() (v BetaManagedAgentsUserToolConfirmationEvent)
func (BetaManagedAgentsSessionEventUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSessionEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionEventUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionEventUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionEventUnionContent ¶ added in v1.33.0
type BetaManagedAgentsSessionEventUnionContent struct {
// This field will be present if the value is a
// [[]BetaManagedAgentsUserMessageEventContentUnion] instead of an object.
OfBetaManagedAgentsUserMessageEventContentArray []BetaManagedAgentsUserMessageEventContentUnion `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsUserCustomToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsUserCustomToolResultEventContentArray []BetaManagedAgentsUserCustomToolResultEventContentUnion `json:",inline"`
// This field will be present if the value is a [[]BetaManagedAgentsTextBlock]
// instead of an object.
OfBetaManagedAgentsTextBlockArray []BetaManagedAgentsTextBlock `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsAgentMCPToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsAgentMCPToolResultEventContentArray []BetaManagedAgentsAgentMCPToolResultEventContentUnion `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsAgentToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsAgentToolResultEventContentArray []BetaManagedAgentsAgentToolResultEventContentUnion `json:",inline"`
JSON struct {
OfBetaManagedAgentsUserMessageEventContentArray respjson.Field
OfBetaManagedAgentsUserCustomToolResultEventContentArray respjson.Field
OfBetaManagedAgentsTextBlockArray respjson.Field
OfBetaManagedAgentsAgentMCPToolResultEventContentArray respjson.Field
OfBetaManagedAgentsAgentToolResultEventContentArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionEventUnionContent is an implicit subunion of BetaManagedAgentsSessionEventUnion. BetaManagedAgentsSessionEventUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsSessionEventUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaManagedAgentsUserMessageEventContentArray OfBetaManagedAgentsUserCustomToolResultEventContentArray OfBetaManagedAgentsTextBlockArray OfBetaManagedAgentsAgentMCPToolResultEventContentArray OfBetaManagedAgentsAgentToolResultEventContentArray]
func (*BetaManagedAgentsSessionEventUnionContent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionEventUnionContent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionRequiresAction ¶ added in v1.33.0
type BetaManagedAgentsSessionRequiresAction struct {
// The ids of events the agent is blocked on. Resolving fewer than all re-emits
// `session.status_idle` with the remainder.
EventIDs []string `json:"event_ids" api:"required"`
// Any of "requires_action".
Type BetaManagedAgentsSessionRequiresActionType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EventIDs respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.
func (BetaManagedAgentsSessionRequiresAction) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionRequiresAction) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionRequiresAction) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionRequiresAction) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionRequiresActionType ¶ added in v1.33.0
type BetaManagedAgentsSessionRequiresActionType string
const (
BetaManagedAgentsSessionRequiresActionTypeRequiresAction BetaManagedAgentsSessionRequiresActionType = "requires_action"
)
type BetaManagedAgentsSessionResourceUnion ¶ added in v1.33.0
type BetaManagedAgentsSessionResourceUnion struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
MountPath string `json:"mount_path"`
// Any of "github_repository", "file", "memory_store".
Type string `json:"type"`
UpdatedAt time.Time `json:"updated_at"`
// This field is from variant [BetaManagedAgentsGitHubRepositoryResource].
URL string `json:"url"`
// This field is from variant [BetaManagedAgentsGitHubRepositoryResource].
Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion `json:"checkout"`
// This field is from variant [BetaManagedAgentsFileResource].
FileID string `json:"file_id"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
MemoryStoreID string `json:"memory_store_id"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Access BetaManagedAgentsMemoryStoreResourceAccess `json:"access"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Description string `json:"description"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Instructions string `json:"instructions"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Name string `json:"name"`
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
MountPath respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
URL respjson.Field
Checkout respjson.Field
FileID respjson.Field
MemoryStoreID respjson.Field
Access respjson.Field
Description respjson.Field
Instructions respjson.Field
Name respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionResourceUnion contains all possible properties and values from BetaManagedAgentsGitHubRepositoryResource, BetaManagedAgentsFileResource, BetaManagedAgentsMemoryStoreResource.
Use the BetaManagedAgentsSessionResourceUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSessionResourceUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSessionResourceUnion) AsAny() anyBetaManagedAgentsSessionResource
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSessionResourceUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsGitHubRepositoryResource:
case anthropic.BetaManagedAgentsFileResource:
case anthropic.BetaManagedAgentsMemoryStoreResource:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSessionResourceUnion) AsFile ¶ added in v1.33.0
func (u BetaManagedAgentsSessionResourceUnion) AsFile() (v BetaManagedAgentsFileResource)
func (BetaManagedAgentsSessionResourceUnion) AsGitHubRepository ¶ added in v1.33.0
func (u BetaManagedAgentsSessionResourceUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResource)
func (BetaManagedAgentsSessionResourceUnion) AsMemoryStore ¶ added in v1.38.0
func (u BetaManagedAgentsSessionResourceUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResource)
func (BetaManagedAgentsSessionResourceUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSessionResourceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionResourceUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionResourceUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionRetriesExhausted ¶ added in v1.33.0
type BetaManagedAgentsSessionRetriesExhausted struct {
// Any of "retries_exhausted".
Type BetaManagedAgentsSessionRetriesExhaustedType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`).
func (BetaManagedAgentsSessionRetriesExhausted) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionRetriesExhausted) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionRetriesExhausted) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionRetriesExhausted) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionRetriesExhaustedType ¶ added in v1.33.0
type BetaManagedAgentsSessionRetriesExhaustedType string
const (
BetaManagedAgentsSessionRetriesExhaustedTypeRetriesExhausted BetaManagedAgentsSessionRetriesExhaustedType = "retries_exhausted"
)
type BetaManagedAgentsSessionStats ¶ added in v1.33.0
type BetaManagedAgentsSessionStats struct {
// Cumulative time in seconds the session spent in running status. Excludes idle
// time.
ActiveSeconds float64 `json:"active_seconds"`
// Elapsed time since session creation in seconds. For terminated sessions, frozen
// at the final update.
DurationSeconds float64 `json:"duration_seconds"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ActiveSeconds respjson.Field
DurationSeconds respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Timing statistics for a session.
func (BetaManagedAgentsSessionStats) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionStats) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionStats) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionStats) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionStatus ¶ added in v1.33.0
type BetaManagedAgentsSessionStatus string
SessionStatus enum
const ( BetaManagedAgentsSessionStatusRescheduling BetaManagedAgentsSessionStatus = "rescheduling" BetaManagedAgentsSessionStatusRunning BetaManagedAgentsSessionStatus = "running" BetaManagedAgentsSessionStatusIdle BetaManagedAgentsSessionStatus = "idle" BetaManagedAgentsSessionStatusTerminated BetaManagedAgentsSessionStatus = "terminated" )
type BetaManagedAgentsSessionStatusIdleEvent ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusIdleEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// The agent completed its turn naturally and is ready for the next user message.
StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion `json:"stop_reason" api:"required"`
// Any of "session.status_idle".
Type BetaManagedAgentsSessionStatusIdleEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
StopReason respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates the agent has paused and is awaiting user input.
func (BetaManagedAgentsSessionStatusIdleEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionStatusIdleEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionStatusIdleEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionStatusIdleEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionStatusIdleEventStopReasonUnion ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusIdleEventStopReasonUnion struct {
// Any of "end_turn", "requires_action", "retries_exhausted".
Type string `json:"type"`
// This field is from variant [BetaManagedAgentsSessionRequiresAction].
EventIDs []string `json:"event_ids"`
JSON struct {
Type respjson.Field
EventIDs respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsSessionStatusIdleEventStopReasonUnion contains all possible properties and values from BetaManagedAgentsSessionEndTurn, BetaManagedAgentsSessionRequiresAction, BetaManagedAgentsSessionRetriesExhausted.
Use the BetaManagedAgentsSessionStatusIdleEventStopReasonUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsAny() anyBetaManagedAgentsSessionStatusIdleEventStopReason
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsSessionStatusIdleEventStopReasonUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsSessionEndTurn:
case anthropic.BetaManagedAgentsSessionRequiresAction:
case anthropic.BetaManagedAgentsSessionRetriesExhausted:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsEndTurn ¶ added in v1.33.0
func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsEndTurn() (v BetaManagedAgentsSessionEndTurn)
func (BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsRequiresAction ¶ added in v1.33.0
func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsRequiresAction() (v BetaManagedAgentsSessionRequiresAction)
func (BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsRetriesExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) AsRetriesExhausted() (v BetaManagedAgentsSessionRetriesExhausted)
func (BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionStatusIdleEventStopReasonUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionStatusIdleEventType ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusIdleEventType string
const (
BetaManagedAgentsSessionStatusIdleEventTypeSessionStatusIdle BetaManagedAgentsSessionStatusIdleEventType = "session.status_idle"
)
type BetaManagedAgentsSessionStatusRescheduledEvent ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusRescheduledEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "session.status_rescheduled".
Type BetaManagedAgentsSessionStatusRescheduledEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates the session is recovering from an error state and is rescheduled for execution.
func (BetaManagedAgentsSessionStatusRescheduledEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionStatusRescheduledEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionStatusRescheduledEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionStatusRescheduledEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionStatusRescheduledEventType ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusRescheduledEventType string
const (
BetaManagedAgentsSessionStatusRescheduledEventTypeSessionStatusRescheduled BetaManagedAgentsSessionStatusRescheduledEventType = "session.status_rescheduled"
)
type BetaManagedAgentsSessionStatusRunningEvent ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusRunningEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "session.status_running".
Type BetaManagedAgentsSessionStatusRunningEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates the session is actively running and the agent is working.
func (BetaManagedAgentsSessionStatusRunningEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionStatusRunningEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionStatusRunningEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionStatusRunningEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionStatusRunningEventType ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusRunningEventType string
const (
BetaManagedAgentsSessionStatusRunningEventTypeSessionStatusRunning BetaManagedAgentsSessionStatusRunningEventType = "session.status_running"
)
type BetaManagedAgentsSessionStatusTerminatedEvent ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusTerminatedEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "session.status_terminated".
Type BetaManagedAgentsSessionStatusTerminatedEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates the session has terminated, either due to an error or completion.
func (BetaManagedAgentsSessionStatusTerminatedEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionStatusTerminatedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionStatusTerminatedEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionStatusTerminatedEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSessionStatusTerminatedEventType ¶ added in v1.33.0
type BetaManagedAgentsSessionStatusTerminatedEventType string
const (
BetaManagedAgentsSessionStatusTerminatedEventTypeSessionStatusTerminated BetaManagedAgentsSessionStatusTerminatedEventType = "session.status_terminated"
)
type BetaManagedAgentsSessionType ¶ added in v1.33.0
type BetaManagedAgentsSessionType string
const (
BetaManagedAgentsSessionTypeSession BetaManagedAgentsSessionType = "session"
)
type BetaManagedAgentsSessionUsage ¶ added in v1.33.0
type BetaManagedAgentsSessionUsage struct {
// Prompt-cache creation token usage broken down by cache lifetime.
CacheCreation BetaManagedAgentsCacheCreationUsage `json:"cache_creation"`
// Total tokens read from prompt cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens"`
// Total input tokens consumed across all turns.
InputTokens int64 `json:"input_tokens"`
// Total output tokens generated across all turns.
OutputTokens int64 `json:"output_tokens"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreation respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Cumulative token usage for a session across all turns.
func (BetaManagedAgentsSessionUsage) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSessionUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSessionUsage) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSessionUsage) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSkillParamsUnion ¶ added in v1.33.0
type BetaManagedAgentsSkillParamsUnion struct {
OfAnthropic *BetaManagedAgentsAnthropicSkillParams `json:",omitzero,inline"`
OfCustom *BetaManagedAgentsCustomSkillParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaManagedAgentsSkillParamsOfAnthropic ¶ added in v1.33.0
func BetaManagedAgentsSkillParamsOfAnthropic(skillID string) BetaManagedAgentsSkillParamsUnion
func BetaManagedAgentsSkillParamsOfCustom ¶ added in v1.33.0
func BetaManagedAgentsSkillParamsOfCustom(skillID string) BetaManagedAgentsSkillParamsUnion
func (BetaManagedAgentsSkillParamsUnion) GetSkillID ¶ added in v1.33.0
func (u BetaManagedAgentsSkillParamsUnion) GetSkillID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsSkillParamsUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsSkillParamsUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsSkillParamsUnion) GetVersion ¶ added in v1.33.0
func (u BetaManagedAgentsSkillParamsUnion) GetVersion() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsSkillParamsUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsSkillParamsUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsSkillParamsUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsSkillParamsUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSpanModelRequestEndEvent ¶ added in v1.33.0
type BetaManagedAgentsSpanModelRequestEndEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Whether the model request resulted in an error.
IsError bool `json:"is_error" api:"required"`
// The id of the corresponding `span.model_request_start` event.
ModelRequestStartID string `json:"model_request_start_id" api:"required"`
// Token usage for a single model request.
ModelUsage BetaManagedAgentsSpanModelUsage `json:"model_usage" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "span.model_request_end".
Type BetaManagedAgentsSpanModelRequestEndEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
IsError respjson.Field
ModelRequestStartID respjson.Field
ModelUsage respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Emitted when a model request completes.
func (BetaManagedAgentsSpanModelRequestEndEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSpanModelRequestEndEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSpanModelRequestEndEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSpanModelRequestEndEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSpanModelRequestEndEventType ¶ added in v1.33.0
type BetaManagedAgentsSpanModelRequestEndEventType string
const (
BetaManagedAgentsSpanModelRequestEndEventTypeSpanModelRequestEnd BetaManagedAgentsSpanModelRequestEndEventType = "span.model_request_end"
)
type BetaManagedAgentsSpanModelRequestStartEvent ¶ added in v1.33.0
type BetaManagedAgentsSpanModelRequestStartEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"required" format:"date-time"`
// Any of "span.model_request_start".
Type BetaManagedAgentsSpanModelRequestStartEventType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ProcessedAt respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Emitted when a model request is initiated by the agent.
func (BetaManagedAgentsSpanModelRequestStartEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSpanModelRequestStartEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSpanModelRequestStartEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSpanModelRequestStartEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSpanModelRequestStartEventType ¶ added in v1.33.0
type BetaManagedAgentsSpanModelRequestStartEventType string
const (
BetaManagedAgentsSpanModelRequestStartEventTypeSpanModelRequestStart BetaManagedAgentsSpanModelRequestStartEventType = "span.model_request_start"
)
type BetaManagedAgentsSpanModelUsage ¶ added in v1.33.0
type BetaManagedAgentsSpanModelUsage struct {
// Tokens used to create prompt cache in this request.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// Tokens read from prompt cache in this request.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// Input tokens consumed by this request.
InputTokens int64 `json:"input_tokens" api:"required"`
// Output tokens generated by this request.
OutputTokens int64 `json:"output_tokens" api:"required"`
// Inference speed mode. `fast` provides significantly faster output token
// generation at premium pricing. Not all models support `fast`; invalid
// combinations are rejected at create time.
//
// Any of "standard", "fast".
Speed BetaManagedAgentsSpanModelUsageSpeed `json:"speed" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
Speed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token usage for a single model request.
func (BetaManagedAgentsSpanModelUsage) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsSpanModelUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsSpanModelUsage) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsSpanModelUsage) UnmarshalJSON(data []byte) error
type BetaManagedAgentsSpanModelUsageSpeed ¶ added in v1.33.0
type BetaManagedAgentsSpanModelUsageSpeed string
Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
const ( BetaManagedAgentsSpanModelUsageSpeedStandard BetaManagedAgentsSpanModelUsageSpeed = "standard" BetaManagedAgentsSpanModelUsageSpeedFast BetaManagedAgentsSpanModelUsageSpeed = "fast" )
type BetaManagedAgentsStaticBearerAuthResponse ¶ added in v1.33.0
type BetaManagedAgentsStaticBearerAuthResponse struct {
// URL of the MCP server this credential authenticates against.
MCPServerURL string `json:"mcp_server_url" api:"required"`
// Any of "static_bearer".
Type BetaManagedAgentsStaticBearerAuthResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MCPServerURL respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Static bearer token credential details for an MCP server.
func (BetaManagedAgentsStaticBearerAuthResponse) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsStaticBearerAuthResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsStaticBearerAuthResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsStaticBearerAuthResponse) UnmarshalJSON(data []byte) error
type BetaManagedAgentsStaticBearerAuthResponseType ¶ added in v1.33.0
type BetaManagedAgentsStaticBearerAuthResponseType string
const (
BetaManagedAgentsStaticBearerAuthResponseTypeStaticBearer BetaManagedAgentsStaticBearerAuthResponseType = "static_bearer"
)
type BetaManagedAgentsStaticBearerCreateParams ¶ added in v1.33.0
type BetaManagedAgentsStaticBearerCreateParams struct {
// Static bearer token value.
Token string `json:"token" api:"required"`
// URL of the MCP server this credential authenticates against.
MCPServerURL string `json:"mcp_server_url" api:"required"`
// Any of "static_bearer".
Type BetaManagedAgentsStaticBearerCreateParamsType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Parameters for creating a static bearer token credential.
The properties Token, MCPServerURL, Type are required.
func (BetaManagedAgentsStaticBearerCreateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsStaticBearerCreateParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsStaticBearerCreateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsStaticBearerCreateParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsStaticBearerCreateParamsType ¶ added in v1.33.0
type BetaManagedAgentsStaticBearerCreateParamsType string
const (
BetaManagedAgentsStaticBearerCreateParamsTypeStaticBearer BetaManagedAgentsStaticBearerCreateParamsType = "static_bearer"
)
type BetaManagedAgentsStaticBearerUpdateParams ¶ added in v1.33.0
type BetaManagedAgentsStaticBearerUpdateParams struct {
// Any of "static_bearer".
Type BetaManagedAgentsStaticBearerUpdateParamsType `json:"type,omitzero" api:"required"`
// Updated static bearer token value.
Token param.Opt[string] `json:"token,omitzero"`
// contains filtered or unexported fields
}
Parameters for updating a static bearer token credential. The `mcp_server_url` is immutable.
The property Type is required.
func (BetaManagedAgentsStaticBearerUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsStaticBearerUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsStaticBearerUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsStaticBearerUpdateParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsStaticBearerUpdateParamsType ¶ added in v1.33.0
type BetaManagedAgentsStaticBearerUpdateParamsType string
const (
BetaManagedAgentsStaticBearerUpdateParamsTypeStaticBearer BetaManagedAgentsStaticBearerUpdateParamsType = "static_bearer"
)
type BetaManagedAgentsStreamSessionEventsUnion ¶ added in v1.33.0
type BetaManagedAgentsStreamSessionEventsUnion struct {
ID string `json:"id"`
// This field is a union of [[]BetaManagedAgentsUserMessageEventContentUnion],
// [[]BetaManagedAgentsUserCustomToolResultEventContentUnion],
// [[]BetaManagedAgentsTextBlock],
// [[]BetaManagedAgentsAgentMCPToolResultEventContentUnion],
// [[]BetaManagedAgentsAgentToolResultEventContentUnion]
Content BetaManagedAgentsStreamSessionEventsUnionContent `json:"content"`
// Any of "user.message", "user.interrupt", "user.tool_confirmation",
// "user.custom_tool_result", "agent.custom_tool_use", "agent.message",
// "agent.thinking", "agent.mcp_tool_use", "agent.mcp_tool_result",
// "agent.tool_use", "agent.tool_result", "agent.thread_context_compacted",
// "session.error", "session.status_rescheduled", "session.status_running",
// "session.status_idle", "session.status_terminated", "span.model_request_start",
// "span.model_request_end", "session.deleted".
Type string `json:"type"`
ProcessedAt time.Time `json:"processed_at"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
Result BetaManagedAgentsUserToolConfirmationEventResult `json:"result"`
ToolUseID string `json:"tool_use_id"`
// This field is from variant [BetaManagedAgentsUserToolConfirmationEvent].
DenyMessage string `json:"deny_message"`
// This field is from variant [BetaManagedAgentsUserCustomToolResultEvent].
CustomToolUseID string `json:"custom_tool_use_id"`
IsError bool `json:"is_error"`
Input any `json:"input"`
Name string `json:"name"`
// This field is from variant [BetaManagedAgentsAgentMCPToolUseEvent].
MCPServerName string `json:"mcp_server_name"`
EvaluatedPermission string `json:"evaluated_permission"`
// This field is from variant [BetaManagedAgentsAgentMCPToolResultEvent].
MCPToolUseID string `json:"mcp_tool_use_id"`
// This field is from variant [BetaManagedAgentsSessionErrorEvent].
Error BetaManagedAgentsSessionErrorEventErrorUnion `json:"error"`
// This field is from variant [BetaManagedAgentsSessionStatusIdleEvent].
StopReason BetaManagedAgentsSessionStatusIdleEventStopReasonUnion `json:"stop_reason"`
// This field is from variant [BetaManagedAgentsSpanModelRequestEndEvent].
ModelRequestStartID string `json:"model_request_start_id"`
// This field is from variant [BetaManagedAgentsSpanModelRequestEndEvent].
ModelUsage BetaManagedAgentsSpanModelUsage `json:"model_usage"`
JSON struct {
ID respjson.Field
Content respjson.Field
Type respjson.Field
ProcessedAt respjson.Field
Result respjson.Field
ToolUseID respjson.Field
DenyMessage respjson.Field
CustomToolUseID respjson.Field
IsError respjson.Field
Input respjson.Field
Name respjson.Field
MCPServerName respjson.Field
EvaluatedPermission respjson.Field
MCPToolUseID respjson.Field
Error respjson.Field
StopReason respjson.Field
ModelRequestStartID respjson.Field
ModelUsage respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsStreamSessionEventsUnion contains all possible properties and values from BetaManagedAgentsUserMessageEvent, BetaManagedAgentsUserInterruptEvent, BetaManagedAgentsUserToolConfirmationEvent, BetaManagedAgentsUserCustomToolResultEvent, BetaManagedAgentsAgentCustomToolUseEvent, BetaManagedAgentsAgentMessageEvent, BetaManagedAgentsAgentThinkingEvent, BetaManagedAgentsAgentMCPToolUseEvent, BetaManagedAgentsAgentMCPToolResultEvent, BetaManagedAgentsAgentToolUseEvent, BetaManagedAgentsAgentToolResultEvent, BetaManagedAgentsAgentThreadContextCompactedEvent, BetaManagedAgentsSessionErrorEvent, BetaManagedAgentsSessionStatusRescheduledEvent, BetaManagedAgentsSessionStatusRunningEvent, BetaManagedAgentsSessionStatusIdleEvent, BetaManagedAgentsSessionStatusTerminatedEvent, BetaManagedAgentsSpanModelRequestStartEvent, BetaManagedAgentsSpanModelRequestEndEvent, BetaManagedAgentsSessionDeletedEvent.
Use the BetaManagedAgentsStreamSessionEventsUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentCustomToolUse ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentCustomToolUse() (v BetaManagedAgentsAgentCustomToolUseEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentMCPToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentMCPToolResult() (v BetaManagedAgentsAgentMCPToolResultEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentMCPToolUse ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentMCPToolUse() (v BetaManagedAgentsAgentMCPToolUseEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentMessage ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentMessage() (v BetaManagedAgentsAgentMessageEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentThinking ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentThinking() (v BetaManagedAgentsAgentThinkingEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentThreadContextCompacted ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentThreadContextCompacted() (v BetaManagedAgentsAgentThreadContextCompactedEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentToolResult() (v BetaManagedAgentsAgentToolResultEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAgentToolUse ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAgentToolUse() (v BetaManagedAgentsAgentToolUseEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsAny() anyBetaManagedAgentsStreamSessionEvents
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsStreamSessionEventsUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsUserMessageEvent:
case anthropic.BetaManagedAgentsUserInterruptEvent:
case anthropic.BetaManagedAgentsUserToolConfirmationEvent:
case anthropic.BetaManagedAgentsUserCustomToolResultEvent:
case anthropic.BetaManagedAgentsAgentCustomToolUseEvent:
case anthropic.BetaManagedAgentsAgentMessageEvent:
case anthropic.BetaManagedAgentsAgentThinkingEvent:
case anthropic.BetaManagedAgentsAgentMCPToolUseEvent:
case anthropic.BetaManagedAgentsAgentMCPToolResultEvent:
case anthropic.BetaManagedAgentsAgentToolUseEvent:
case anthropic.BetaManagedAgentsAgentToolResultEvent:
case anthropic.BetaManagedAgentsAgentThreadContextCompactedEvent:
case anthropic.BetaManagedAgentsSessionErrorEvent:
case anthropic.BetaManagedAgentsSessionStatusRescheduledEvent:
case anthropic.BetaManagedAgentsSessionStatusRunningEvent:
case anthropic.BetaManagedAgentsSessionStatusIdleEvent:
case anthropic.BetaManagedAgentsSessionStatusTerminatedEvent:
case anthropic.BetaManagedAgentsSpanModelRequestStartEvent:
case anthropic.BetaManagedAgentsSpanModelRequestEndEvent:
case anthropic.BetaManagedAgentsSessionDeletedEvent:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsStreamSessionEventsUnion) AsSessionDeleted ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionDeleted() (v BetaManagedAgentsSessionDeletedEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSessionError ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionError() (v BetaManagedAgentsSessionErrorEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusIdle ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusIdle() (v BetaManagedAgentsSessionStatusIdleEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusRescheduled ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusRescheduled() (v BetaManagedAgentsSessionStatusRescheduledEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusRunning ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusRunning() (v BetaManagedAgentsSessionStatusRunningEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusTerminated ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSessionStatusTerminated() (v BetaManagedAgentsSessionStatusTerminatedEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSpanModelRequestEnd ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSpanModelRequestEnd() (v BetaManagedAgentsSpanModelRequestEndEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsSpanModelRequestStart ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsSpanModelRequestStart() (v BetaManagedAgentsSpanModelRequestStartEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsUserCustomToolResult ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserCustomToolResult() (v BetaManagedAgentsUserCustomToolResultEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsUserInterrupt ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserInterrupt() (v BetaManagedAgentsUserInterruptEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsUserMessage ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserMessage() (v BetaManagedAgentsUserMessageEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) AsUserToolConfirmation ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) AsUserToolConfirmation() (v BetaManagedAgentsUserToolConfirmationEvent)
func (BetaManagedAgentsStreamSessionEventsUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsStreamSessionEventsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsStreamSessionEventsUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsStreamSessionEventsUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsStreamSessionEventsUnionContent ¶ added in v1.33.0
type BetaManagedAgentsStreamSessionEventsUnionContent struct {
// This field will be present if the value is a
// [[]BetaManagedAgentsUserMessageEventContentUnion] instead of an object.
OfBetaManagedAgentsUserMessageEventContentArray []BetaManagedAgentsUserMessageEventContentUnion `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsUserCustomToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsUserCustomToolResultEventContentArray []BetaManagedAgentsUserCustomToolResultEventContentUnion `json:",inline"`
// This field will be present if the value is a [[]BetaManagedAgentsTextBlock]
// instead of an object.
OfBetaManagedAgentsTextBlockArray []BetaManagedAgentsTextBlock `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsAgentMCPToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsAgentMCPToolResultEventContentArray []BetaManagedAgentsAgentMCPToolResultEventContentUnion `json:",inline"`
// This field will be present if the value is a
// [[]BetaManagedAgentsAgentToolResultEventContentUnion] instead of an object.
OfBetaManagedAgentsAgentToolResultEventContentArray []BetaManagedAgentsAgentToolResultEventContentUnion `json:",inline"`
JSON struct {
OfBetaManagedAgentsUserMessageEventContentArray respjson.Field
OfBetaManagedAgentsUserCustomToolResultEventContentArray respjson.Field
OfBetaManagedAgentsTextBlockArray respjson.Field
OfBetaManagedAgentsAgentMCPToolResultEventContentArray respjson.Field
OfBetaManagedAgentsAgentToolResultEventContentArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsStreamSessionEventsUnionContent is an implicit subunion of BetaManagedAgentsStreamSessionEventsUnion. BetaManagedAgentsStreamSessionEventsUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsStreamSessionEventsUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaManagedAgentsUserMessageEventContentArray OfBetaManagedAgentsUserCustomToolResultEventContentArray OfBetaManagedAgentsTextBlockArray OfBetaManagedAgentsAgentMCPToolResultEventContentArray OfBetaManagedAgentsAgentToolResultEventContentArray]
func (*BetaManagedAgentsStreamSessionEventsUnionContent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsStreamSessionEventsUnionContent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTextBlock ¶ added in v1.33.0
type BetaManagedAgentsTextBlock struct {
// The text content.
Text string `json:"text" api:"required"`
// Any of "text".
Type BetaManagedAgentsTextBlockType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Regular text content.
func (BetaManagedAgentsTextBlock) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTextBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsTextBlock) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsTextBlock) ToParam() BetaManagedAgentsTextBlockParam
ToParam converts this BetaManagedAgentsTextBlock to a BetaManagedAgentsTextBlockParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsTextBlockParam.Overrides()
func (*BetaManagedAgentsTextBlock) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTextBlock) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTextBlockParam ¶ added in v1.33.0
type BetaManagedAgentsTextBlockParam struct {
// The text content.
Text string `json:"text" api:"required"`
// Any of "text".
Type BetaManagedAgentsTextBlockType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Regular text content.
The properties Text, Type are required.
func (BetaManagedAgentsTextBlockParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTextBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsTextBlockParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTextBlockParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTextBlockType ¶ added in v1.33.0
type BetaManagedAgentsTextBlockType string
const (
BetaManagedAgentsTextBlockTypeText BetaManagedAgentsTextBlockType = "text"
)
type BetaManagedAgentsTokenEndpointAuthBasicParam ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthBasicParam struct {
// OAuth client secret.
ClientSecret string `json:"client_secret" api:"required"`
// Any of "client_secret_basic".
Type BetaManagedAgentsTokenEndpointAuthBasicParamType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Token endpoint uses HTTP Basic authentication with client credentials.
The properties ClientSecret, Type are required.
func (BetaManagedAgentsTokenEndpointAuthBasicParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthBasicParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsTokenEndpointAuthBasicParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthBasicParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthBasicParamType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthBasicParamType string
const (
BetaManagedAgentsTokenEndpointAuthBasicParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicParamType = "client_secret_basic"
)
type BetaManagedAgentsTokenEndpointAuthBasicResponse ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthBasicResponse struct {
// Any of "client_secret_basic".
Type BetaManagedAgentsTokenEndpointAuthBasicResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token endpoint uses HTTP Basic authentication with client credentials.
func (BetaManagedAgentsTokenEndpointAuthBasicResponse) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthBasicResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsTokenEndpointAuthBasicResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthBasicResponse) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthBasicResponseType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthBasicResponseType string
const (
BetaManagedAgentsTokenEndpointAuthBasicResponseTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicResponseType = "client_secret_basic"
)
type BetaManagedAgentsTokenEndpointAuthBasicUpdateParam ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthBasicUpdateParam struct {
// Any of "client_secret_basic".
Type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType `json:"type,omitzero" api:"required"`
// Updated OAuth client secret.
ClientSecret param.Opt[string] `json:"client_secret,omitzero"`
// contains filtered or unexported fields
}
Updated HTTP Basic authentication parameters for the token endpoint.
The property Type is required.
func (BetaManagedAgentsTokenEndpointAuthBasicUpdateParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthBasicUpdateParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsTokenEndpointAuthBasicUpdateParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthBasicUpdateParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType string
const (
BetaManagedAgentsTokenEndpointAuthBasicUpdateParamTypeClientSecretBasic BetaManagedAgentsTokenEndpointAuthBasicUpdateParamType = "client_secret_basic"
)
type BetaManagedAgentsTokenEndpointAuthNoneParam ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthNoneParam struct {
// Any of "none".
Type BetaManagedAgentsTokenEndpointAuthNoneParamType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Token endpoint requires no client authentication.
The property Type is required.
func (BetaManagedAgentsTokenEndpointAuthNoneParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthNoneParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsTokenEndpointAuthNoneParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthNoneParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthNoneParamType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthNoneParamType string
const (
BetaManagedAgentsTokenEndpointAuthNoneParamTypeNone BetaManagedAgentsTokenEndpointAuthNoneParamType = "none"
)
type BetaManagedAgentsTokenEndpointAuthNoneResponse ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthNoneResponse struct {
// Any of "none".
Type BetaManagedAgentsTokenEndpointAuthNoneResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token endpoint requires no client authentication.
func (BetaManagedAgentsTokenEndpointAuthNoneResponse) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthNoneResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsTokenEndpointAuthNoneResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthNoneResponse) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthNoneResponseType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthNoneResponseType string
const (
BetaManagedAgentsTokenEndpointAuthNoneResponseTypeNone BetaManagedAgentsTokenEndpointAuthNoneResponseType = "none"
)
type BetaManagedAgentsTokenEndpointAuthPostParam ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthPostParam struct {
// OAuth client secret.
ClientSecret string `json:"client_secret" api:"required"`
// Any of "client_secret_post".
Type BetaManagedAgentsTokenEndpointAuthPostParamType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Token endpoint uses POST body authentication with client credentials.
The properties ClientSecret, Type are required.
func (BetaManagedAgentsTokenEndpointAuthPostParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthPostParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsTokenEndpointAuthPostParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthPostParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthPostParamType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthPostParamType string
const (
BetaManagedAgentsTokenEndpointAuthPostParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostParamType = "client_secret_post"
)
type BetaManagedAgentsTokenEndpointAuthPostResponse ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthPostResponse struct {
// Any of "client_secret_post".
Type BetaManagedAgentsTokenEndpointAuthPostResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token endpoint uses POST body authentication with client credentials.
func (BetaManagedAgentsTokenEndpointAuthPostResponse) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthPostResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsTokenEndpointAuthPostResponse) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthPostResponse) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthPostResponseType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthPostResponseType string
const (
BetaManagedAgentsTokenEndpointAuthPostResponseTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostResponseType = "client_secret_post"
)
type BetaManagedAgentsTokenEndpointAuthPostUpdateParam ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthPostUpdateParam struct {
// Any of "client_secret_post".
Type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType `json:"type,omitzero" api:"required"`
// Updated OAuth client secret.
ClientSecret param.Opt[string] `json:"client_secret,omitzero"`
// contains filtered or unexported fields
}
Updated POST body authentication parameters for the token endpoint.
The property Type is required.
func (BetaManagedAgentsTokenEndpointAuthPostUpdateParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsTokenEndpointAuthPostUpdateParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsTokenEndpointAuthPostUpdateParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsTokenEndpointAuthPostUpdateParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType ¶ added in v1.33.0
type BetaManagedAgentsTokenEndpointAuthPostUpdateParamType string
const (
BetaManagedAgentsTokenEndpointAuthPostUpdateParamTypeClientSecretPost BetaManagedAgentsTokenEndpointAuthPostUpdateParamType = "client_secret_post"
)
type BetaManagedAgentsURLDocumentSource ¶ added in v1.33.0
type BetaManagedAgentsURLDocumentSource struct {
// Any of "url".
Type BetaManagedAgentsURLDocumentSourceType `json:"type" api:"required"`
// URL of the document to fetch.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Document referenced by URL.
func (BetaManagedAgentsURLDocumentSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsURLDocumentSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsURLDocumentSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsURLDocumentSource) ToParam() BetaManagedAgentsURLDocumentSourceParam
ToParam converts this BetaManagedAgentsURLDocumentSource to a BetaManagedAgentsURLDocumentSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsURLDocumentSourceParam.Overrides()
func (*BetaManagedAgentsURLDocumentSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsURLDocumentSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsURLDocumentSourceParam ¶ added in v1.33.0
type BetaManagedAgentsURLDocumentSourceParam struct {
// Any of "url".
Type BetaManagedAgentsURLDocumentSourceType `json:"type,omitzero" api:"required"`
// URL of the document to fetch.
URL string `json:"url" api:"required"`
// contains filtered or unexported fields
}
Document referenced by URL.
The properties Type, URL are required.
func (BetaManagedAgentsURLDocumentSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsURLDocumentSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsURLDocumentSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsURLDocumentSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsURLDocumentSourceType ¶ added in v1.33.0
type BetaManagedAgentsURLDocumentSourceType string
const (
BetaManagedAgentsURLDocumentSourceTypeURL BetaManagedAgentsURLDocumentSourceType = "url"
)
type BetaManagedAgentsURLImageSource ¶ added in v1.33.0
type BetaManagedAgentsURLImageSource struct {
// Any of "url".
Type BetaManagedAgentsURLImageSourceType `json:"type" api:"required"`
// URL of the image to fetch.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Image referenced by URL.
func (BetaManagedAgentsURLImageSource) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsURLImageSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaManagedAgentsURLImageSource) ToParam ¶ added in v1.33.0
func (r BetaManagedAgentsURLImageSource) ToParam() BetaManagedAgentsURLImageSourceParam
ToParam converts this BetaManagedAgentsURLImageSource to a BetaManagedAgentsURLImageSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaManagedAgentsURLImageSourceParam.Overrides()
func (*BetaManagedAgentsURLImageSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsURLImageSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsURLImageSourceParam ¶ added in v1.33.0
type BetaManagedAgentsURLImageSourceParam struct {
// Any of "url".
Type BetaManagedAgentsURLImageSourceType `json:"type,omitzero" api:"required"`
// URL of the image to fetch.
URL string `json:"url" api:"required"`
// contains filtered or unexported fields
}
Image referenced by URL.
The properties Type, URL are required.
func (BetaManagedAgentsURLImageSourceParam) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsURLImageSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsURLImageSourceParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsURLImageSourceParam) UnmarshalJSON(data []byte) error
type BetaManagedAgentsURLImageSourceType ¶ added in v1.33.0
type BetaManagedAgentsURLImageSourceType string
const (
BetaManagedAgentsURLImageSourceTypeURL BetaManagedAgentsURLImageSourceType = "url"
)
type BetaManagedAgentsURLMCPServerParams ¶ added in v1.33.0
type BetaManagedAgentsURLMCPServerParams struct {
// Unique name for this server, referenced by mcp_toolset configurations. 1-255
// characters.
Name string `json:"name" api:"required"`
// Any of "url".
Type BetaManagedAgentsURLMCPServerParamsType `json:"type,omitzero" api:"required"`
// Endpoint URL for the MCP server.
URL string `json:"url" api:"required"`
// contains filtered or unexported fields
}
URL-based MCP server connection.
The properties Name, Type, URL are required.
func (BetaManagedAgentsURLMCPServerParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsURLMCPServerParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsURLMCPServerParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsURLMCPServerParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsURLMCPServerParamsType ¶ added in v1.33.0
type BetaManagedAgentsURLMCPServerParamsType string
const (
BetaManagedAgentsURLMCPServerParamsTypeURL BetaManagedAgentsURLMCPServerParamsType = "url"
)
type BetaManagedAgentsUnknownError ¶ added in v1.33.0
type BetaManagedAgentsUnknownError struct {
// Human-readable error description.
Message string `json:"message" api:"required"`
// What the client should do next in response to this error.
RetryStatus BetaManagedAgentsUnknownErrorRetryStatusUnion `json:"retry_status" api:"required"`
// Any of "unknown_error".
Type BetaManagedAgentsUnknownErrorType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
RetryStatus respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.
func (BetaManagedAgentsUnknownError) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUnknownError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUnknownError) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUnknownError) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUnknownErrorRetryStatusUnion ¶ added in v1.33.0
type BetaManagedAgentsUnknownErrorRetryStatusUnion struct {
// Any of "retrying", "exhausted", "terminal".
Type string `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsUnknownErrorRetryStatusUnion contains all possible properties and values from BetaManagedAgentsRetryStatusRetrying, BetaManagedAgentsRetryStatusExhausted, BetaManagedAgentsRetryStatusTerminal.
Use the BetaManagedAgentsUnknownErrorRetryStatusUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsUnknownErrorRetryStatusUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsAny() anyBetaManagedAgentsUnknownErrorRetryStatus
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsUnknownErrorRetryStatusUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsRetryStatusRetrying:
case anthropic.BetaManagedAgentsRetryStatusExhausted:
case anthropic.BetaManagedAgentsRetryStatusTerminal:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsUnknownErrorRetryStatusUnion) AsExhausted ¶ added in v1.33.0
func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsExhausted() (v BetaManagedAgentsRetryStatusExhausted)
func (BetaManagedAgentsUnknownErrorRetryStatusUnion) AsRetrying ¶ added in v1.33.0
func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsRetrying() (v BetaManagedAgentsRetryStatusRetrying)
func (BetaManagedAgentsUnknownErrorRetryStatusUnion) AsTerminal ¶ added in v1.33.0
func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) AsTerminal() (v BetaManagedAgentsRetryStatusTerminal)
func (BetaManagedAgentsUnknownErrorRetryStatusUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsUnknownErrorRetryStatusUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUnknownErrorRetryStatusUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUnknownErrorRetryStatusUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUnknownErrorType ¶ added in v1.33.0
type BetaManagedAgentsUnknownErrorType string
const (
BetaManagedAgentsUnknownErrorTypeUnknownError BetaManagedAgentsUnknownErrorType = "unknown_error"
)
type BetaManagedAgentsUserActor ¶ added in v1.38.0
type BetaManagedAgentsUserActor struct {
// Any of "user_actor".
Type BetaManagedAgentsUserActorType `json:"type" api:"required"`
UserID string `json:"user_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
UserID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaManagedAgentsUserActor) RawJSON ¶ added in v1.38.0
func (r BetaManagedAgentsUserActor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserActor) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaManagedAgentsUserActor) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserActorType ¶ added in v1.38.0
type BetaManagedAgentsUserActorType string
const (
BetaManagedAgentsUserActorTypeUserActor BetaManagedAgentsUserActorType = "user_actor"
)
type BetaManagedAgentsUserCustomToolResultEvent ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// The id of the `agent.custom_tool_use` event this result corresponds to, which
// can be found in the last `session.status_idle`
// [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids)
// `stop_reason.event_ids` field.
CustomToolUseID string `json:"custom_tool_use_id" api:"required"`
// Any of "user.custom_tool_result".
Type BetaManagedAgentsUserCustomToolResultEventType `json:"type" api:"required"`
// The result content returned by the tool.
Content []BetaManagedAgentsUserCustomToolResultEventContentUnion `json:"content"`
// Whether the tool execution resulted in an error.
IsError bool `json:"is_error" api:"nullable"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CustomToolUseID respjson.Field
Type respjson.Field
Content respjson.Field
IsError respjson.Field
ProcessedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Event sent by the client providing the result of a custom tool execution.
func (BetaManagedAgentsUserCustomToolResultEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserCustomToolResultEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserCustomToolResultEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserCustomToolResultEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserCustomToolResultEventContentUnion ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEventContentUnion struct {
// This field is from variant [BetaManagedAgentsTextBlock].
Text string `json:"text"`
// Any of "text", "image", "document".
Type string `json:"type"`
// This field is a union of [BetaManagedAgentsImageBlockSourceUnion],
// [BetaManagedAgentsDocumentBlockSourceUnion]
Source BetaManagedAgentsUserCustomToolResultEventContentUnionSource `json:"source"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Context string `json:"context"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Title string `json:"title"`
JSON struct {
Text respjson.Field
Type respjson.Field
Source respjson.Field
Context respjson.Field
Title respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsUserCustomToolResultEventContentUnion contains all possible properties and values from BetaManagedAgentsTextBlock, BetaManagedAgentsImageBlock, BetaManagedAgentsDocumentBlock.
Use the BetaManagedAgentsUserCustomToolResultEventContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsUserCustomToolResultEventContentUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsAny() anyBetaManagedAgentsUserCustomToolResultEventContent
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsUserCustomToolResultEventContentUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsTextBlock:
case anthropic.BetaManagedAgentsImageBlock:
case anthropic.BetaManagedAgentsDocumentBlock:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsUserCustomToolResultEventContentUnion) AsDocument ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
func (BetaManagedAgentsUserCustomToolResultEventContentUnion) AsImage ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
func (BetaManagedAgentsUserCustomToolResultEventContentUnion) AsText ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
func (BetaManagedAgentsUserCustomToolResultEventContentUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserCustomToolResultEventContentUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserCustomToolResultEventContentUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserCustomToolResultEventContentUnionSource ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEventContentUnionSource struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
Type string `json:"type"`
URL string `json:"url"`
FileID string `json:"file_id"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
URL respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsUserCustomToolResultEventContentUnionSource is an implicit subunion of BetaManagedAgentsUserCustomToolResultEventContentUnion. BetaManagedAgentsUserCustomToolResultEventContentUnionSource provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsUserCustomToolResultEventContentUnion.
func (*BetaManagedAgentsUserCustomToolResultEventContentUnionSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserCustomToolResultEventContentUnionSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserCustomToolResultEventParams ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEventParams struct {
// The id of the `agent.custom_tool_use` event this result corresponds to, which
// can be found in the last `session.status_idle`
// [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids)
// `stop_reason.event_ids` field.
CustomToolUseID string `json:"custom_tool_use_id" api:"required"`
// Any of "user.custom_tool_result".
Type BetaManagedAgentsUserCustomToolResultEventParamsType `json:"type,omitzero" api:"required"`
// Whether the tool execution resulted in an error.
IsError param.Opt[bool] `json:"is_error,omitzero"`
// The result content returned by the tool.
Content []BetaManagedAgentsUserCustomToolResultEventParamsContentUnion `json:"content,omitzero"`
// contains filtered or unexported fields
}
Parameters for providing the result of a custom tool execution.
The properties CustomToolUseID, Type are required.
func (BetaManagedAgentsUserCustomToolResultEventParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserCustomToolResultEventParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsUserCustomToolResultEventParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserCustomToolResultEventParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserCustomToolResultEventParamsContentUnion ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEventParamsContentUnion struct {
OfText *BetaManagedAgentsTextBlockParam `json:",omitzero,inline"`
OfImage *BetaManagedAgentsImageBlockParam `json:",omitzero,inline"`
OfDocument *BetaManagedAgentsDocumentBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetContext ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetContext() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetSource ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetSource() (res betaManagedAgentsUserCustomToolResultEventParamsContentUnionSource)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetText ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetTitle ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsUserCustomToolResultEventParamsContentUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserCustomToolResultEventParamsType ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEventParamsType string
const (
BetaManagedAgentsUserCustomToolResultEventParamsTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventParamsType = "user.custom_tool_result"
)
type BetaManagedAgentsUserCustomToolResultEventType ¶ added in v1.33.0
type BetaManagedAgentsUserCustomToolResultEventType string
const (
BetaManagedAgentsUserCustomToolResultEventTypeUserCustomToolResult BetaManagedAgentsUserCustomToolResultEventType = "user.custom_tool_result"
)
type BetaManagedAgentsUserInterruptEvent ¶ added in v1.33.0
type BetaManagedAgentsUserInterruptEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Any of "user.interrupt".
Type BetaManagedAgentsUserInterruptEventType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ProcessedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An interrupt event that pauses agent execution and returns control to the user.
func (BetaManagedAgentsUserInterruptEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserInterruptEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserInterruptEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserInterruptEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserInterruptEventParams ¶ added in v1.33.0
type BetaManagedAgentsUserInterruptEventParams struct {
// Any of "user.interrupt".
Type BetaManagedAgentsUserInterruptEventParamsType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Parameters for sending an interrupt to pause the agent.
The property Type is required.
func (BetaManagedAgentsUserInterruptEventParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserInterruptEventParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsUserInterruptEventParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserInterruptEventParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserInterruptEventParamsType ¶ added in v1.33.0
type BetaManagedAgentsUserInterruptEventParamsType string
const (
BetaManagedAgentsUserInterruptEventParamsTypeUserInterrupt BetaManagedAgentsUserInterruptEventParamsType = "user.interrupt"
)
type BetaManagedAgentsUserInterruptEventType ¶ added in v1.33.0
type BetaManagedAgentsUserInterruptEventType string
const (
BetaManagedAgentsUserInterruptEventTypeUserInterrupt BetaManagedAgentsUserInterruptEventType = "user.interrupt"
)
type BetaManagedAgentsUserMessageEvent ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// Array of content blocks comprising the user message.
Content []BetaManagedAgentsUserMessageEventContentUnion `json:"content" api:"required"`
// Any of "user.message".
Type BetaManagedAgentsUserMessageEventType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Content respjson.Field
Type respjson.Field
ProcessedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A user message event in the session conversation.
func (BetaManagedAgentsUserMessageEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserMessageEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserMessageEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserMessageEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserMessageEventContentUnion ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEventContentUnion struct {
// This field is from variant [BetaManagedAgentsTextBlock].
Text string `json:"text"`
// Any of "text", "image", "document".
Type string `json:"type"`
// This field is a union of [BetaManagedAgentsImageBlockSourceUnion],
// [BetaManagedAgentsDocumentBlockSourceUnion]
Source BetaManagedAgentsUserMessageEventContentUnionSource `json:"source"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Context string `json:"context"`
// This field is from variant [BetaManagedAgentsDocumentBlock].
Title string `json:"title"`
JSON struct {
Text respjson.Field
Type respjson.Field
Source respjson.Field
Context respjson.Field
Title respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsUserMessageEventContentUnion contains all possible properties and values from BetaManagedAgentsTextBlock, BetaManagedAgentsImageBlock, BetaManagedAgentsDocumentBlock.
Use the BetaManagedAgentsUserMessageEventContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaManagedAgentsUserMessageEventContentUnion) AsAny ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventContentUnion) AsAny() anyBetaManagedAgentsUserMessageEventContent
Use the following switch statement to find the correct variant
switch variant := BetaManagedAgentsUserMessageEventContentUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsTextBlock:
case anthropic.BetaManagedAgentsImageBlock:
case anthropic.BetaManagedAgentsDocumentBlock:
default:
fmt.Errorf("no variant present")
}
func (BetaManagedAgentsUserMessageEventContentUnion) AsDocument ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock)
func (BetaManagedAgentsUserMessageEventContentUnion) AsImage ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock)
func (BetaManagedAgentsUserMessageEventContentUnion) AsText ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventContentUnion) AsText() (v BetaManagedAgentsTextBlock)
func (BetaManagedAgentsUserMessageEventContentUnion) RawJSON ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserMessageEventContentUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserMessageEventContentUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserMessageEventContentUnionSource ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEventContentUnionSource struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
Type string `json:"type"`
URL string `json:"url"`
FileID string `json:"file_id"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
URL respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaManagedAgentsUserMessageEventContentUnionSource is an implicit subunion of BetaManagedAgentsUserMessageEventContentUnion. BetaManagedAgentsUserMessageEventContentUnionSource provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaManagedAgentsUserMessageEventContentUnion.
func (*BetaManagedAgentsUserMessageEventContentUnionSource) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserMessageEventContentUnionSource) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserMessageEventParams ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEventParams struct {
// Array of content blocks for the user message.
Content []BetaManagedAgentsUserMessageEventParamsContentUnion `json:"content,omitzero" api:"required"`
// Any of "user.message".
Type BetaManagedAgentsUserMessageEventParamsType `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Parameters for sending a user message to the session.
The properties Content, Type are required.
func (BetaManagedAgentsUserMessageEventParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserMessageEventParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsUserMessageEventParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserMessageEventParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserMessageEventParamsContentUnion ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEventParamsContentUnion struct {
OfText *BetaManagedAgentsTextBlockParam `json:",omitzero,inline"`
OfImage *BetaManagedAgentsImageBlockParam `json:",omitzero,inline"`
OfDocument *BetaManagedAgentsDocumentBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaManagedAgentsUserMessageEventParamsContentUnion) GetContext ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetContext() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserMessageEventParamsContentUnion) GetSource ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetSource() (res betaManagedAgentsUserMessageEventParamsContentUnionSource)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaManagedAgentsUserMessageEventParamsContentUnion) GetText ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserMessageEventParamsContentUnion) GetTitle ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserMessageEventParamsContentUnion) GetType ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventParamsContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaManagedAgentsUserMessageEventParamsContentUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaManagedAgentsUserMessageEventParamsContentUnion) MarshalJSON() ([]byte, error)
func (*BetaManagedAgentsUserMessageEventParamsContentUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaManagedAgentsUserMessageEventParamsContentUnion) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserMessageEventParamsType ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEventParamsType string
const (
BetaManagedAgentsUserMessageEventParamsTypeUserMessage BetaManagedAgentsUserMessageEventParamsType = "user.message"
)
type BetaManagedAgentsUserMessageEventType ¶ added in v1.33.0
type BetaManagedAgentsUserMessageEventType string
const (
BetaManagedAgentsUserMessageEventTypeUserMessage BetaManagedAgentsUserMessageEventType = "user.message"
)
type BetaManagedAgentsUserToolConfirmationEvent ¶ added in v1.33.0
type BetaManagedAgentsUserToolConfirmationEvent struct {
// Unique identifier for this event.
ID string `json:"id" api:"required"`
// UserToolConfirmationResult enum
//
// Any of "allow", "deny".
Result BetaManagedAgentsUserToolConfirmationEventResult `json:"result" api:"required"`
// The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result
// corresponds to, which can be found in the last `session.status_idle`
// [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids)
// `stop_reason.event_ids` field.
ToolUseID string `json:"tool_use_id" api:"required"`
// Any of "user.tool_confirmation".
Type BetaManagedAgentsUserToolConfirmationEventType `json:"type" api:"required"`
// Optional message providing context for a 'deny' decision. Only allowed when
// result is 'deny'.
DenyMessage string `json:"deny_message" api:"nullable"`
// A timestamp in RFC 3339 format
ProcessedAt time.Time `json:"processed_at" api:"nullable" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Result respjson.Field
ToolUseID respjson.Field
Type respjson.Field
DenyMessage respjson.Field
ProcessedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A tool confirmation event that approves or denies a pending tool execution.
func (BetaManagedAgentsUserToolConfirmationEvent) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserToolConfirmationEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsUserToolConfirmationEvent) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserToolConfirmationEvent) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserToolConfirmationEventParams ¶ added in v1.33.0
type BetaManagedAgentsUserToolConfirmationEventParams struct {
// UserToolConfirmationResult enum
//
// Any of "allow", "deny".
Result BetaManagedAgentsUserToolConfirmationEventParamsResult `json:"result,omitzero" api:"required"`
// The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result
// corresponds to, which can be found in the last `session.status_idle`
// [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids)
// `stop_reason.event_ids` field.
ToolUseID string `json:"tool_use_id" api:"required"`
// Any of "user.tool_confirmation".
Type BetaManagedAgentsUserToolConfirmationEventParamsType `json:"type,omitzero" api:"required"`
// Optional message providing context for a 'deny' decision. Only allowed when
// result is 'deny'.
DenyMessage param.Opt[string] `json:"deny_message,omitzero"`
// contains filtered or unexported fields
}
Parameters for confirming or denying a tool execution request.
The properties Result, ToolUseID, Type are required.
func (BetaManagedAgentsUserToolConfirmationEventParams) MarshalJSON ¶ added in v1.33.0
func (r BetaManagedAgentsUserToolConfirmationEventParams) MarshalJSON() (data []byte, err error)
func (*BetaManagedAgentsUserToolConfirmationEventParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsUserToolConfirmationEventParams) UnmarshalJSON(data []byte) error
type BetaManagedAgentsUserToolConfirmationEventParamsResult ¶ added in v1.33.0
type BetaManagedAgentsUserToolConfirmationEventParamsResult string
UserToolConfirmationResult enum
const ( BetaManagedAgentsUserToolConfirmationEventParamsResultAllow BetaManagedAgentsUserToolConfirmationEventParamsResult = "allow" BetaManagedAgentsUserToolConfirmationEventParamsResultDeny BetaManagedAgentsUserToolConfirmationEventParamsResult = "deny" )
type BetaManagedAgentsUserToolConfirmationEventParamsType ¶ added in v1.33.0
type BetaManagedAgentsUserToolConfirmationEventParamsType string
const (
BetaManagedAgentsUserToolConfirmationEventParamsTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventParamsType = "user.tool_confirmation"
)
type BetaManagedAgentsUserToolConfirmationEventResult ¶ added in v1.33.0
type BetaManagedAgentsUserToolConfirmationEventResult string
UserToolConfirmationResult enum
const ( BetaManagedAgentsUserToolConfirmationEventResultAllow BetaManagedAgentsUserToolConfirmationEventResult = "allow" BetaManagedAgentsUserToolConfirmationEventResultDeny BetaManagedAgentsUserToolConfirmationEventResult = "deny" )
type BetaManagedAgentsUserToolConfirmationEventType ¶ added in v1.33.0
type BetaManagedAgentsUserToolConfirmationEventType string
const (
BetaManagedAgentsUserToolConfirmationEventTypeUserToolConfirmation BetaManagedAgentsUserToolConfirmationEventType = "user.tool_confirmation"
)
type BetaManagedAgentsVault ¶ added in v1.33.0
type BetaManagedAgentsVault struct {
// Unique identifier for the vault.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Human-readable name for the vault.
DisplayName string `json:"display_name" api:"required"`
// Arbitrary key-value metadata attached to the vault.
Metadata map[string]string `json:"metadata" api:"required"`
// Any of "vault".
Type BetaManagedAgentsVaultType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ArchivedAt respjson.Field
CreatedAt respjson.Field
DisplayName respjson.Field
Metadata respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A vault that stores credentials for use by agents during sessions.
func (BetaManagedAgentsVault) RawJSON ¶ added in v1.33.0
func (r BetaManagedAgentsVault) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaManagedAgentsVault) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaManagedAgentsVault) UnmarshalJSON(data []byte) error
type BetaManagedAgentsVaultType ¶ added in v1.33.0
type BetaManagedAgentsVaultType string
const (
BetaManagedAgentsVaultTypeVault BetaManagedAgentsVaultType = "vault"
)
type BetaMemoryStoreArchiveParams ¶ added in v1.38.0
type BetaMemoryStoreArchiveParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMemoryStoreDeleteParams ¶ added in v1.38.0
type BetaMemoryStoreDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMemoryStoreGetParams ¶ added in v1.38.0
type BetaMemoryStoreGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMemoryStoreListParams ¶ added in v1.38.0
type BetaMemoryStoreListParams struct {
// Return stores created at or after this time (inclusive).
CreatedAtGte param.Opt[time.Time] `query:"created_at[gte],omitzero" format:"date-time" json:"-"`
// Return stores created at or before this time (inclusive).
CreatedAtLte param.Opt[time.Time] `query:"created_at[lte],omitzero" format:"date-time" json:"-"`
// Query parameter for include_archived
IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
// Query parameter for limit
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Query parameter for page
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreListParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreListParams's query parameters as `url.Values`.
type BetaMemoryStoreMemoryDeleteParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryDeleteParams struct {
MemoryStoreID string `path:"memory_store_id" api:"required" json:"-"`
// Query parameter for expected_content_sha256
ExpectedContentSha256 param.Opt[string] `query:"expected_content_sha256,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryDeleteParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryDeleteParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryDeleteParams's query parameters as `url.Values`.
type BetaMemoryStoreMemoryGetParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryGetParams struct {
MemoryStoreID string `path:"memory_store_id" api:"required" json:"-"`
// Query parameter for view
//
// Any of "basic", "full".
View BetaManagedAgentsMemoryView `query:"view,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryGetParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryGetParams's query parameters as `url.Values`.
type BetaMemoryStoreMemoryListParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryListParams struct {
// Query parameter for depth
Depth param.Opt[int64] `query:"depth,omitzero" json:"-"`
// Query parameter for limit
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Query parameter for order_by
OrderBy param.Opt[string] `query:"order_by,omitzero" json:"-"`
// Query parameter for page
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional path prefix filter (raw string-prefix match; include a trailing slash
// for directory-scoped lists). This value appears in request URLs. Do not include
// secrets or personally identifiable information.
PathPrefix param.Opt[string] `query:"path_prefix,omitzero" json:"-"`
// Query parameter for order
//
// Any of "asc", "desc".
Order BetaMemoryStoreMemoryListParamsOrder `query:"order,omitzero" json:"-"`
// Query parameter for view
//
// Any of "basic", "full".
View BetaManagedAgentsMemoryView `query:"view,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryListParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryListParams's query parameters as `url.Values`.
type BetaMemoryStoreMemoryListParamsOrder ¶ added in v1.38.0
type BetaMemoryStoreMemoryListParamsOrder string
Query parameter for order
const ( BetaMemoryStoreMemoryListParamsOrderAsc BetaMemoryStoreMemoryListParamsOrder = "asc" BetaMemoryStoreMemoryListParamsOrderDesc BetaMemoryStoreMemoryListParamsOrder = "desc" )
type BetaMemoryStoreMemoryNewParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryNewParams struct {
Content param.Opt[string] `json:"content,omitzero" api:"required"`
Path string `json:"path" api:"required"`
// Query parameter for view
//
// Any of "basic", "full".
View BetaManagedAgentsMemoryView `query:"view,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryNewParams) MarshalJSON ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryNewParams) MarshalJSON() (data []byte, err error)
func (BetaMemoryStoreMemoryNewParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryNewParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryNewParams's query parameters as `url.Values`.
func (*BetaMemoryStoreMemoryNewParams) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryNewParams) UnmarshalJSON(data []byte) error
type BetaMemoryStoreMemoryService ¶ added in v1.38.0
type BetaMemoryStoreMemoryService struct {
Options []option.RequestOption
}
BetaMemoryStoreMemoryService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaMemoryStoreMemoryService method instead.
func NewBetaMemoryStoreMemoryService ¶ added in v1.38.0
func NewBetaMemoryStoreMemoryService(opts ...option.RequestOption) (r BetaMemoryStoreMemoryService)
NewBetaMemoryStoreMemoryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaMemoryStoreMemoryService) Delete ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryService) Delete(ctx context.Context, memoryID string, params BetaMemoryStoreMemoryDeleteParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeletedMemory, err error)
DeleteMemory
func (*BetaMemoryStoreMemoryService) Get ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryService) Get(ctx context.Context, memoryID string, params BetaMemoryStoreMemoryGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemory, err error)
GetMemory
func (*BetaMemoryStoreMemoryService) List ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryService) List(ctx context.Context, memoryStoreID string, params BetaMemoryStoreMemoryListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsMemoryListItemUnion], err error)
ListMemories
func (*BetaMemoryStoreMemoryService) ListAutoPaging ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryService) ListAutoPaging(ctx context.Context, memoryStoreID string, params BetaMemoryStoreMemoryListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsMemoryListItemUnion]
ListMemories
func (*BetaMemoryStoreMemoryService) New ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryService) New(ctx context.Context, memoryStoreID string, params BetaMemoryStoreMemoryNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemory, err error)
CreateMemory
func (*BetaMemoryStoreMemoryService) Update ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryService) Update(ctx context.Context, memoryID string, params BetaMemoryStoreMemoryUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemory, err error)
UpdateMemory
type BetaMemoryStoreMemoryUpdateParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryUpdateParams struct {
MemoryStoreID string `path:"memory_store_id" api:"required" json:"-"`
Content param.Opt[string] `json:"content,omitzero"`
Path param.Opt[string] `json:"path,omitzero"`
// Query parameter for view
//
// Any of "basic", "full".
View BetaManagedAgentsMemoryView `query:"view,omitzero" json:"-"`
Precondition BetaManagedAgentsPreconditionParam `json:"precondition,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryUpdateParams) MarshalJSON ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryUpdateParams) MarshalJSON() (data []byte, err error)
func (BetaMemoryStoreMemoryUpdateParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryUpdateParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryUpdateParams's query parameters as `url.Values`.
func (*BetaMemoryStoreMemoryUpdateParams) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryUpdateParams) UnmarshalJSON(data []byte) error
type BetaMemoryStoreMemoryVersionGetParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryVersionGetParams struct {
MemoryStoreID string `path:"memory_store_id" api:"required" json:"-"`
// Query parameter for view
//
// Any of "basic", "full".
View BetaManagedAgentsMemoryView `query:"view,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryVersionGetParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryVersionGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryVersionGetParams's query parameters as `url.Values`.
type BetaMemoryStoreMemoryVersionListParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryVersionListParams struct {
// Query parameter for api_key_id
APIKeyID param.Opt[string] `query:"api_key_id,omitzero" json:"-"`
// Return versions created at or after this time (inclusive).
CreatedAtGte param.Opt[time.Time] `query:"created_at[gte],omitzero" format:"date-time" json:"-"`
// Return versions created at or before this time (inclusive).
CreatedAtLte param.Opt[time.Time] `query:"created_at[lte],omitzero" format:"date-time" json:"-"`
// Query parameter for limit
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Query parameter for memory_id
MemoryID param.Opt[string] `query:"memory_id,omitzero" json:"-"`
// Query parameter for page
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Query parameter for session_id
SessionID param.Opt[string] `query:"session_id,omitzero" json:"-"`
// Query parameter for operation
//
// Any of "created", "modified", "deleted".
Operation BetaManagedAgentsMemoryVersionOperation `query:"operation,omitzero" json:"-"`
// Query parameter for view
//
// Any of "basic", "full".
View BetaManagedAgentsMemoryView `query:"view,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreMemoryVersionListParams) URLQuery ¶ added in v1.38.0
func (r BetaMemoryStoreMemoryVersionListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMemoryStoreMemoryVersionListParams's query parameters as `url.Values`.
type BetaMemoryStoreMemoryVersionRedactParams ¶ added in v1.38.0
type BetaMemoryStoreMemoryVersionRedactParams struct {
MemoryStoreID string `path:"memory_store_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMemoryStoreMemoryVersionService ¶ added in v1.38.0
type BetaMemoryStoreMemoryVersionService struct {
Options []option.RequestOption
}
BetaMemoryStoreMemoryVersionService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaMemoryStoreMemoryVersionService method instead.
func NewBetaMemoryStoreMemoryVersionService ¶ added in v1.38.0
func NewBetaMemoryStoreMemoryVersionService(opts ...option.RequestOption) (r BetaMemoryStoreMemoryVersionService)
NewBetaMemoryStoreMemoryVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaMemoryStoreMemoryVersionService) Get ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryVersionService) Get(ctx context.Context, memoryVersionID string, params BetaMemoryStoreMemoryVersionGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemoryVersion, err error)
GetMemoryVersion
func (*BetaMemoryStoreMemoryVersionService) List ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryVersionService) List(ctx context.Context, memoryStoreID string, params BetaMemoryStoreMemoryVersionListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsMemoryVersion], err error)
ListMemoryVersions
func (*BetaMemoryStoreMemoryVersionService) ListAutoPaging ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryVersionService) ListAutoPaging(ctx context.Context, memoryStoreID string, params BetaMemoryStoreMemoryVersionListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsMemoryVersion]
ListMemoryVersions
func (*BetaMemoryStoreMemoryVersionService) Redact ¶ added in v1.38.0
func (r *BetaMemoryStoreMemoryVersionService) Redact(ctx context.Context, memoryVersionID string, params BetaMemoryStoreMemoryVersionRedactParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemoryVersion, err error)
RedactMemoryVersion
type BetaMemoryStoreNewParams ¶ added in v1.38.0
type BetaMemoryStoreNewParams struct {
Name string `json:"name" api:"required"`
Description param.Opt[string] `json:"description,omitzero"`
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreNewParams) MarshalJSON ¶ added in v1.38.0
func (r BetaMemoryStoreNewParams) MarshalJSON() (data []byte, err error)
func (*BetaMemoryStoreNewParams) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaMemoryStoreNewParams) UnmarshalJSON(data []byte) error
type BetaMemoryStoreService ¶ added in v1.38.0
type BetaMemoryStoreService struct {
Options []option.RequestOption
Memories BetaMemoryStoreMemoryService
MemoryVersions BetaMemoryStoreMemoryVersionService
}
BetaMemoryStoreService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaMemoryStoreService method instead.
func NewBetaMemoryStoreService ¶ added in v1.38.0
func NewBetaMemoryStoreService(opts ...option.RequestOption) (r BetaMemoryStoreService)
NewBetaMemoryStoreService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaMemoryStoreService) Archive ¶ added in v1.38.0
func (r *BetaMemoryStoreService) Archive(ctx context.Context, memoryStoreID string, body BetaMemoryStoreArchiveParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemoryStore, err error)
ArchiveMemoryStore
func (*BetaMemoryStoreService) Delete ¶ added in v1.38.0
func (r *BetaMemoryStoreService) Delete(ctx context.Context, memoryStoreID string, body BetaMemoryStoreDeleteParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeletedMemoryStore, err error)
DeleteMemoryStore
func (*BetaMemoryStoreService) Get ¶ added in v1.38.0
func (r *BetaMemoryStoreService) Get(ctx context.Context, memoryStoreID string, query BetaMemoryStoreGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemoryStore, err error)
GetMemoryStore
func (*BetaMemoryStoreService) List ¶ added in v1.38.0
func (r *BetaMemoryStoreService) List(ctx context.Context, params BetaMemoryStoreListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsMemoryStore], err error)
ListMemoryStores
func (*BetaMemoryStoreService) ListAutoPaging ¶ added in v1.38.0
func (r *BetaMemoryStoreService) ListAutoPaging(ctx context.Context, params BetaMemoryStoreListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsMemoryStore]
ListMemoryStores
func (*BetaMemoryStoreService) New ¶ added in v1.38.0
func (r *BetaMemoryStoreService) New(ctx context.Context, params BetaMemoryStoreNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemoryStore, err error)
CreateMemoryStore
func (*BetaMemoryStoreService) Update ¶ added in v1.38.0
func (r *BetaMemoryStoreService) Update(ctx context.Context, memoryStoreID string, params BetaMemoryStoreUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsMemoryStore, err error)
UpdateMemoryStore
type BetaMemoryStoreUpdateParams ¶ added in v1.38.0
type BetaMemoryStoreUpdateParams struct {
Description param.Opt[string] `json:"description,omitzero"`
Name param.Opt[string] `json:"name,omitzero"`
// Metadata patch. Set a key to a string to upsert it, or to null to delete it.
// Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars
// each) with values up to 512 chars.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMemoryStoreUpdateParams) MarshalJSON ¶ added in v1.38.0
func (r BetaMemoryStoreUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaMemoryStoreUpdateParams) UnmarshalJSON ¶ added in v1.38.0
func (r *BetaMemoryStoreUpdateParams) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818CommandUnion ¶ added in v1.13.0
type BetaMemoryTool20250818CommandUnion struct {
// Any of "view", "create", "str_replace", "insert", "delete", "rename".
Command string `json:"command"`
Path string `json:"path"`
// This field is from variant [BetaMemoryTool20250818ViewCommand].
ViewRange []int64 `json:"view_range"`
// This field is from variant [BetaMemoryTool20250818CreateCommand].
FileText string `json:"file_text"`
// This field is from variant [BetaMemoryTool20250818StrReplaceCommand].
NewStr string `json:"new_str"`
// This field is from variant [BetaMemoryTool20250818StrReplaceCommand].
OldStr string `json:"old_str"`
// This field is from variant [BetaMemoryTool20250818InsertCommand].
InsertLine int64 `json:"insert_line"`
// This field is from variant [BetaMemoryTool20250818InsertCommand].
InsertText string `json:"insert_text"`
// This field is from variant [BetaMemoryTool20250818RenameCommand].
NewPath string `json:"new_path"`
// This field is from variant [BetaMemoryTool20250818RenameCommand].
OldPath string `json:"old_path"`
JSON struct {
Command respjson.Field
Path respjson.Field
ViewRange respjson.Field
FileText respjson.Field
NewStr respjson.Field
OldStr respjson.Field
InsertLine respjson.Field
InsertText respjson.Field
NewPath respjson.Field
OldPath respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaMemoryTool20250818CommandUnion contains all possible properties and values from BetaMemoryTool20250818ViewCommand, BetaMemoryTool20250818CreateCommand, BetaMemoryTool20250818StrReplaceCommand, BetaMemoryTool20250818InsertCommand, BetaMemoryTool20250818DeleteCommand, BetaMemoryTool20250818RenameCommand.
Use the BetaMemoryTool20250818CommandUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaMemoryTool20250818CommandUnion) AsAny ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsAny() anyBetaMemoryTool20250818Command
Use the following switch statement to find the correct variant
switch variant := BetaMemoryTool20250818CommandUnion.AsAny().(type) {
case anthropic.BetaMemoryTool20250818ViewCommand:
case anthropic.BetaMemoryTool20250818CreateCommand:
case anthropic.BetaMemoryTool20250818StrReplaceCommand:
case anthropic.BetaMemoryTool20250818InsertCommand:
case anthropic.BetaMemoryTool20250818DeleteCommand:
case anthropic.BetaMemoryTool20250818RenameCommand:
default:
fmt.Errorf("no variant present")
}
func (BetaMemoryTool20250818CommandUnion) AsCreate ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsCreate() (v BetaMemoryTool20250818CreateCommand)
func (BetaMemoryTool20250818CommandUnion) AsDelete ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsDelete() (v BetaMemoryTool20250818DeleteCommand)
func (BetaMemoryTool20250818CommandUnion) AsInsert ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsInsert() (v BetaMemoryTool20250818InsertCommand)
func (BetaMemoryTool20250818CommandUnion) AsRename ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsRename() (v BetaMemoryTool20250818RenameCommand)
func (BetaMemoryTool20250818CommandUnion) AsStrReplace ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsStrReplace() (v BetaMemoryTool20250818StrReplaceCommand)
func (BetaMemoryTool20250818CommandUnion) AsView ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) AsView() (v BetaMemoryTool20250818ViewCommand)
func (BetaMemoryTool20250818CommandUnion) RawJSON ¶ added in v1.13.0
func (u BetaMemoryTool20250818CommandUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818CommandUnion) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818CommandUnion) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818CreateCommand ¶ added in v1.13.0
type BetaMemoryTool20250818CreateCommand struct {
// Command type identifier
Command constant.Create `json:"command" default:"create"`
// Content to write to the file
FileText string `json:"file_text" api:"required"`
// Path where the file should be created
Path string `json:"path" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
FileText respjson.Field
Path respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMemoryTool20250818CreateCommand) RawJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818CreateCommand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818CreateCommand) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818CreateCommand) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818DeleteCommand ¶ added in v1.13.0
type BetaMemoryTool20250818DeleteCommand struct {
// Command type identifier
Command constant.Delete `json:"command" default:"delete"`
// Path to the file or directory to delete
Path string `json:"path" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
Path respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMemoryTool20250818DeleteCommand) RawJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818DeleteCommand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818DeleteCommand) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818DeleteCommand) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818InsertCommand ¶ added in v1.13.0
type BetaMemoryTool20250818InsertCommand struct {
// Command type identifier
Command constant.Insert `json:"command" default:"insert"`
// Line number where text should be inserted
InsertLine int64 `json:"insert_line" api:"required"`
// Text to insert at the specified line
InsertText string `json:"insert_text" api:"required"`
// Path to the file where text should be inserted
Path string `json:"path" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
InsertLine respjson.Field
InsertText respjson.Field
Path respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMemoryTool20250818InsertCommand) RawJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818InsertCommand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818InsertCommand) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818InsertCommand) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818Param ¶ added in v1.13.0
type BetaMemoryTool20250818Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "memory".
Name constant.Memory `json:"name" default:"memory"`
// This field can be elided, and will marshal its zero value as "memory_20250818".
Type constant.Memory20250818 `json:"type" default:"memory_20250818"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaMemoryTool20250818Param) MarshalJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818Param) MarshalJSON() (data []byte, err error)
func (*BetaMemoryTool20250818Param) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818Param) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818RenameCommand ¶ added in v1.13.0
type BetaMemoryTool20250818RenameCommand struct {
// Command type identifier
Command constant.Rename `json:"command" default:"rename"`
// New path for the file or directory
NewPath string `json:"new_path" api:"required"`
// Current path of the file or directory
OldPath string `json:"old_path" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
NewPath respjson.Field
OldPath respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMemoryTool20250818RenameCommand) RawJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818RenameCommand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818RenameCommand) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818RenameCommand) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818StrReplaceCommand ¶ added in v1.13.0
type BetaMemoryTool20250818StrReplaceCommand struct {
// Command type identifier
Command constant.StrReplace `json:"command" default:"str_replace"`
// Text to replace with
NewStr string `json:"new_str" api:"required"`
// Text to search for and replace
OldStr string `json:"old_str" api:"required"`
// Path to the file where text should be replaced
Path string `json:"path" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
NewStr respjson.Field
OldStr respjson.Field
Path respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMemoryTool20250818StrReplaceCommand) RawJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818StrReplaceCommand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818StrReplaceCommand) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818StrReplaceCommand) UnmarshalJSON(data []byte) error
type BetaMemoryTool20250818ViewCommand ¶ added in v1.13.0
type BetaMemoryTool20250818ViewCommand struct {
// Command type identifier
Command constant.View `json:"command" default:"view"`
// Path to directory or file to view
Path string `json:"path" api:"required"`
// Optional line range for viewing specific lines
ViewRange []int64 `json:"view_range"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
Path respjson.Field
ViewRange respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMemoryTool20250818ViewCommand) RawJSON ¶ added in v1.13.0
func (r BetaMemoryTool20250818ViewCommand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMemoryTool20250818ViewCommand) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaMemoryTool20250818ViewCommand) UnmarshalJSON(data []byte) error
type BetaMessage ¶
type BetaMessage struct {
// Unique object identifier.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// Information about the container used in the request (for the code execution
// tool)
Container BetaContainer `json:"container" api:"required"`
// Content generated by the model.
//
// This is an array of content blocks, each of which has a `type` that determines
// its shape.
//
// Example:
//
// “`json
// [{ "type": "text", "text": "Hi, I'm Claude." }]
// “`
//
// If the request input `messages` ended with an `assistant` turn, then the
// response `content` will continue directly from that last turn. You can use this
// to constrain the model's output.
//
// For example, if the input `messages` were:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Then the response `content` might be:
//
// “`json
// [{ "type": "text", "text": "B)" }]
// “`
Content []BetaContentBlockUnion `json:"content" api:"required"`
// Context management response.
//
// Information about context management strategies applied during the request.
ContextManagement BetaContextManagementResponse `json:"context_management" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model" api:"required"`
// Conversational role of the generated message.
//
// This will always be `"assistant"`.
Role constant.Assistant `json:"role" default:"assistant"`
// Structured information about a refusal.
StopDetails BetaRefusalStopDetails `json:"stop_details" api:"required"`
// The reason that we stopped.
//
// This may be one the following values:
//
// - `"end_turn"`: the model reached a natural stopping point
// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
// - `"tool_use"`: the model invoked one or more tools
// - `"pause_turn"`: we paused a long-running turn. You may provide the response
// back as-is in a subsequent request to let the model continue.
// - `"refusal"`: when streaming classifiers intervene to handle potential policy
// violations
//
// In non-streaming mode this value is always non-null. In streaming mode, it is
// null in the `message_start` event and non-null otherwise.
//
// Any of "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn",
// "compaction", "refusal", "model_context_window_exceeded".
StopReason BetaStopReason `json:"stop_reason" api:"required"`
// Which custom stop sequence was generated, if any.
//
// This value will be a non-null string if one of your custom stop sequences was
// generated.
StopSequence string `json:"stop_sequence" api:"required"`
// Object type.
//
// For Messages, this is always `"message"`.
Type constant.Message `json:"type" default:"message"`
// Billing and rate-limit usage.
//
// Anthropic's API bills and rate-limits by token counts, as tokens represent the
// underlying cost to our systems.
//
// Under the hood, the API transforms requests into a format suitable for the
// model. The model's output then goes through a parsing stage before becoming an
// API response. As a result, the token counts in `usage` will not match one-to-one
// with the exact visible content of an API request or response.
//
// For example, `output_tokens` will be non-zero, even for an empty string response
// from Claude.
//
// Total input tokens in a request is the summation of `input_tokens`,
// `cache_creation_input_tokens`, and `cache_read_input_tokens`.
Usage BetaUsage `json:"usage" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Container respjson.Field
Content respjson.Field
ContextManagement respjson.Field
Model respjson.Field
Role respjson.Field
StopDetails respjson.Field
StopReason respjson.Field
StopSequence respjson.Field
Type respjson.Field
Usage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*BetaMessage) Accumulate ¶ added in v1.2.1
func (acc *BetaMessage) Accumulate(event BetaRawMessageStreamEventUnion) error
Accumulate builds up the Message incrementally from a MessageStreamEvent. The Message then can be used as any other Message, except with the caveat that the Message.JSON field which normally can be used to inspect the JSON sent over the network may not be populated fully.
message := anthropic.Message{}
for stream.Next() {
event := stream.Current()
message.Accumulate(event)
}
func (*BetaMessage) ParseOutput ¶ added in v1.38.0
func (r *BetaMessage) ParseOutput(dest any) error
ParseOutput finds the first text content block in the message and unmarshals it into dest. This is useful for streaming workflows where you accumulate the message first and then parse the structured output.
var msg anthropic.BetaMessage
for stream.Next() { msg.Accumulate(stream.Current()) }
msg.ParseOutput(&myStruct)
func (BetaMessage) RawJSON ¶
func (r BetaMessage) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaMessage) ToParam ¶
func (r BetaMessage) ToParam() BetaMessageParam
func (*BetaMessage) UnmarshalJSON ¶
func (r *BetaMessage) UnmarshalJSON(data []byte) error
type BetaMessageBatch ¶
type BetaMessageBatch struct {
// Unique object identifier.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// RFC 3339 datetime string representing the time at which the Message Batch was
// archived and its results became unavailable.
ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which cancellation was
// initiated for the Message Batch. Specified only if cancellation was initiated.
CancelInitiatedAt time.Time `json:"cancel_initiated_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which the Message Batch was
// created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which processing for the
// Message Batch ended. Specified only once processing ends.
//
// Processing ends when every request in a Message Batch has either succeeded,
// errored, canceled, or expired.
EndedAt time.Time `json:"ended_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which the Message Batch will
// expire and end processing, which is 24 hours after creation.
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// Processing status of the Message Batch.
//
// Any of "in_progress", "canceling", "ended".
ProcessingStatus BetaMessageBatchProcessingStatus `json:"processing_status" api:"required"`
// Tallies requests within the Message Batch, categorized by their status.
//
// Requests start as `processing` and move to one of the other statuses only once
// processing of the entire batch ends. The sum of all values always matches the
// total number of requests in the batch.
RequestCounts BetaMessageBatchRequestCounts `json:"request_counts" api:"required"`
// URL to a `.jsonl` file containing the results of the Message Batch requests.
// Specified only once processing ends.
//
// Results in the file are not guaranteed to be in the same order as requests. Use
// the `custom_id` field to match results to requests.
ResultsURL string `json:"results_url" api:"required"`
// Object type.
//
// For Message Batches, this is always `"message_batch"`.
Type constant.MessageBatch `json:"type" default:"message_batch"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ArchivedAt respjson.Field
CancelInitiatedAt respjson.Field
CreatedAt respjson.Field
EndedAt respjson.Field
ExpiresAt respjson.Field
ProcessingStatus respjson.Field
RequestCounts respjson.Field
ResultsURL respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageBatch) RawJSON ¶
func (r BetaMessageBatch) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatch) UnmarshalJSON ¶
func (r *BetaMessageBatch) UnmarshalJSON(data []byte) error
type BetaMessageBatchCancelParams ¶
type BetaMessageBatchCancelParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMessageBatchCanceledResult ¶
type BetaMessageBatchCanceledResult struct {
Type constant.Canceled `json:"type" default:"canceled"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageBatchCanceledResult) RawJSON ¶
func (r BetaMessageBatchCanceledResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchCanceledResult) UnmarshalJSON ¶
func (r *BetaMessageBatchCanceledResult) UnmarshalJSON(data []byte) error
type BetaMessageBatchDeleteParams ¶
type BetaMessageBatchDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMessageBatchErroredResult ¶
type BetaMessageBatchErroredResult struct {
Error BetaErrorResponse `json:"error" api:"required"`
Type constant.Errored `json:"type" default:"errored"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Error respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageBatchErroredResult) RawJSON ¶
func (r BetaMessageBatchErroredResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchErroredResult) UnmarshalJSON ¶
func (r *BetaMessageBatchErroredResult) UnmarshalJSON(data []byte) error
type BetaMessageBatchExpiredResult ¶
type BetaMessageBatchExpiredResult struct {
Type constant.Expired `json:"type" default:"expired"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageBatchExpiredResult) RawJSON ¶
func (r BetaMessageBatchExpiredResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchExpiredResult) UnmarshalJSON ¶
func (r *BetaMessageBatchExpiredResult) UnmarshalJSON(data []byte) error
type BetaMessageBatchGetParams ¶
type BetaMessageBatchGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMessageBatchIndividualResponse ¶
type BetaMessageBatchIndividualResponse struct {
// Developer-provided ID created for each request in a Message Batch. Useful for
// matching results to requests, as results may be given out of request order.
//
// Must be unique for each request within the Message Batch.
CustomID string `json:"custom_id" api:"required"`
// Processing result for this request.
//
// Contains a Message output if processing was successful, an error response if
// processing failed, or the reason why processing was not attempted, such as
// cancellation or expiration.
Result BetaMessageBatchResultUnion `json:"result" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CustomID respjson.Field
Result respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
This is a single line in the response `.jsonl` file and does not represent the response as a whole.
func (BetaMessageBatchIndividualResponse) RawJSON ¶
func (r BetaMessageBatchIndividualResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchIndividualResponse) UnmarshalJSON ¶
func (r *BetaMessageBatchIndividualResponse) UnmarshalJSON(data []byte) error
type BetaMessageBatchListParams ¶
type BetaMessageBatchListParams struct {
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately after this object.
AfterID param.Opt[string] `query:"after_id,omitzero" json:"-"`
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately before this object.
BeforeID param.Opt[string] `query:"before_id,omitzero" json:"-"`
// Number of items to return per page.
//
// Defaults to `20`. Ranges from `1` to `1000`.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMessageBatchListParams) URLQuery ¶
func (r BetaMessageBatchListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaMessageBatchListParams's query parameters as `url.Values`.
type BetaMessageBatchNewParams ¶
type BetaMessageBatchNewParams struct {
// List of requests for prompt completion. Each is an individual request to create
// a Message.
Requests []BetaMessageBatchNewParamsRequest `json:"requests,omitzero" api:"required"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMessageBatchNewParams) MarshalJSON ¶
func (r BetaMessageBatchNewParams) MarshalJSON() (data []byte, err error)
func (*BetaMessageBatchNewParams) UnmarshalJSON ¶
func (r *BetaMessageBatchNewParams) UnmarshalJSON(data []byte) error
type BetaMessageBatchNewParamsRequest ¶
type BetaMessageBatchNewParamsRequest struct {
// Developer-provided ID created for each request in a Message Batch. Useful for
// matching results to requests, as results may be given out of request order.
//
// Must be unique for each request within the Message Batch.
CustomID string `json:"custom_id" api:"required"`
// Messages API creation parameters for the individual request.
//
// See the [Messages API reference](https://docs.claude.com/en/api/messages) for
// full documentation on available parameters.
Params BetaMessageBatchNewParamsRequestParams `json:"params,omitzero" api:"required"`
// contains filtered or unexported fields
}
The properties CustomID, Params are required.
func (BetaMessageBatchNewParamsRequest) MarshalJSON ¶
func (r BetaMessageBatchNewParamsRequest) MarshalJSON() (data []byte, err error)
func (*BetaMessageBatchNewParamsRequest) UnmarshalJSON ¶
func (r *BetaMessageBatchNewParamsRequest) UnmarshalJSON(data []byte) error
type BetaMessageBatchNewParamsRequestParams ¶
type BetaMessageBatchNewParamsRequestParams struct {
// The maximum number of tokens to generate before stopping.
//
// Note that our models may stop _before_ reaching this maximum. This parameter
// only specifies the absolute maximum number of tokens to generate.
//
// Different models have different maximum values for this parameter. See
// [models](https://docs.claude.com/en/docs/models-overview) for details.
MaxTokens int64 `json:"max_tokens" api:"required"`
// Input messages.
//
// Our models are trained to operate on alternating `user` and `assistant`
// conversational turns. When creating a new `Message`, you specify the prior
// conversational turns with the `messages` parameter, and the model then generates
// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
// in your request will be combined into a single turn.
//
// Each input message must be an object with a `role` and `content`. You can
// specify a single `user`-role message, or you can include multiple `user` and
// `assistant` messages.
//
// If the final message uses the `assistant` role, the response content will
// continue immediately from the content in that message. This can be used to
// constrain part of the model's response.
//
// Example with a single `user` message:
//
// “`json
// [{ "role": "user", "content": "Hello, Claude" }]
// “`
//
// Example with multiple conversational turns:
//
// “`json
// [
//
// { "role": "user", "content": "Hello there." },
// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
// { "role": "user", "content": "Can you explain LLMs in plain English?" }
//
// ]
// “`
//
// Example with a partially-filled response from Claude:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Each input message `content` may be either a single `string` or an array of
// content blocks, where each block has a specific `type`. Using a `string` for
// `content` is shorthand for an array of one content block of type `"text"`. The
// following input messages are equivalent:
//
// “`json
// { "role": "user", "content": "Hello, Claude" }
// “`
//
// “`json
// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
// “`
//
// See [input examples](https://docs.claude.com/en/api/messages-examples).
//
// Note that if you want to include a
// [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
// top-level `system` parameter — there is no `"system"` role for input messages in
// the Messages API.
//
// There is a limit of 100,000 messages in a single request.
Messages []BetaMessageParam `json:"messages,omitzero" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// Specifies the geographic region for inference processing. If not specified, the
// workspace's `default_inference_geo` is used.
InferenceGeo param.Opt[string] `json:"inference_geo,omitzero"`
// The user profile ID to attribute this request to. Use when acting on behalf of a
// party other than your organization.
UserProfileID param.Opt[string] `json:"user_profile_id,omitzero"`
// Whether to incrementally stream the response using server-sent events.
//
// See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
Stream param.Opt[bool] `json:"stream,omitzero"`
// Amount of randomness injected into the response.
//
// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
// for analytical / multiple choice, and closer to `1.0` for creative and
// generative tasks.
//
// Note that even with `temperature` of `0.0`, the results will not be fully
// deterministic.
//
// Deprecated: Deprecated. Models released after Claude Opus 4.6 do not support
// setting temperature. A value of 1.0 of will be accepted for backwards
// compatibility, all other values will be rejected with a 400 error.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
// Only sample from the top K options for each subsequent token.
//
// Used to remove "long tail" low probability responses.
// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
//
// Recommended for advanced use cases only.
//
// Deprecated: Deprecated. Models released after Claude Opus 4.6 do not accept
// top_k; any value will be rejected with a 400 error.
TopK param.Opt[int64] `json:"top_k,omitzero"`
// Use nucleus sampling.
//
// In nucleus sampling, we compute the cumulative distribution over all the options
// for each subsequent token in decreasing probability order and cut it off once it
// reaches a particular probability specified by `top_p`.
//
// Recommended for advanced use cases only.
//
// Deprecated: Deprecated. Models released after Claude Opus 4.6 do not support
// setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all
// other values will be rejected with a 400 error.
TopP param.Opt[float64] `json:"top_p,omitzero"`
// Container identifier for reuse across requests.
Container BetaMessageBatchNewParamsRequestParamsContainerUnion `json:"container,omitzero"`
// The inference speed mode for this request. `"fast"` enables high
// output-tokens-per-second inference.
//
// Any of "standard", "fast".
Speed string `json:"speed,omitzero"`
// Top-level cache control automatically applies a cache_control marker to the last
// cacheable block in the request.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Context management configuration.
//
// This allows you to control how Claude manages context across multiple requests,
// such as whether to clear function results or not.
ContextManagement BetaContextManagementConfigParam `json:"context_management,omitzero"`
// MCP servers to be utilized in this request
MCPServers []BetaRequestMCPServerURLDefinitionParam `json:"mcp_servers,omitzero"`
// An object describing metadata about the request.
Metadata BetaMetadataParam `json:"metadata,omitzero"`
// Configuration options for the model's output, such as the output format.
OutputConfig BetaOutputConfigParam `json:"output_config,omitzero"`
// Deprecated: Use `output_config.format` instead. See
// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
//
// A schema to specify Claude's output format in responses. This parameter will be
// removed in a future release.
//
// Deprecated: deprecated
OutputFormat BetaJSONOutputFormatParam `json:"output_format,omitzero"`
// Determines whether to use priority capacity (if available) or standard capacity
// for this request.
//
// Anthropic offers different levels of service for your API requests. See
// [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
//
// Any of "auto", "standard_only".
ServiceTier string `json:"service_tier,omitzero"`
// Custom text sequences that will cause the model to stop generating.
//
// Our models will normally stop when they have naturally completed their turn,
// which will result in a response `stop_reason` of `"end_turn"`.
//
// If you want the model to stop generating when it encounters custom strings of
// text, you can use the `stop_sequences` parameter. If the model encounters one of
// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
// and the response `stop_sequence` value will contain the matched stop sequence.
StopSequences []string `json:"stop_sequences,omitzero"`
// System prompt.
//
// A system prompt is a way of providing context and instructions to Claude, such
// as specifying a particular goal or role. See our
// [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
System []BetaTextBlockParam `json:"system,omitzero"`
// Configuration for enabling Claude's extended thinking.
//
// When enabled, responses include `thinking` content blocks showing Claude's
// thinking process before the final answer. Requires a minimum budget of 1,024
// tokens and counts towards your `max_tokens` limit.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
Thinking BetaThinkingConfigParamUnion `json:"thinking,omitzero"`
// How the model should use the provided tools. The model can use a specific tool,
// any available tool, decide by itself, or not use tools at all.
ToolChoice BetaToolChoiceUnionParam `json:"tool_choice,omitzero"`
// Definitions of tools that the model may use.
//
// If you include `tools` in your API request, the model may return `tool_use`
// content blocks that represent the model's use of those tools. You can then run
// those tools using the tool input generated by the model and then optionally
// return results back to the model using `tool_result` content blocks.
//
// There are two types of tools: **client tools** and **server tools**. The
// behavior described below applies to client tools. For
// [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
// see their individual documentation as each has its own behavior (e.g., the
// [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
//
// Each tool definition includes:
//
// - `name`: Name of the tool.
// - `description`: Optional, but strongly-recommended description of the tool.
// - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
// tool `input` shape that the model will produce in `tool_use` output content
// blocks.
//
// For example, if you defined `tools` as:
//
// “`json
// [
//
// {
// "name": "get_stock_price",
// "description": "Get the current stock price for a given ticker symbol.",
// "input_schema": {
// "type": "object",
// "properties": {
// "ticker": {
// "type": "string",
// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
// }
// },
// "required": ["ticker"]
// }
// }
//
// ]
// “`
//
// And then asked the model "What's the S&P 500 at today?", the model might produce
// `tool_use` content blocks in the response like this:
//
// “`json
// [
//
// {
// "type": "tool_use",
// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "name": "get_stock_price",
// "input": { "ticker": "^GSPC" }
// }
//
// ]
// “`
//
// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
// input, and return the following back to the model in a subsequent `user`
// message:
//
// “`json
// [
//
// {
// "type": "tool_result",
// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "content": "259.75 USD"
// }
//
// ]
// “`
//
// Tools can be used for workflows that include running client-side tools and
// functions, or more generally whenever you want the model to produce a particular
// JSON structure of output.
//
// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
Tools []BetaToolUnionParam `json:"tools,omitzero"`
// contains filtered or unexported fields
}
Messages API creation parameters for the individual request.
See the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters.
The properties MaxTokens, Messages, Model are required.
func (BetaMessageBatchNewParamsRequestParams) MarshalJSON ¶
func (r BetaMessageBatchNewParamsRequestParams) MarshalJSON() (data []byte, err error)
func (*BetaMessageBatchNewParamsRequestParams) UnmarshalJSON ¶
func (r *BetaMessageBatchNewParamsRequestParams) UnmarshalJSON(data []byte) error
type BetaMessageBatchNewParamsRequestParamsContainerUnion ¶ added in v1.15.0
type BetaMessageBatchNewParamsRequestParamsContainerUnion struct {
OfContainers *BetaContainerParams `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaMessageBatchNewParamsRequestParamsContainerUnion) MarshalJSON ¶ added in v1.15.0
func (u BetaMessageBatchNewParamsRequestParamsContainerUnion) MarshalJSON() ([]byte, error)
func (*BetaMessageBatchNewParamsRequestParamsContainerUnion) UnmarshalJSON ¶ added in v1.15.0
func (u *BetaMessageBatchNewParamsRequestParamsContainerUnion) UnmarshalJSON(data []byte) error
type BetaMessageBatchProcessingStatus ¶
type BetaMessageBatchProcessingStatus string
Processing status of the Message Batch.
const ( BetaMessageBatchProcessingStatusInProgress BetaMessageBatchProcessingStatus = "in_progress" BetaMessageBatchProcessingStatusCanceling BetaMessageBatchProcessingStatus = "canceling" BetaMessageBatchProcessingStatusEnded BetaMessageBatchProcessingStatus = "ended" )
type BetaMessageBatchRequestCounts ¶
type BetaMessageBatchRequestCounts struct {
// Number of requests in the Message Batch that have been canceled.
//
// This is zero until processing of the entire Message Batch has ended.
Canceled int64 `json:"canceled" api:"required"`
// Number of requests in the Message Batch that encountered an error.
//
// This is zero until processing of the entire Message Batch has ended.
Errored int64 `json:"errored" api:"required"`
// Number of requests in the Message Batch that have expired.
//
// This is zero until processing of the entire Message Batch has ended.
Expired int64 `json:"expired" api:"required"`
// Number of requests in the Message Batch that are processing.
Processing int64 `json:"processing" api:"required"`
// Number of requests in the Message Batch that have completed successfully.
//
// This is zero until processing of the entire Message Batch has ended.
Succeeded int64 `json:"succeeded" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Canceled respjson.Field
Errored respjson.Field
Expired respjson.Field
Processing respjson.Field
Succeeded respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageBatchRequestCounts) RawJSON ¶
func (r BetaMessageBatchRequestCounts) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchRequestCounts) UnmarshalJSON ¶
func (r *BetaMessageBatchRequestCounts) UnmarshalJSON(data []byte) error
type BetaMessageBatchResultUnion ¶
type BetaMessageBatchResultUnion struct {
// This field is from variant [BetaMessageBatchSucceededResult].
Message BetaMessage `json:"message"`
// Any of "succeeded", "errored", "canceled", "expired".
Type string `json:"type"`
// This field is from variant [BetaMessageBatchErroredResult].
Error BetaErrorResponse `json:"error"`
JSON struct {
Message respjson.Field
Type respjson.Field
Error respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaMessageBatchResultUnion contains all possible properties and values from BetaMessageBatchSucceededResult, BetaMessageBatchErroredResult, BetaMessageBatchCanceledResult, BetaMessageBatchExpiredResult.
Use the BetaMessageBatchResultUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaMessageBatchResultUnion) AsAny ¶
func (u BetaMessageBatchResultUnion) AsAny() anyBetaMessageBatchResult
Use the following switch statement to find the correct variant
switch variant := BetaMessageBatchResultUnion.AsAny().(type) {
case anthropic.BetaMessageBatchSucceededResult:
case anthropic.BetaMessageBatchErroredResult:
case anthropic.BetaMessageBatchCanceledResult:
case anthropic.BetaMessageBatchExpiredResult:
default:
fmt.Errorf("no variant present")
}
func (BetaMessageBatchResultUnion) AsCanceled ¶
func (u BetaMessageBatchResultUnion) AsCanceled() (v BetaMessageBatchCanceledResult)
func (BetaMessageBatchResultUnion) AsErrored ¶
func (u BetaMessageBatchResultUnion) AsErrored() (v BetaMessageBatchErroredResult)
func (BetaMessageBatchResultUnion) AsExpired ¶
func (u BetaMessageBatchResultUnion) AsExpired() (v BetaMessageBatchExpiredResult)
func (BetaMessageBatchResultUnion) AsSucceeded ¶
func (u BetaMessageBatchResultUnion) AsSucceeded() (v BetaMessageBatchSucceededResult)
func (BetaMessageBatchResultUnion) RawJSON ¶
func (u BetaMessageBatchResultUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchResultUnion) UnmarshalJSON ¶
func (r *BetaMessageBatchResultUnion) UnmarshalJSON(data []byte) error
type BetaMessageBatchResultsParams ¶
type BetaMessageBatchResultsParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaMessageBatchService ¶
type BetaMessageBatchService struct {
Options []option.RequestOption
}
BetaMessageBatchService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaMessageBatchService method instead.
func NewBetaMessageBatchService ¶
func NewBetaMessageBatchService(opts ...option.RequestOption) (r BetaMessageBatchService)
NewBetaMessageBatchService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaMessageBatchService) Cancel ¶
func (r *BetaMessageBatchService) Cancel(ctx context.Context, messageBatchID string, body BetaMessageBatchCancelParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error)
Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*BetaMessageBatchService) Delete ¶
func (r *BetaMessageBatchService) Delete(ctx context.Context, messageBatchID string, body BetaMessageBatchDeleteParams, opts ...option.RequestOption) (res *BetaDeletedMessageBatch, err error)
Delete a Message Batch.
Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*BetaMessageBatchService) Get ¶
func (r *BetaMessageBatchService) Get(ctx context.Context, messageBatchID string, query BetaMessageBatchGetParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error)
This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*BetaMessageBatchService) List ¶
func (r *BetaMessageBatchService) List(ctx context.Context, params BetaMessageBatchListParams, opts ...option.RequestOption) (res *pagination.Page[BetaMessageBatch], err error)
List all Message Batches within a Workspace. Most recently created batches are returned first.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*BetaMessageBatchService) ListAutoPaging ¶
func (r *BetaMessageBatchService) ListAutoPaging(ctx context.Context, params BetaMessageBatchListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BetaMessageBatch]
List all Message Batches within a Workspace. Most recently created batches are returned first.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*BetaMessageBatchService) New ¶
func (r *BetaMessageBatchService) New(ctx context.Context, params BetaMessageBatchNewParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error)
Send a batch of Message creation requests.
The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*BetaMessageBatchService) ResultsStreaming ¶
func (r *BetaMessageBatchService) ResultsStreaming(ctx context.Context, messageBatchID string, query BetaMessageBatchResultsParams, opts ...option.RequestOption) (stream *jsonl.Stream[BetaMessageBatchIndividualResponse])
Streams the results of a Message Batch as a `.jsonl` file.
Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
type BetaMessageBatchSucceededResult ¶
type BetaMessageBatchSucceededResult struct {
Message BetaMessage `json:"message" api:"required"`
Type constant.Succeeded `json:"type" default:"succeeded"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageBatchSucceededResult) RawJSON ¶
func (r BetaMessageBatchSucceededResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageBatchSucceededResult) UnmarshalJSON ¶
func (r *BetaMessageBatchSucceededResult) UnmarshalJSON(data []byte) error
type BetaMessageCountTokensParams ¶
type BetaMessageCountTokensParams struct {
// Input messages.
//
// Our models are trained to operate on alternating `user` and `assistant`
// conversational turns. When creating a new `Message`, you specify the prior
// conversational turns with the `messages` parameter, and the model then generates
// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
// in your request will be combined into a single turn.
//
// Each input message must be an object with a `role` and `content`. You can
// specify a single `user`-role message, or you can include multiple `user` and
// `assistant` messages.
//
// If the final message uses the `assistant` role, the response content will
// continue immediately from the content in that message. This can be used to
// constrain part of the model's response.
//
// Example with a single `user` message:
//
// “`json
// [{ "role": "user", "content": "Hello, Claude" }]
// “`
//
// Example with multiple conversational turns:
//
// “`json
// [
//
// { "role": "user", "content": "Hello there." },
// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
// { "role": "user", "content": "Can you explain LLMs in plain English?" }
//
// ]
// “`
//
// Example with a partially-filled response from Claude:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Each input message `content` may be either a single `string` or an array of
// content blocks, where each block has a specific `type`. Using a `string` for
// `content` is shorthand for an array of one content block of type `"text"`. The
// following input messages are equivalent:
//
// “`json
// { "role": "user", "content": "Hello, Claude" }
// “`
//
// “`json
// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
// “`
//
// See [input examples](https://docs.claude.com/en/api/messages-examples).
//
// Note that if you want to include a
// [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
// top-level `system` parameter — there is no `"system"` role for input messages in
// the Messages API.
//
// There is a limit of 100,000 messages in a single request.
Messages []BetaMessageParam `json:"messages,omitzero" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// The inference speed mode for this request. `"fast"` enables high
// output-tokens-per-second inference.
//
// Any of "standard", "fast".
Speed BetaMessageCountTokensParamsSpeed `json:"speed,omitzero"`
// Top-level cache control automatically applies a cache_control marker to the last
// cacheable block in the request.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Context management configuration.
//
// This allows you to control how Claude manages context across multiple requests,
// such as whether to clear function results or not.
ContextManagement BetaContextManagementConfigParam `json:"context_management,omitzero"`
// MCP servers to be utilized in this request
MCPServers []BetaRequestMCPServerURLDefinitionParam `json:"mcp_servers,omitzero"`
// Configuration options for the model's output, such as the output format.
OutputConfig BetaOutputConfigParam `json:"output_config,omitzero"`
// Deprecated: Use `output_config.format` instead. See
// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
//
// A schema to specify Claude's output format in responses. This parameter will be
// removed in a future release.
OutputFormat BetaJSONOutputFormatParam `json:"output_format,omitzero"`
// System prompt.
//
// A system prompt is a way of providing context and instructions to Claude, such
// as specifying a particular goal or role. See our
// [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
System BetaMessageCountTokensParamsSystemUnion `json:"system,omitzero"`
// Configuration for enabling Claude's extended thinking.
//
// When enabled, responses include `thinking` content blocks showing Claude's
// thinking process before the final answer. Requires a minimum budget of 1,024
// tokens and counts towards your `max_tokens` limit.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
Thinking BetaThinkingConfigParamUnion `json:"thinking,omitzero"`
// How the model should use the provided tools. The model can use a specific tool,
// any available tool, decide by itself, or not use tools at all.
ToolChoice BetaToolChoiceUnionParam `json:"tool_choice,omitzero"`
// Definitions of tools that the model may use.
//
// If you include `tools` in your API request, the model may return `tool_use`
// content blocks that represent the model's use of those tools. You can then run
// those tools using the tool input generated by the model and then optionally
// return results back to the model using `tool_result` content blocks.
//
// There are two types of tools: **client tools** and **server tools**. The
// behavior described below applies to client tools. For
// [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
// see their individual documentation as each has its own behavior (e.g., the
// [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
//
// Each tool definition includes:
//
// - `name`: Name of the tool.
// - `description`: Optional, but strongly-recommended description of the tool.
// - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
// tool `input` shape that the model will produce in `tool_use` output content
// blocks.
//
// For example, if you defined `tools` as:
//
// “`json
// [
//
// {
// "name": "get_stock_price",
// "description": "Get the current stock price for a given ticker symbol.",
// "input_schema": {
// "type": "object",
// "properties": {
// "ticker": {
// "type": "string",
// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
// }
// },
// "required": ["ticker"]
// }
// }
//
// ]
// “`
//
// And then asked the model "What's the S&P 500 at today?", the model might produce
// `tool_use` content blocks in the response like this:
//
// “`json
// [
//
// {
// "type": "tool_use",
// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "name": "get_stock_price",
// "input": { "ticker": "^GSPC" }
// }
//
// ]
// “`
//
// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
// input, and return the following back to the model in a subsequent `user`
// message:
//
// “`json
// [
//
// {
// "type": "tool_result",
// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "content": "259.75 USD"
// }
//
// ]
// “`
//
// Tools can be used for workflows that include running client-side tools and
// functions, or more generally whenever you want the model to produce a particular
// JSON structure of output.
//
// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
Tools []BetaMessageCountTokensParamsToolUnion `json:"tools,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMessageCountTokensParams) MarshalJSON ¶
func (r BetaMessageCountTokensParams) MarshalJSON() (data []byte, err error)
func (*BetaMessageCountTokensParams) UnmarshalJSON ¶
func (r *BetaMessageCountTokensParams) UnmarshalJSON(data []byte) error
type BetaMessageCountTokensParamsSpeed ¶ added in v1.22.0
type BetaMessageCountTokensParamsSpeed string
The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference.
const ( BetaMessageCountTokensParamsSpeedStandard BetaMessageCountTokensParamsSpeed = "standard" BetaMessageCountTokensParamsSpeedFast BetaMessageCountTokensParamsSpeed = "fast" )
type BetaMessageCountTokensParamsSystemUnion ¶
type BetaMessageCountTokensParamsSystemUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfBetaTextBlockArray []BetaTextBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaMessageCountTokensParamsSystemUnion) MarshalJSON ¶
func (u BetaMessageCountTokensParamsSystemUnion) MarshalJSON() ([]byte, error)
func (*BetaMessageCountTokensParamsSystemUnion) UnmarshalJSON ¶
func (u *BetaMessageCountTokensParamsSystemUnion) UnmarshalJSON(data []byte) error
type BetaMessageCountTokensParamsToolUnion ¶
type BetaMessageCountTokensParamsToolUnion struct {
OfTool *BetaToolParam `json:",omitzero,inline"`
OfBashTool20241022 *BetaToolBash20241022Param `json:",omitzero,inline"`
OfBashTool20250124 *BetaToolBash20250124Param `json:",omitzero,inline"`
OfCodeExecutionTool20250522 *BetaCodeExecutionTool20250522Param `json:",omitzero,inline"`
OfCodeExecutionTool20250825 *BetaCodeExecutionTool20250825Param `json:",omitzero,inline"`
OfCodeExecutionTool20260120 *BetaCodeExecutionTool20260120Param `json:",omitzero,inline"`
OfComputerUseTool20241022 *BetaToolComputerUse20241022Param `json:",omitzero,inline"`
OfMemoryTool20250818 *BetaMemoryTool20250818Param `json:",omitzero,inline"`
OfComputerUseTool20250124 *BetaToolComputerUse20250124Param `json:",omitzero,inline"`
OfTextEditor20241022 *BetaToolTextEditor20241022Param `json:",omitzero,inline"`
OfComputerUseTool20251124 *BetaToolComputerUse20251124Param `json:",omitzero,inline"`
OfTextEditor20250124 *BetaToolTextEditor20250124Param `json:",omitzero,inline"`
OfTextEditor20250429 *BetaToolTextEditor20250429Param `json:",omitzero,inline"`
OfTextEditor20250728 *BetaToolTextEditor20250728Param `json:",omitzero,inline"`
OfWebSearchTool20250305 *BetaWebSearchTool20250305Param `json:",omitzero,inline"`
OfWebFetchTool20250910 *BetaWebFetchTool20250910Param `json:",omitzero,inline"`
OfWebSearchTool20260209 *BetaWebSearchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260209 *BetaWebFetchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260309 *BetaWebFetchTool20260309Param `json:",omitzero,inline"`
OfAdvisorTool20260301 *BetaAdvisorTool20260301Param `json:",omitzero,inline"`
OfToolSearchToolBm25_20251119 *BetaToolSearchToolBm25_20251119Param `json:",omitzero,inline"`
OfToolSearchToolRegex20251119 *BetaToolSearchToolRegex20251119Param `json:",omitzero,inline"`
OfMCPToolset *BetaMCPToolsetParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaMessageCountTokensParamsToolUnion) GetAllowedCallers ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetAllowedCallers() []string
Returns a pointer to the underlying variant's AllowedCallers property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetAllowedDomains ¶
func (u BetaMessageCountTokensParamsToolUnion) GetAllowedDomains() []string
Returns a pointer to the underlying variant's AllowedDomains property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetBlockedDomains ¶
func (u BetaMessageCountTokensParamsToolUnion) GetBlockedDomains() []string
Returns a pointer to the underlying variant's BlockedDomains property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetCacheControl ¶
func (u BetaMessageCountTokensParamsToolUnion) GetCacheControl() *BetaCacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetCaching ¶ added in v1.34.0
func (u BetaMessageCountTokensParamsToolUnion) GetCaching() *BetaCacheControlEphemeralParam
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetCitations ¶ added in v1.12.0
func (u BetaMessageCountTokensParamsToolUnion) GetCitations() *BetaCitationsConfigParam
Returns a pointer to the underlying variant's Citations property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetConfigs ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetConfigs() map[string]BetaMCPToolConfigParam
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetDefaultConfig ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetDefaultConfig() *BetaMCPToolDefaultConfigParam
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetDeferLoading ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetDeferLoading() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetDescription ¶
func (u BetaMessageCountTokensParamsToolUnion) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetDisplayHeightPx ¶
func (u BetaMessageCountTokensParamsToolUnion) GetDisplayHeightPx() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetDisplayNumber ¶
func (u BetaMessageCountTokensParamsToolUnion) GetDisplayNumber() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetDisplayWidthPx ¶
func (u BetaMessageCountTokensParamsToolUnion) GetDisplayWidthPx() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetEagerInputStreaming ¶ added in v1.21.0
func (u BetaMessageCountTokensParamsToolUnion) GetEagerInputStreaming() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetEnableZoom ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetEnableZoom() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetInputExamples ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetInputExamples() []map[string]any
Returns a pointer to the underlying variant's InputExamples property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetInputSchema ¶
func (u BetaMessageCountTokensParamsToolUnion) GetInputSchema() *BetaToolInputSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetMCPServerName ¶ added in v1.19.0
func (u BetaMessageCountTokensParamsToolUnion) GetMCPServerName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetMaxCharacters ¶ added in v1.7.0
func (u BetaMessageCountTokensParamsToolUnion) GetMaxCharacters() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetMaxContentTokens ¶ added in v1.12.0
func (u BetaMessageCountTokensParamsToolUnion) GetMaxContentTokens() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetMaxUses ¶
func (u BetaMessageCountTokensParamsToolUnion) GetMaxUses() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetModel ¶ added in v1.34.0
func (u BetaMessageCountTokensParamsToolUnion) GetModel() *Model
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetName ¶
func (u BetaMessageCountTokensParamsToolUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetStrict ¶ added in v1.18.0
func (u BetaMessageCountTokensParamsToolUnion) GetStrict() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetType ¶
func (u BetaMessageCountTokensParamsToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetUseCache ¶ added in v1.27.0
func (u BetaMessageCountTokensParamsToolUnion) GetUseCache() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaMessageCountTokensParamsToolUnion) GetUserLocation ¶
func (u BetaMessageCountTokensParamsToolUnion) GetUserLocation() *BetaUserLocationParam
Returns a pointer to the underlying variant's UserLocation property, if present.
func (BetaMessageCountTokensParamsToolUnion) MarshalJSON ¶
func (u BetaMessageCountTokensParamsToolUnion) MarshalJSON() ([]byte, error)
func (*BetaMessageCountTokensParamsToolUnion) UnmarshalJSON ¶
func (u *BetaMessageCountTokensParamsToolUnion) UnmarshalJSON(data []byte) error
type BetaMessageDeltaUsage ¶
type BetaMessageDeltaUsage struct {
// The cumulative number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The cumulative number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The cumulative number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// Per-iteration token usage breakdown.
//
// Each entry represents one sampling iteration, with its own input/output token
// counts and cache statistics. This allows you to:
//
// - Determine which iterations exceeded long context thresholds (>=200k tokens)
// - Calculate the true context window size from the last iteration
// - Understand token accumulation across server-side tool use loops
Iterations BetaIterationsUsage `json:"iterations" api:"required"`
// The cumulative number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// The number of server tool requests.
ServerToolUse BetaServerToolUsage `json:"server_tool_use" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
Iterations respjson.Field
OutputTokens respjson.Field
ServerToolUse respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageDeltaUsage) RawJSON ¶
func (r BetaMessageDeltaUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageDeltaUsage) UnmarshalJSON ¶
func (r *BetaMessageDeltaUsage) UnmarshalJSON(data []byte) error
type BetaMessageIterationUsage ¶ added in v1.21.0
type BetaMessageIterationUsage struct {
// Breakdown of cached tokens by TTL
CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
// The number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// The number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// Usage for a sampling iteration
Type constant.Message `json:"type" default:"message"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreation respjson.Field
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Token usage for a sampling iteration.
func (BetaMessageIterationUsage) RawJSON ¶ added in v1.21.0
func (r BetaMessageIterationUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageIterationUsage) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaMessageIterationUsage) UnmarshalJSON(data []byte) error
type BetaMessageNewParams ¶
type BetaMessageNewParams struct {
// The maximum number of tokens to generate before stopping.
//
// Note that our models may stop _before_ reaching this maximum. This parameter
// only specifies the absolute maximum number of tokens to generate.
//
// Different models have different maximum values for this parameter. See
// [models](https://docs.claude.com/en/docs/models-overview) for details.
MaxTokens int64 `json:"max_tokens" api:"required"`
// Input messages.
//
// Our models are trained to operate on alternating `user` and `assistant`
// conversational turns. When creating a new `Message`, you specify the prior
// conversational turns with the `messages` parameter, and the model then generates
// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
// in your request will be combined into a single turn.
//
// Each input message must be an object with a `role` and `content`. You can
// specify a single `user`-role message, or you can include multiple `user` and
// `assistant` messages.
//
// If the final message uses the `assistant` role, the response content will
// continue immediately from the content in that message. This can be used to
// constrain part of the model's response.
//
// Example with a single `user` message:
//
// “`json
// [{ "role": "user", "content": "Hello, Claude" }]
// “`
//
// Example with multiple conversational turns:
//
// “`json
// [
//
// { "role": "user", "content": "Hello there." },
// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
// { "role": "user", "content": "Can you explain LLMs in plain English?" }
//
// ]
// “`
//
// Example with a partially-filled response from Claude:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Each input message `content` may be either a single `string` or an array of
// content blocks, where each block has a specific `type`. Using a `string` for
// `content` is shorthand for an array of one content block of type `"text"`. The
// following input messages are equivalent:
//
// “`json
// { "role": "user", "content": "Hello, Claude" }
// “`
//
// “`json
// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
// “`
//
// See [input examples](https://docs.claude.com/en/api/messages-examples).
//
// Note that if you want to include a
// [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
// top-level `system` parameter — there is no `"system"` role for input messages in
// the Messages API.
//
// There is a limit of 100,000 messages in a single request.
Messages []BetaMessageParam `json:"messages,omitzero" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// Specifies the geographic region for inference processing. If not specified, the
// workspace's `default_inference_geo` is used.
InferenceGeo param.Opt[string] `json:"inference_geo,omitzero"`
// The user profile ID to attribute this request to. Use when acting on behalf of a
// party other than your organization.
UserProfileID param.Opt[string] `json:"user_profile_id,omitzero"`
// Amount of randomness injected into the response.
//
// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
// for analytical / multiple choice, and closer to `1.0` for creative and
// generative tasks.
//
// Note that even with `temperature` of `0.0`, the results will not be fully
// deterministic.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
// Only sample from the top K options for each subsequent token.
//
// Used to remove "long tail" low probability responses.
// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
//
// Recommended for advanced use cases only.
TopK param.Opt[int64] `json:"top_k,omitzero"`
// Use nucleus sampling.
//
// In nucleus sampling, we compute the cumulative distribution over all the options
// for each subsequent token in decreasing probability order and cut it off once it
// reaches a particular probability specified by `top_p`.
//
// Recommended for advanced use cases only.
TopP param.Opt[float64] `json:"top_p,omitzero"`
// Container identifier for reuse across requests.
Container BetaMessageNewParamsContainerUnion `json:"container,omitzero"`
// The inference speed mode for this request. `"fast"` enables high
// output-tokens-per-second inference.
//
// Any of "standard", "fast".
Speed BetaMessageNewParamsSpeed `json:"speed,omitzero"`
// Top-level cache control automatically applies a cache_control marker to the last
// cacheable block in the request.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Context management configuration.
//
// This allows you to control how Claude manages context across multiple requests,
// such as whether to clear function results or not.
ContextManagement BetaContextManagementConfigParam `json:"context_management,omitzero"`
// MCP servers to be utilized in this request
MCPServers []BetaRequestMCPServerURLDefinitionParam `json:"mcp_servers,omitzero"`
// An object describing metadata about the request.
Metadata BetaMetadataParam `json:"metadata,omitzero"`
// Configuration options for the model's output, such as the output format.
OutputConfig BetaOutputConfigParam `json:"output_config,omitzero"`
// Deprecated: Use `output_config.format` instead. See
// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
//
// A schema to specify Claude's output format in responses. This parameter will be
// removed in a future release.
OutputFormat BetaJSONOutputFormatParam `json:"output_format,omitzero"`
// Determines whether to use priority capacity (if available) or standard capacity
// for this request.
//
// Anthropic offers different levels of service for your API requests. See
// [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
//
// Any of "auto", "standard_only".
ServiceTier BetaMessageNewParamsServiceTier `json:"service_tier,omitzero"`
// Custom text sequences that will cause the model to stop generating.
//
// Our models will normally stop when they have naturally completed their turn,
// which will result in a response `stop_reason` of `"end_turn"`.
//
// If you want the model to stop generating when it encounters custom strings of
// text, you can use the `stop_sequences` parameter. If the model encounters one of
// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
// and the response `stop_sequence` value will contain the matched stop sequence.
StopSequences []string `json:"stop_sequences,omitzero"`
// System prompt.
//
// A system prompt is a way of providing context and instructions to Claude, such
// as specifying a particular goal or role. See our
// [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
System []BetaTextBlockParam `json:"system,omitzero"`
// Configuration for enabling Claude's extended thinking.
//
// When enabled, responses include `thinking` content blocks showing Claude's
// thinking process before the final answer. Requires a minimum budget of 1,024
// tokens and counts towards your `max_tokens` limit.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
Thinking BetaThinkingConfigParamUnion `json:"thinking,omitzero"`
// How the model should use the provided tools. The model can use a specific tool,
// any available tool, decide by itself, or not use tools at all.
ToolChoice BetaToolChoiceUnionParam `json:"tool_choice,omitzero"`
// Definitions of tools that the model may use.
//
// If you include `tools` in your API request, the model may return `tool_use`
// content blocks that represent the model's use of those tools. You can then run
// those tools using the tool input generated by the model and then optionally
// return results back to the model using `tool_result` content blocks.
//
// There are two types of tools: **client tools** and **server tools**. The
// behavior described below applies to client tools. For
// [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
// see their individual documentation as each has its own behavior (e.g., the
// [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
//
// Each tool definition includes:
//
// - `name`: Name of the tool.
// - `description`: Optional, but strongly-recommended description of the tool.
// - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
// tool `input` shape that the model will produce in `tool_use` output content
// blocks.
//
// For example, if you defined `tools` as:
//
// “`json
// [
//
// {
// "name": "get_stock_price",
// "description": "Get the current stock price for a given ticker symbol.",
// "input_schema": {
// "type": "object",
// "properties": {
// "ticker": {
// "type": "string",
// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
// }
// },
// "required": ["ticker"]
// }
// }
//
// ]
// “`
//
// And then asked the model "What's the S&P 500 at today?", the model might produce
// `tool_use` content blocks in the response like this:
//
// “`json
// [
//
// {
// "type": "tool_use",
// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "name": "get_stock_price",
// "input": { "ticker": "^GSPC" }
// }
//
// ]
// “`
//
// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
// input, and return the following back to the model in a subsequent `user`
// message:
//
// “`json
// [
//
// {
// "type": "tool_result",
// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "content": "259.75 USD"
// }
//
// ]
// “`
//
// Tools can be used for workflows that include running client-side tools and
// functions, or more generally whenever you want the model to produce a particular
// JSON structure of output.
//
// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
Tools []BetaToolUnionParam `json:"tools,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaMessageNewParams) MarshalJSON ¶
func (r BetaMessageNewParams) MarshalJSON() (data []byte, err error)
func (*BetaMessageNewParams) UnmarshalJSON ¶
func (r *BetaMessageNewParams) UnmarshalJSON(data []byte) error
type BetaMessageNewParamsContainerUnion ¶ added in v1.15.0
type BetaMessageNewParamsContainerUnion struct {
OfContainers *BetaContainerParams `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaMessageNewParamsContainerUnion) MarshalJSON ¶ added in v1.15.0
func (u BetaMessageNewParamsContainerUnion) MarshalJSON() ([]byte, error)
func (*BetaMessageNewParamsContainerUnion) UnmarshalJSON ¶ added in v1.15.0
func (u *BetaMessageNewParamsContainerUnion) UnmarshalJSON(data []byte) error
type BetaMessageNewParamsServiceTier ¶ added in v1.2.0
type BetaMessageNewParamsServiceTier string
Determines whether to use priority capacity (if available) or standard capacity for this request.
Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
const ( BetaMessageNewParamsServiceTierAuto BetaMessageNewParamsServiceTier = "auto" BetaMessageNewParamsServiceTierStandardOnly BetaMessageNewParamsServiceTier = "standard_only" )
type BetaMessageNewParamsSpeed ¶ added in v1.22.0
type BetaMessageNewParamsSpeed string
The inference speed mode for this request. `"fast"` enables high output-tokens-per-second inference.
const ( BetaMessageNewParamsSpeedStandard BetaMessageNewParamsSpeed = "standard" BetaMessageNewParamsSpeedFast BetaMessageNewParamsSpeed = "fast" )
type BetaMessageParam ¶
type BetaMessageParam struct {
Content []BetaContentBlockParamUnion `json:"content,omitzero" api:"required"`
// Any of "user", "assistant".
Role BetaMessageParamRole `json:"role,omitzero" api:"required"`
// contains filtered or unexported fields
}
The properties Content, Role are required.
func NewBetaUserMessage ¶ added in v1.2.0
func NewBetaUserMessage(blocks ...BetaContentBlockParamUnion) BetaMessageParam
func (BetaMessageParam) MarshalJSON ¶
func (r BetaMessageParam) MarshalJSON() (data []byte, err error)
func (*BetaMessageParam) UnmarshalJSON ¶
func (r *BetaMessageParam) UnmarshalJSON(data []byte) error
type BetaMessageParamRole ¶
type BetaMessageParamRole string
const ( BetaMessageParamRoleUser BetaMessageParamRole = "user" BetaMessageParamRoleAssistant BetaMessageParamRole = "assistant" )
type BetaMessageService ¶
type BetaMessageService struct {
Options []option.RequestOption
Batches BetaMessageBatchService
}
BetaMessageService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaMessageService method instead.
func NewBetaMessageService ¶
func NewBetaMessageService(opts ...option.RequestOption) (r BetaMessageService)
NewBetaMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaMessageService) CountTokens ¶
func (r *BetaMessageService) CountTokens(ctx context.Context, params BetaMessageCountTokensParams, opts ...option.RequestOption) (res *BetaMessageTokensCount, err error)
Count the number of tokens in a Message.
The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.
Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
func (*BetaMessageService) New ¶
func (r *BetaMessageService) New(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (res *BetaMessage, err error)
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)
Note: If you choose to set a timeout for this request, we recommend 10 minutes.
func (*BetaMessageService) NewStreaming ¶
func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[BetaRawMessageStreamEventUnion])
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)
Note: If you choose to set a timeout for this request, we recommend 10 minutes.
func (*BetaMessageService) NewToolRunner ¶ added in v1.26.0
func (r *BetaMessageService) NewToolRunner(tools []BetaTool, params BetaToolRunnerParams, opts ...option.RequestOption) *BetaToolRunner
NewToolRunner creates a BetaToolRunner that automatically handles the loop between the model generating tool calls, executing those tool calls, and sending the results back to the model until a final answer is produced or the maximum number of iterations is reached.
func (*BetaMessageService) NewToolRunnerStreaming ¶ added in v1.26.0
func (r *BetaMessageService) NewToolRunnerStreaming(tools []BetaTool, params BetaToolRunnerParams, opts ...option.RequestOption) *BetaToolRunnerStreaming
NewToolRunnerStreaming creates a BetaToolRunnerStreaming that automatically handles the loop between the model generating tool calls, executing those tool calls, and sending the results back to the model using streaming API calls until a final answer is produced or the maximum number of iterations is reached.
type BetaMessageTokensCount ¶
type BetaMessageTokensCount struct {
// Information about context management applied to the message.
ContextManagement BetaCountTokensContextManagementResponse `json:"context_management" api:"required"`
// The total number of tokens across the provided list of messages, system prompt,
// and tools.
InputTokens int64 `json:"input_tokens" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ContextManagement respjson.Field
InputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaMessageTokensCount) RawJSON ¶
func (r BetaMessageTokensCount) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaMessageTokensCount) UnmarshalJSON ¶
func (r *BetaMessageTokensCount) UnmarshalJSON(data []byte) error
type BetaMetadataParam ¶
type BetaMetadataParam struct {
// An external identifier for the user who is associated with the request.
//
// This should be a uuid, hash value, or other opaque identifier. Anthropic may use
// this id to help detect abuse. Do not include any identifying information such as
// name, email address, or phone number.
UserID param.Opt[string] `json:"user_id,omitzero"`
// contains filtered or unexported fields
}
func (BetaMetadataParam) MarshalJSON ¶
func (r BetaMetadataParam) MarshalJSON() (data []byte, err error)
func (*BetaMetadataParam) UnmarshalJSON ¶
func (r *BetaMetadataParam) UnmarshalJSON(data []byte) error
type BetaModelCapabilities ¶ added in v1.27.1
type BetaModelCapabilities struct {
// Whether the model supports the Batch API.
Batch BetaCapabilitySupport `json:"batch" api:"required"`
// Whether the model supports citation generation.
Citations BetaCapabilitySupport `json:"citations" api:"required"`
// Whether the model supports code execution tools.
CodeExecution BetaCapabilitySupport `json:"code_execution" api:"required"`
// Context management support and available strategies.
ContextManagement BetaContextManagementCapability `json:"context_management" api:"required"`
// Effort (reasoning_effort) support and available levels.
Effort BetaEffortCapability `json:"effort" api:"required"`
// Whether the model accepts image content blocks.
ImageInput BetaCapabilitySupport `json:"image_input" api:"required"`
// Whether the model accepts PDF content blocks.
PDFInput BetaCapabilitySupport `json:"pdf_input" api:"required"`
// Whether the model supports structured output / JSON mode / strict tool schemas.
StructuredOutputs BetaCapabilitySupport `json:"structured_outputs" api:"required"`
// Thinking capability and supported type configurations.
Thinking BetaThinkingCapability `json:"thinking" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Batch respjson.Field
Citations respjson.Field
CodeExecution respjson.Field
ContextManagement respjson.Field
Effort respjson.Field
ImageInput respjson.Field
PDFInput respjson.Field
StructuredOutputs respjson.Field
Thinking respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Model capability information.
func (BetaModelCapabilities) RawJSON ¶ added in v1.27.1
func (r BetaModelCapabilities) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaModelCapabilities) UnmarshalJSON ¶ added in v1.27.1
func (r *BetaModelCapabilities) UnmarshalJSON(data []byte) error
type BetaModelGetParams ¶
type BetaModelGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaModelInfo ¶
type BetaModelInfo struct {
// Unique model identifier.
ID string `json:"id" api:"required"`
// Model capability information.
Capabilities BetaModelCapabilities `json:"capabilities" api:"required"`
// RFC 3339 datetime string representing the time at which the model was released.
// May be set to an epoch value if the release date is unknown.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// A human-readable name for the model.
DisplayName string `json:"display_name" api:"required"`
// Maximum input context window size in tokens for this model.
MaxInputTokens int64 `json:"max_input_tokens" api:"required"`
// Maximum value for the `max_tokens` parameter when using this model.
MaxTokens int64 `json:"max_tokens" api:"required"`
// Object type.
//
// For Models, this is always `"model"`.
Type constant.Model `json:"type" default:"model"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Capabilities respjson.Field
CreatedAt respjson.Field
DisplayName respjson.Field
MaxInputTokens respjson.Field
MaxTokens respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaModelInfo) RawJSON ¶
func (r BetaModelInfo) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaModelInfo) UnmarshalJSON ¶
func (r *BetaModelInfo) UnmarshalJSON(data []byte) error
type BetaModelListParams ¶
type BetaModelListParams struct {
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately after this object.
AfterID param.Opt[string] `query:"after_id,omitzero" json:"-"`
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately before this object.
BeforeID param.Opt[string] `query:"before_id,omitzero" json:"-"`
// Number of items to return per page.
//
// Defaults to `20`. Ranges from `1` to `1000`.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaModelListParams) URLQuery ¶
func (r BetaModelListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaModelListParams's query parameters as `url.Values`.
type BetaModelService ¶
type BetaModelService struct {
Options []option.RequestOption
}
BetaModelService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaModelService method instead.
func NewBetaModelService ¶
func NewBetaModelService(opts ...option.RequestOption) (r BetaModelService)
NewBetaModelService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaModelService) Get ¶
func (r *BetaModelService) Get(ctx context.Context, modelID string, query BetaModelGetParams, opts ...option.RequestOption) (res *BetaModelInfo, err error)
Get a specific model.
The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.
func (*BetaModelService) List ¶
func (r *BetaModelService) List(ctx context.Context, params BetaModelListParams, opts ...option.RequestOption) (res *pagination.Page[BetaModelInfo], err error)
List available models.
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
func (*BetaModelService) ListAutoPaging ¶
func (r *BetaModelService) ListAutoPaging(ctx context.Context, params BetaModelListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BetaModelInfo]
List available models.
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
type BetaNotFoundError ¶
type BetaNotFoundError struct {
Message string `json:"message" api:"required"`
Type constant.NotFoundError `json:"type" default:"not_found_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaNotFoundError) RawJSON ¶
func (r BetaNotFoundError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaNotFoundError) UnmarshalJSON ¶
func (r *BetaNotFoundError) UnmarshalJSON(data []byte) error
type BetaOutputConfigEffort ¶ added in v1.19.0
type BetaOutputConfigEffort string
All possible effort levels.
const ( BetaOutputConfigEffortLow BetaOutputConfigEffort = "low" BetaOutputConfigEffortMedium BetaOutputConfigEffort = "medium" BetaOutputConfigEffortHigh BetaOutputConfigEffort = "high" BetaOutputConfigEffortXhigh BetaOutputConfigEffort = "xhigh" BetaOutputConfigEffortMax BetaOutputConfigEffort = "max" )
type BetaOutputConfigParam ¶ added in v1.19.0
type BetaOutputConfigParam struct {
// All possible effort levels.
//
// Any of "low", "medium", "high", "xhigh", "max".
Effort BetaOutputConfigEffort `json:"effort,omitzero"`
// A schema to specify Claude's output format in responses. See
// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
Format BetaJSONOutputFormatParam `json:"format,omitzero"`
// User-configurable total token budget across contexts.
TaskBudget BetaTokenTaskBudgetParam `json:"task_budget,omitzero"`
// contains filtered or unexported fields
}
func (BetaOutputConfigParam) MarshalJSON ¶ added in v1.19.0
func (r BetaOutputConfigParam) MarshalJSON() (data []byte, err error)
func (*BetaOutputConfigParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaOutputConfigParam) UnmarshalJSON(data []byte) error
type BetaOverloadedError ¶
type BetaOverloadedError struct {
Message string `json:"message" api:"required"`
Type constant.OverloadedError `json:"type" default:"overloaded_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaOverloadedError) RawJSON ¶
func (r BetaOverloadedError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaOverloadedError) UnmarshalJSON ¶
func (r *BetaOverloadedError) UnmarshalJSON(data []byte) error
type BetaPackages ¶ added in v1.33.0
type BetaPackages struct {
// Ubuntu/Debian packages to install
Apt []string `json:"apt" api:"required"`
// Rust packages to install
Cargo []string `json:"cargo" api:"required"`
// Ruby packages to install
Gem []string `json:"gem" api:"required"`
// Go packages to install
Go []string `json:"go" api:"required"`
// Node.js packages to install
Npm []string `json:"npm" api:"required"`
// Python packages to install
Pip []string `json:"pip" api:"required"`
// Package configuration type
//
// Any of "packages".
Type BetaPackagesType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Apt respjson.Field
Cargo respjson.Field
Gem respjson.Field
Go respjson.Field
Npm respjson.Field
Pip respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Packages (and their versions) available in this environment.
func (BetaPackages) RawJSON ¶ added in v1.33.0
func (r BetaPackages) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaPackages) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaPackages) UnmarshalJSON(data []byte) error
type BetaPackagesParams ¶ added in v1.33.0
type BetaPackagesParams struct {
// Ubuntu/Debian packages to install
Apt []string `json:"apt,omitzero"`
// Rust packages to install
Cargo []string `json:"cargo,omitzero"`
// Ruby packages to install
Gem []string `json:"gem,omitzero"`
// Go packages to install
Go []string `json:"go,omitzero"`
// Node.js packages to install
Npm []string `json:"npm,omitzero"`
// Python packages to install
Pip []string `json:"pip,omitzero"`
// Package configuration type
//
// Any of "packages".
Type BetaPackagesParamsType `json:"type,omitzero"`
// contains filtered or unexported fields
}
Specify packages (and optionally their versions) available in this environment.
When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.
func (BetaPackagesParams) MarshalJSON ¶ added in v1.33.0
func (r BetaPackagesParams) MarshalJSON() (data []byte, err error)
func (*BetaPackagesParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaPackagesParams) UnmarshalJSON(data []byte) error
type BetaPackagesParamsType ¶ added in v1.33.0
type BetaPackagesParamsType string
Package configuration type
const (
BetaPackagesParamsTypePackages BetaPackagesParamsType = "packages"
)
type BetaPackagesType ¶ added in v1.33.0
type BetaPackagesType string
Package configuration type
const (
BetaPackagesTypePackages BetaPackagesType = "packages"
)
type BetaPermissionError ¶
type BetaPermissionError struct {
Message string `json:"message" api:"required"`
Type constant.PermissionError `json:"type" default:"permission_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaPermissionError) RawJSON ¶
func (r BetaPermissionError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaPermissionError) UnmarshalJSON ¶
func (r *BetaPermissionError) UnmarshalJSON(data []byte) error
type BetaPlainTextSource ¶ added in v1.12.0
type BetaPlainTextSource struct {
Data string `json:"data" api:"required"`
MediaType constant.TextPlain `json:"media_type" default:"text/plain"`
Type constant.Text `json:"type" default:"text"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaPlainTextSource) RawJSON ¶ added in v1.12.0
func (r BetaPlainTextSource) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaPlainTextSource) ToParam ¶ added in v1.12.0
func (r BetaPlainTextSource) ToParam() BetaPlainTextSourceParam
ToParam converts this BetaPlainTextSource to a BetaPlainTextSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaPlainTextSourceParam.Overrides()
func (*BetaPlainTextSource) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaPlainTextSource) UnmarshalJSON(data []byte) error
type BetaPlainTextSourceParam ¶
type BetaPlainTextSourceParam struct {
Data string `json:"data" api:"required"`
// This field can be elided, and will marshal its zero value as "text/plain".
MediaType constant.TextPlain `json:"media_type" default:"text/plain"`
// This field can be elided, and will marshal its zero value as "text".
Type constant.Text `json:"type" default:"text"`
// contains filtered or unexported fields
}
The properties Data, MediaType, Type are required.
func (BetaPlainTextSourceParam) MarshalJSON ¶
func (r BetaPlainTextSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaPlainTextSourceParam) UnmarshalJSON ¶
func (r *BetaPlainTextSourceParam) UnmarshalJSON(data []byte) error
type BetaRateLimitError ¶
type BetaRateLimitError struct {
Message string `json:"message" api:"required"`
Type constant.RateLimitError `json:"type" default:"rate_limit_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRateLimitError) RawJSON ¶
func (r BetaRateLimitError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRateLimitError) UnmarshalJSON ¶
func (r *BetaRateLimitError) UnmarshalJSON(data []byte) error
type BetaRawContentBlockDeltaEvent ¶
type BetaRawContentBlockDeltaEvent struct {
Delta BetaRawContentBlockDeltaUnion `json:"delta" api:"required"`
Index int64 `json:"index" api:"required"`
Type constant.ContentBlockDelta `json:"type" default:"content_block_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Delta respjson.Field
Index respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawContentBlockDeltaEvent) RawJSON ¶
func (r BetaRawContentBlockDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawContentBlockDeltaEvent) UnmarshalJSON ¶
func (r *BetaRawContentBlockDeltaEvent) UnmarshalJSON(data []byte) error
type BetaRawContentBlockDeltaUnion ¶
type BetaRawContentBlockDeltaUnion struct {
// This field is from variant [BetaTextDelta].
Text string `json:"text"`
// Any of "text_delta", "input_json_delta", "citations_delta", "thinking_delta",
// "signature_delta", "compaction_delta".
Type string `json:"type"`
// This field is from variant [BetaInputJSONDelta].
PartialJSON string `json:"partial_json"`
// This field is from variant [BetaCitationsDelta].
Citation BetaCitationsDeltaCitationUnion `json:"citation"`
// This field is from variant [BetaThinkingDelta].
Thinking string `json:"thinking"`
// This field is from variant [BetaSignatureDelta].
Signature string `json:"signature"`
// This field is from variant [BetaCompactionContentBlockDelta].
Content string `json:"content"`
// This field is from variant [BetaCompactionContentBlockDelta].
EncryptedContent string `json:"encrypted_content"`
JSON struct {
Text respjson.Field
Type respjson.Field
PartialJSON respjson.Field
Citation respjson.Field
Thinking respjson.Field
Signature respjson.Field
Content respjson.Field
EncryptedContent respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawContentBlockDeltaUnion contains all possible properties and values from BetaTextDelta, BetaInputJSONDelta, BetaCitationsDelta, BetaThinkingDelta, BetaSignatureDelta, BetaCompactionContentBlockDelta.
Use the BetaRawContentBlockDeltaUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaRawContentBlockDeltaUnion) AsAny ¶
func (u BetaRawContentBlockDeltaUnion) AsAny() anyBetaRawContentBlockDelta
Use the following switch statement to find the correct variant
switch variant := BetaRawContentBlockDeltaUnion.AsAny().(type) {
case anthropic.BetaTextDelta:
case anthropic.BetaInputJSONDelta:
case anthropic.BetaCitationsDelta:
case anthropic.BetaThinkingDelta:
case anthropic.BetaSignatureDelta:
case anthropic.BetaCompactionContentBlockDelta:
default:
fmt.Errorf("no variant present")
}
func (BetaRawContentBlockDeltaUnion) AsCitationsDelta ¶
func (u BetaRawContentBlockDeltaUnion) AsCitationsDelta() (v BetaCitationsDelta)
func (BetaRawContentBlockDeltaUnion) AsCompactionDelta ¶ added in v1.21.0
func (u BetaRawContentBlockDeltaUnion) AsCompactionDelta() (v BetaCompactionContentBlockDelta)
func (BetaRawContentBlockDeltaUnion) AsInputJSONDelta ¶
func (u BetaRawContentBlockDeltaUnion) AsInputJSONDelta() (v BetaInputJSONDelta)
func (BetaRawContentBlockDeltaUnion) AsSignatureDelta ¶
func (u BetaRawContentBlockDeltaUnion) AsSignatureDelta() (v BetaSignatureDelta)
func (BetaRawContentBlockDeltaUnion) AsTextDelta ¶
func (u BetaRawContentBlockDeltaUnion) AsTextDelta() (v BetaTextDelta)
func (BetaRawContentBlockDeltaUnion) AsThinkingDelta ¶
func (u BetaRawContentBlockDeltaUnion) AsThinkingDelta() (v BetaThinkingDelta)
func (BetaRawContentBlockDeltaUnion) RawJSON ¶
func (u BetaRawContentBlockDeltaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawContentBlockDeltaUnion) UnmarshalJSON ¶
func (r *BetaRawContentBlockDeltaUnion) UnmarshalJSON(data []byte) error
type BetaRawContentBlockStartEvent ¶
type BetaRawContentBlockStartEvent struct {
// Response model for a file uploaded to the container.
ContentBlock BetaRawContentBlockStartEventContentBlockUnion `json:"content_block" api:"required"`
Index int64 `json:"index" api:"required"`
Type constant.ContentBlockStart `json:"type" default:"content_block_start"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ContentBlock respjson.Field
Index respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawContentBlockStartEvent) RawJSON ¶
func (r BetaRawContentBlockStartEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawContentBlockStartEvent) UnmarshalJSON ¶
func (r *BetaRawContentBlockStartEvent) UnmarshalJSON(data []byte) error
type BetaRawContentBlockStartEventContentBlockUnion ¶
type BetaRawContentBlockStartEventContentBlockUnion struct {
// This field is from variant [BetaTextBlock].
Citations []BetaTextCitationUnion `json:"citations"`
// This field is from variant [BetaTextBlock].
Text string `json:"text"`
// Any of "text", "thinking", "redacted_thinking", "tool_use", "server_tool_use",
// "web_search_tool_result", "web_fetch_tool_result", "advisor_tool_result",
// "code_execution_tool_result", "bash_code_execution_tool_result",
// "text_editor_code_execution_tool_result", "tool_search_tool_result",
// "mcp_tool_use", "mcp_tool_result", "container_upload", "compaction".
Type string `json:"type"`
// This field is from variant [BetaThinkingBlock].
Signature string `json:"signature"`
// This field is from variant [BetaThinkingBlock].
Thinking string `json:"thinking"`
// This field is from variant [BetaRedactedThinkingBlock].
Data string `json:"data"`
ID string `json:"id"`
Input any `json:"input"`
Name string `json:"name"`
// This field is a union of [BetaToolUseBlockCallerUnion],
// [BetaServerToolUseBlockCallerUnion], [BetaWebSearchToolResultBlockCallerUnion],
// [BetaWebFetchToolResultBlockCallerUnion]
Caller BetaRawContentBlockStartEventContentBlockUnionCaller `json:"caller"`
// This field is a union of [BetaWebSearchToolResultBlockContentUnion],
// [BetaWebFetchToolResultBlockContentUnion],
// [BetaAdvisorToolResultBlockContentUnion],
// [BetaCodeExecutionToolResultBlockContentUnion],
// [BetaBashCodeExecutionToolResultBlockContentUnion],
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion],
// [BetaToolSearchToolResultBlockContentUnion],
// [BetaMCPToolResultBlockContentUnion], [string]
Content BetaRawContentBlockStartEventContentBlockUnionContent `json:"content"`
ToolUseID string `json:"tool_use_id"`
// This field is from variant [BetaMCPToolUseBlock].
ServerName string `json:"server_name"`
// This field is from variant [BetaMCPToolResultBlock].
IsError bool `json:"is_error"`
// This field is from variant [BetaContainerUploadBlock].
FileID string `json:"file_id"`
// This field is from variant [BetaCompactionBlock].
EncryptedContent string `json:"encrypted_content"`
JSON struct {
Citations respjson.Field
Text respjson.Field
Type respjson.Field
Signature respjson.Field
Thinking respjson.Field
Data respjson.Field
ID respjson.Field
Input respjson.Field
Name respjson.Field
Caller respjson.Field
Content respjson.Field
ToolUseID respjson.Field
ServerName respjson.Field
IsError respjson.Field
FileID respjson.Field
EncryptedContent respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawContentBlockStartEventContentBlockUnion contains all possible properties and values from BetaTextBlock, BetaThinkingBlock, BetaRedactedThinkingBlock, BetaToolUseBlock, BetaServerToolUseBlock, BetaWebSearchToolResultBlock, BetaWebFetchToolResultBlock, BetaAdvisorToolResultBlock, BetaCodeExecutionToolResultBlock, BetaBashCodeExecutionToolResultBlock, BetaTextEditorCodeExecutionToolResultBlock, BetaToolSearchToolResultBlock, BetaMCPToolUseBlock, BetaMCPToolResultBlock, BetaContainerUploadBlock, BetaCompactionBlock.
Use the BetaRawContentBlockStartEventContentBlockUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaRawContentBlockStartEventContentBlockUnion) AsAdvisorToolResult ¶ added in v1.34.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsAdvisorToolResult() (v BetaAdvisorToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsAny ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsAny() anyBetaRawContentBlockStartEventContentBlock
Use the following switch statement to find the correct variant
switch variant := BetaRawContentBlockStartEventContentBlockUnion.AsAny().(type) {
case anthropic.BetaTextBlock:
case anthropic.BetaThinkingBlock:
case anthropic.BetaRedactedThinkingBlock:
case anthropic.BetaToolUseBlock:
case anthropic.BetaServerToolUseBlock:
case anthropic.BetaWebSearchToolResultBlock:
case anthropic.BetaWebFetchToolResultBlock:
case anthropic.BetaAdvisorToolResultBlock:
case anthropic.BetaCodeExecutionToolResultBlock:
case anthropic.BetaBashCodeExecutionToolResultBlock:
case anthropic.BetaTextEditorCodeExecutionToolResultBlock:
case anthropic.BetaToolSearchToolResultBlock:
case anthropic.BetaMCPToolUseBlock:
case anthropic.BetaMCPToolResultBlock:
case anthropic.BetaContainerUploadBlock:
case anthropic.BetaCompactionBlock:
default:
fmt.Errorf("no variant present")
}
func (BetaRawContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult ¶ added in v1.10.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult() (v BetaBashCodeExecutionToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult ¶ added in v1.2.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult() (v BetaCodeExecutionToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsCompaction ¶ added in v1.21.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsCompaction() (v BetaCompactionBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsContainerUpload ¶ added in v1.2.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsContainerUpload() (v BetaContainerUploadBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolResult ¶ added in v1.2.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolResult() (v BetaMCPToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolUse ¶ added in v1.2.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsMCPToolUse() (v BetaMCPToolUseBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsRedactedThinking ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsRedactedThinking() (v BetaRedactedThinkingBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsServerToolUse ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsServerToolUse() (v BetaServerToolUseBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsText ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsText() (v BetaTextBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult ¶ added in v1.10.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v BetaTextEditorCodeExecutionToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsThinking ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsThinking() (v BetaThinkingBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsToolSearchToolResult ¶ added in v1.19.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsToolSearchToolResult() (v BetaToolSearchToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsToolUse ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsToolUse() (v BetaToolUseBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsWebFetchToolResult ¶ added in v1.12.0
func (u BetaRawContentBlockStartEventContentBlockUnion) AsWebFetchToolResult() (v BetaWebFetchToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) AsWebSearchToolResult ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) AsWebSearchToolResult() (v BetaWebSearchToolResultBlock)
func (BetaRawContentBlockStartEventContentBlockUnion) RawJSON ¶
func (u BetaRawContentBlockStartEventContentBlockUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawContentBlockStartEventContentBlockUnion) UnmarshalJSON ¶
func (r *BetaRawContentBlockStartEventContentBlockUnion) UnmarshalJSON(data []byte) error
type BetaRawContentBlockStartEventContentBlockUnionCaller ¶ added in v1.19.0
type BetaRawContentBlockStartEventContentBlockUnionCaller struct {
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawContentBlockStartEventContentBlockUnionCaller is an implicit subunion of BetaRawContentBlockStartEventContentBlockUnion. BetaRawContentBlockStartEventContentBlockUnionCaller provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaRawContentBlockStartEventContentBlockUnion.
func (*BetaRawContentBlockStartEventContentBlockUnionCaller) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaRawContentBlockStartEventContentBlockUnionCaller) UnmarshalJSON(data []byte) error
type BetaRawContentBlockStartEventContentBlockUnionContent ¶ added in v1.2.0
type BetaRawContentBlockStartEventContentBlockUnionContent struct {
// This field will be present if the value is a [[]BetaWebSearchResultBlock]
// instead of an object.
OfBetaWebSearchResultBlockArray []BetaWebSearchResultBlock `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]BetaTextBlock] instead of an
// object.
OfBetaMCPToolResultBlockContent []BetaTextBlock `json:",inline"`
ErrorCode string `json:"error_code"`
Type string `json:"type"`
// This field is a union of [BetaDocumentBlock], [[]BetaCodeExecutionOutputBlock],
// [[]BetaCodeExecutionOutputBlock], [[]BetaBashCodeExecutionOutputBlock], [string]
Content BetaRawContentBlockStartEventContentBlockUnionContentContent `json:"content"`
// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
RetrievedAt string `json:"retrieved_at"`
// This field is from variant [BetaWebFetchToolResultBlockContentUnion].
URL string `json:"url"`
// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
Text string `json:"text"`
// This field is from variant [BetaAdvisorToolResultBlockContentUnion].
EncryptedContent string `json:"encrypted_content"`
ReturnCode int64 `json:"return_code"`
Stderr string `json:"stderr"`
Stdout string `json:"stdout"`
// This field is from variant [BetaCodeExecutionToolResultBlockContentUnion].
EncryptedStdout string `json:"encrypted_stdout"`
ErrorMessage string `json:"error_message"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
NumLines int64 `json:"num_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
StartLine int64 `json:"start_line"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
TotalLines int64 `json:"total_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
IsFileUpdate bool `json:"is_file_update"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
Lines []string `json:"lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
NewLines int64 `json:"new_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
NewStart int64 `json:"new_start"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
OldLines int64 `json:"old_lines"`
// This field is from variant
// [BetaTextEditorCodeExecutionToolResultBlockContentUnion].
OldStart int64 `json:"old_start"`
// This field is from variant [BetaToolSearchToolResultBlockContentUnion].
ToolReferences []BetaToolReferenceBlock `json:"tool_references"`
JSON struct {
OfBetaWebSearchResultBlockArray respjson.Field
OfString respjson.Field
OfBetaMCPToolResultBlockContent respjson.Field
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
RetrievedAt respjson.Field
URL respjson.Field
Text respjson.Field
EncryptedContent respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
EncryptedStdout respjson.Field
ErrorMessage respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
IsFileUpdate respjson.Field
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
ToolReferences respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawContentBlockStartEventContentBlockUnionContent is an implicit subunion of BetaRawContentBlockStartEventContentBlockUnion. BetaRawContentBlockStartEventContentBlockUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaRawContentBlockStartEventContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaWebSearchResultBlockArray OfString OfBetaMCPToolResultBlockContent]
func (*BetaRawContentBlockStartEventContentBlockUnionContent) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaRawContentBlockStartEventContentBlockUnionContent) UnmarshalJSON(data []byte) error
type BetaRawContentBlockStartEventContentBlockUnionContentContent ¶ added in v1.10.0
type BetaRawContentBlockStartEventContentBlockUnionContentContent struct {
// This field will be present if the value is a [[]BetaCodeExecutionOutputBlock]
// instead of an object.
OfContent []BetaCodeExecutionOutputBlock `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [BetaDocumentBlock].
Citations BetaCitationConfig `json:"citations"`
// This field is from variant [BetaDocumentBlock].
Source BetaDocumentBlockSourceUnion `json:"source"`
// This field is from variant [BetaDocumentBlock].
Title string `json:"title"`
// This field is from variant [BetaDocumentBlock].
Type constant.Document `json:"type"`
JSON struct {
OfContent respjson.Field
OfString respjson.Field
Citations respjson.Field
Source respjson.Field
Title respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawContentBlockStartEventContentBlockUnionContentContent is an implicit subunion of BetaRawContentBlockStartEventContentBlockUnion. BetaRawContentBlockStartEventContentBlockUnionContentContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaRawContentBlockStartEventContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfContent OfString]
func (*BetaRawContentBlockStartEventContentBlockUnionContentContent) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaRawContentBlockStartEventContentBlockUnionContentContent) UnmarshalJSON(data []byte) error
type BetaRawContentBlockStopEvent ¶
type BetaRawContentBlockStopEvent struct {
Index int64 `json:"index" api:"required"`
Type constant.ContentBlockStop `json:"type" default:"content_block_stop"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Index respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawContentBlockStopEvent) RawJSON ¶
func (r BetaRawContentBlockStopEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawContentBlockStopEvent) UnmarshalJSON ¶
func (r *BetaRawContentBlockStopEvent) UnmarshalJSON(data []byte) error
type BetaRawMessageDeltaEvent ¶
type BetaRawMessageDeltaEvent struct {
// Information about context management strategies applied during the request
ContextManagement BetaContextManagementResponse `json:"context_management" api:"required"`
Delta BetaRawMessageDeltaEventDelta `json:"delta" api:"required"`
Type constant.MessageDelta `json:"type" default:"message_delta"`
// Billing and rate-limit usage.
//
// Anthropic's API bills and rate-limits by token counts, as tokens represent the
// underlying cost to our systems.
//
// Under the hood, the API transforms requests into a format suitable for the
// model. The model's output then goes through a parsing stage before becoming an
// API response. As a result, the token counts in `usage` will not match one-to-one
// with the exact visible content of an API request or response.
//
// For example, `output_tokens` will be non-zero, even for an empty string response
// from Claude.
//
// Total input tokens in a request is the summation of `input_tokens`,
// `cache_creation_input_tokens`, and `cache_read_input_tokens`.
Usage BetaMessageDeltaUsage `json:"usage" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ContextManagement respjson.Field
Delta respjson.Field
Type respjson.Field
Usage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawMessageDeltaEvent) RawJSON ¶
func (r BetaRawMessageDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawMessageDeltaEvent) UnmarshalJSON ¶
func (r *BetaRawMessageDeltaEvent) UnmarshalJSON(data []byte) error
type BetaRawMessageDeltaEventDelta ¶
type BetaRawMessageDeltaEventDelta struct {
// Information about the container used in the request (for the code execution
// tool)
Container BetaContainer `json:"container" api:"required"`
// Structured information about a refusal.
StopDetails BetaRefusalStopDetails `json:"stop_details" api:"required"`
// Any of "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn",
// "compaction", "refusal", "model_context_window_exceeded".
StopReason BetaStopReason `json:"stop_reason" api:"required"`
StopSequence string `json:"stop_sequence" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Container respjson.Field
StopDetails respjson.Field
StopReason respjson.Field
StopSequence respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawMessageDeltaEventDelta) RawJSON ¶
func (r BetaRawMessageDeltaEventDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawMessageDeltaEventDelta) UnmarshalJSON ¶
func (r *BetaRawMessageDeltaEventDelta) UnmarshalJSON(data []byte) error
type BetaRawMessageStartEvent ¶
type BetaRawMessageStartEvent struct {
Message BetaMessage `json:"message" api:"required"`
Type constant.MessageStart `json:"type" default:"message_start"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawMessageStartEvent) RawJSON ¶
func (r BetaRawMessageStartEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawMessageStartEvent) UnmarshalJSON ¶
func (r *BetaRawMessageStartEvent) UnmarshalJSON(data []byte) error
type BetaRawMessageStopEvent ¶
type BetaRawMessageStopEvent struct {
Type constant.MessageStop `json:"type" default:"message_stop"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRawMessageStopEvent) RawJSON ¶
func (r BetaRawMessageStopEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawMessageStopEvent) UnmarshalJSON ¶
func (r *BetaRawMessageStopEvent) UnmarshalJSON(data []byte) error
type BetaRawMessageStreamEventUnion ¶
type BetaRawMessageStreamEventUnion struct {
// This field is from variant [BetaRawMessageStartEvent].
Message BetaMessage `json:"message"`
// Any of "message_start", "message_delta", "message_stop", "content_block_start",
// "content_block_delta", "content_block_stop".
Type string `json:"type"`
// This field is from variant [BetaRawMessageDeltaEvent].
ContextManagement BetaContextManagementResponse `json:"context_management"`
// This field is a union of [BetaRawMessageDeltaEventDelta],
// [BetaRawContentBlockDeltaUnion]
Delta BetaRawMessageStreamEventUnionDelta `json:"delta"`
// This field is from variant [BetaRawMessageDeltaEvent].
Usage BetaMessageDeltaUsage `json:"usage"`
// This field is from variant [BetaRawContentBlockStartEvent].
ContentBlock BetaRawContentBlockStartEventContentBlockUnion `json:"content_block"`
Index int64 `json:"index"`
JSON struct {
Message respjson.Field
Type respjson.Field
ContextManagement respjson.Field
Delta respjson.Field
Usage respjson.Field
ContentBlock respjson.Field
Index respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawMessageStreamEventUnion contains all possible properties and values from BetaRawMessageStartEvent, BetaRawMessageDeltaEvent, BetaRawMessageStopEvent, BetaRawContentBlockStartEvent, BetaRawContentBlockDeltaEvent, BetaRawContentBlockStopEvent.
Use the BetaRawMessageStreamEventUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaRawMessageStreamEventUnion) AsAny ¶
func (u BetaRawMessageStreamEventUnion) AsAny() anyBetaRawMessageStreamEvent
Use the following switch statement to find the correct variant
switch variant := BetaRawMessageStreamEventUnion.AsAny().(type) {
case anthropic.BetaRawMessageStartEvent:
case anthropic.BetaRawMessageDeltaEvent:
case anthropic.BetaRawMessageStopEvent:
case anthropic.BetaRawContentBlockStartEvent:
case anthropic.BetaRawContentBlockDeltaEvent:
case anthropic.BetaRawContentBlockStopEvent:
default:
fmt.Errorf("no variant present")
}
func (BetaRawMessageStreamEventUnion) AsContentBlockDelta ¶
func (u BetaRawMessageStreamEventUnion) AsContentBlockDelta() (v BetaRawContentBlockDeltaEvent)
func (BetaRawMessageStreamEventUnion) AsContentBlockStart ¶
func (u BetaRawMessageStreamEventUnion) AsContentBlockStart() (v BetaRawContentBlockStartEvent)
func (BetaRawMessageStreamEventUnion) AsContentBlockStop ¶
func (u BetaRawMessageStreamEventUnion) AsContentBlockStop() (v BetaRawContentBlockStopEvent)
func (BetaRawMessageStreamEventUnion) AsMessageDelta ¶
func (u BetaRawMessageStreamEventUnion) AsMessageDelta() (v BetaRawMessageDeltaEvent)
func (BetaRawMessageStreamEventUnion) AsMessageStart ¶
func (u BetaRawMessageStreamEventUnion) AsMessageStart() (v BetaRawMessageStartEvent)
func (BetaRawMessageStreamEventUnion) AsMessageStop ¶
func (u BetaRawMessageStreamEventUnion) AsMessageStop() (v BetaRawMessageStopEvent)
func (BetaRawMessageStreamEventUnion) RawJSON ¶
func (u BetaRawMessageStreamEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRawMessageStreamEventUnion) UnmarshalJSON ¶
func (r *BetaRawMessageStreamEventUnion) UnmarshalJSON(data []byte) error
type BetaRawMessageStreamEventUnionDelta ¶
type BetaRawMessageStreamEventUnionDelta struct {
// This field is from variant [BetaRawMessageDeltaEventDelta].
Container BetaContainer `json:"container"`
// This field is from variant [BetaRawMessageDeltaEventDelta].
StopDetails BetaRefusalStopDetails `json:"stop_details"`
// This field is from variant [BetaRawMessageDeltaEventDelta].
StopReason BetaStopReason `json:"stop_reason"`
// This field is from variant [BetaRawMessageDeltaEventDelta].
StopSequence string `json:"stop_sequence"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
Text string `json:"text"`
Type string `json:"type"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
PartialJSON string `json:"partial_json"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
Citation BetaCitationsDeltaCitationUnion `json:"citation"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
Thinking string `json:"thinking"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
Signature string `json:"signature"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
Content string `json:"content"`
// This field is from variant [BetaRawContentBlockDeltaUnion].
EncryptedContent string `json:"encrypted_content"`
JSON struct {
Container respjson.Field
StopDetails respjson.Field
StopReason respjson.Field
StopSequence respjson.Field
Text respjson.Field
Type respjson.Field
PartialJSON respjson.Field
Citation respjson.Field
Thinking respjson.Field
Signature respjson.Field
Content respjson.Field
EncryptedContent respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaRawMessageStreamEventUnionDelta is an implicit subunion of BetaRawMessageStreamEventUnion. BetaRawMessageStreamEventUnionDelta provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the BetaRawMessageStreamEventUnion.
func (*BetaRawMessageStreamEventUnionDelta) UnmarshalJSON ¶
func (r *BetaRawMessageStreamEventUnionDelta) UnmarshalJSON(data []byte) error
type BetaRedactedThinkingBlock ¶
type BetaRedactedThinkingBlock struct {
Data string `json:"data" api:"required"`
Type constant.RedactedThinking `json:"type" default:"redacted_thinking"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaRedactedThinkingBlock) RawJSON ¶
func (r BetaRedactedThinkingBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaRedactedThinkingBlock) ToParam ¶
func (r BetaRedactedThinkingBlock) ToParam() BetaRedactedThinkingBlockParam
func (*BetaRedactedThinkingBlock) UnmarshalJSON ¶
func (r *BetaRedactedThinkingBlock) UnmarshalJSON(data []byte) error
type BetaRedactedThinkingBlockParam ¶
type BetaRedactedThinkingBlockParam struct {
Data string `json:"data" api:"required"`
// This field can be elided, and will marshal its zero value as
// "redacted_thinking".
Type constant.RedactedThinking `json:"type" default:"redacted_thinking"`
// contains filtered or unexported fields
}
The properties Data, Type are required.
func (BetaRedactedThinkingBlockParam) MarshalJSON ¶
func (r BetaRedactedThinkingBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaRedactedThinkingBlockParam) UnmarshalJSON ¶
func (r *BetaRedactedThinkingBlockParam) UnmarshalJSON(data []byte) error
type BetaRefusalStopDetails ¶ added in v1.29.0
type BetaRefusalStopDetails struct {
// The policy category that triggered the refusal.
//
// `null` when the refusal doesn't map to a named category.
//
// Any of "cyber", "bio".
Category BetaRefusalStopDetailsCategory `json:"category" api:"required"`
// Human-readable explanation of the refusal.
//
// This text is not guaranteed to be stable. `null` when no explanation is
// available for the category.
Explanation string `json:"explanation" api:"required"`
Type constant.Refusal `json:"type" default:"refusal"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Category respjson.Field
Explanation respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Structured information about a refusal.
func (BetaRefusalStopDetails) RawJSON ¶ added in v1.29.0
func (r BetaRefusalStopDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaRefusalStopDetails) UnmarshalJSON ¶ added in v1.29.0
func (r *BetaRefusalStopDetails) UnmarshalJSON(data []byte) error
type BetaRefusalStopDetailsCategory ¶ added in v1.29.0
type BetaRefusalStopDetailsCategory string
The policy category that triggered the refusal.
`null` when the refusal doesn't map to a named category.
const ( BetaRefusalStopDetailsCategoryCyber BetaRefusalStopDetailsCategory = "cyber" BetaRefusalStopDetailsCategoryBio BetaRefusalStopDetailsCategory = "bio" )
type BetaRequestDocumentBlockParam ¶ added in v1.5.0
type BetaRequestDocumentBlockParam struct {
Source BetaRequestDocumentBlockSourceUnionParam `json:"source,omitzero" api:"required"`
Context param.Opt[string] `json:"context,omitzero"`
Title param.Opt[string] `json:"title,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
Citations BetaCitationsConfigParam `json:"citations,omitzero"`
// This field can be elided, and will marshal its zero value as "document".
Type constant.Document `json:"type" default:"document"`
// contains filtered or unexported fields
}
The properties Source, Type are required.
func (BetaRequestDocumentBlockParam) MarshalJSON ¶ added in v1.5.0
func (r BetaRequestDocumentBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaRequestDocumentBlockParam) UnmarshalJSON ¶ added in v1.5.0
func (r *BetaRequestDocumentBlockParam) UnmarshalJSON(data []byte) error
type BetaRequestDocumentBlockSourceUnionParam ¶ added in v1.5.0
type BetaRequestDocumentBlockSourceUnionParam struct {
OfBase64 *BetaBase64PDFSourceParam `json:",omitzero,inline"`
OfText *BetaPlainTextSourceParam `json:",omitzero,inline"`
OfContent *BetaContentBlockSourceParam `json:",omitzero,inline"`
OfURL *BetaURLPDFSourceParam `json:",omitzero,inline"`
OfFile *BetaFileDocumentSourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaRequestDocumentBlockSourceUnionParam) GetContent ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) GetContent() *BetaContentBlockSourceContentUnionParam
Returns a pointer to the underlying variant's property, if present.
func (BetaRequestDocumentBlockSourceUnionParam) GetData ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaRequestDocumentBlockSourceUnionParam) GetFileID ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaRequestDocumentBlockSourceUnionParam) GetMediaType ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) GetMediaType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaRequestDocumentBlockSourceUnionParam) GetType ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaRequestDocumentBlockSourceUnionParam) GetURL ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaRequestDocumentBlockSourceUnionParam) MarshalJSON ¶ added in v1.5.0
func (u BetaRequestDocumentBlockSourceUnionParam) MarshalJSON() ([]byte, error)
func (*BetaRequestDocumentBlockSourceUnionParam) UnmarshalJSON ¶ added in v1.5.0
func (u *BetaRequestDocumentBlockSourceUnionParam) UnmarshalJSON(data []byte) error
type BetaRequestMCPServerToolConfigurationParam ¶ added in v1.2.0
type BetaRequestMCPServerToolConfigurationParam struct {
Enabled param.Opt[bool] `json:"enabled,omitzero"`
AllowedTools []string `json:"allowed_tools,omitzero"`
// contains filtered or unexported fields
}
func (BetaRequestMCPServerToolConfigurationParam) MarshalJSON ¶ added in v1.2.0
func (r BetaRequestMCPServerToolConfigurationParam) MarshalJSON() (data []byte, err error)
func (*BetaRequestMCPServerToolConfigurationParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaRequestMCPServerToolConfigurationParam) UnmarshalJSON(data []byte) error
type BetaRequestMCPServerURLDefinitionParam ¶ added in v1.2.0
type BetaRequestMCPServerURLDefinitionParam struct {
Name string `json:"name" api:"required"`
URL string `json:"url" api:"required"`
AuthorizationToken param.Opt[string] `json:"authorization_token,omitzero"`
ToolConfiguration BetaRequestMCPServerToolConfigurationParam `json:"tool_configuration,omitzero"`
// This field can be elided, and will marshal its zero value as "url".
Type constant.URL `json:"type" default:"url"`
// contains filtered or unexported fields
}
The properties Name, Type, URL are required.
func (BetaRequestMCPServerURLDefinitionParam) MarshalJSON ¶ added in v1.2.0
func (r BetaRequestMCPServerURLDefinitionParam) MarshalJSON() (data []byte, err error)
func (*BetaRequestMCPServerURLDefinitionParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaRequestMCPServerURLDefinitionParam) UnmarshalJSON(data []byte) error
type BetaRequestMCPToolResultBlockParam ¶ added in v1.2.0
type BetaRequestMCPToolResultBlockParam struct {
ToolUseID string `json:"tool_use_id" api:"required"`
IsError param.Opt[bool] `json:"is_error,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
Content BetaRequestMCPToolResultBlockParamContentUnion `json:"content,omitzero"`
// This field can be elided, and will marshal its zero value as "mcp_tool_result".
Type constant.MCPToolResult `json:"type" default:"mcp_tool_result"`
// contains filtered or unexported fields
}
The properties ToolUseID, Type are required.
func (BetaRequestMCPToolResultBlockParam) MarshalJSON ¶ added in v1.2.0
func (r BetaRequestMCPToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaRequestMCPToolResultBlockParam) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaRequestMCPToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaRequestMCPToolResultBlockParamContentUnion ¶ added in v1.2.0
type BetaRequestMCPToolResultBlockParamContentUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfBetaMCPToolResultBlockContent []BetaTextBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaRequestMCPToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.2.0
func (u BetaRequestMCPToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaRequestMCPToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.2.0
func (u *BetaRequestMCPToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaSearchResultBlockParam ¶ added in v1.5.0
type BetaSearchResultBlockParam struct {
Content []BetaTextBlockParam `json:"content,omitzero" api:"required"`
Source string `json:"source" api:"required"`
Title string `json:"title" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
Citations BetaCitationsConfigParam `json:"citations,omitzero"`
// This field can be elided, and will marshal its zero value as "search_result".
Type constant.SearchResult `json:"type" default:"search_result"`
// contains filtered or unexported fields
}
The properties Content, Source, Title, Type are required.
func (BetaSearchResultBlockParam) MarshalJSON ¶ added in v1.5.0
func (r BetaSearchResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaSearchResultBlockParam) UnmarshalJSON ¶ added in v1.5.0
func (r *BetaSearchResultBlockParam) UnmarshalJSON(data []byte) error
type BetaServerToolCaller ¶ added in v1.19.0
type BetaServerToolCaller struct {
ToolID string `json:"tool_id" api:"required"`
Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Tool invocation generated by a server-side tool.
func (BetaServerToolCaller) RawJSON ¶ added in v1.19.0
func (r BetaServerToolCaller) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaServerToolCaller) ToParam ¶ added in v1.19.0
func (r BetaServerToolCaller) ToParam() BetaServerToolCallerParam
ToParam converts this BetaServerToolCaller to a BetaServerToolCallerParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaServerToolCallerParam.Overrides()
func (*BetaServerToolCaller) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaServerToolCaller) UnmarshalJSON(data []byte) error
type BetaServerToolCaller20260120 ¶ added in v1.23.0
type BetaServerToolCaller20260120 struct {
ToolID string `json:"tool_id" api:"required"`
Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaServerToolCaller20260120) RawJSON ¶ added in v1.23.0
func (r BetaServerToolCaller20260120) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaServerToolCaller20260120) ToParam ¶ added in v1.23.0
func (r BetaServerToolCaller20260120) ToParam() BetaServerToolCaller20260120Param
ToParam converts this BetaServerToolCaller20260120 to a BetaServerToolCaller20260120Param.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaServerToolCaller20260120Param.Overrides()
func (*BetaServerToolCaller20260120) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaServerToolCaller20260120) UnmarshalJSON(data []byte) error
type BetaServerToolCaller20260120Param ¶ added in v1.23.0
type BetaServerToolCaller20260120Param struct {
ToolID string `json:"tool_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20260120".
Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
// contains filtered or unexported fields
}
The properties ToolID, Type are required.
func (BetaServerToolCaller20260120Param) MarshalJSON ¶ added in v1.23.0
func (r BetaServerToolCaller20260120Param) MarshalJSON() (data []byte, err error)
func (*BetaServerToolCaller20260120Param) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaServerToolCaller20260120Param) UnmarshalJSON(data []byte) error
type BetaServerToolCallerParam ¶ added in v1.19.0
type BetaServerToolCallerParam struct {
ToolID string `json:"tool_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20250825".
Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
// contains filtered or unexported fields
}
Tool invocation generated by a server-side tool.
The properties ToolID, Type are required.
func (BetaServerToolCallerParam) MarshalJSON ¶ added in v1.19.0
func (r BetaServerToolCallerParam) MarshalJSON() (data []byte, err error)
func (*BetaServerToolCallerParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaServerToolCallerParam) UnmarshalJSON(data []byte) error
type BetaServerToolUsage ¶
type BetaServerToolUsage struct {
// The number of web fetch tool requests.
WebFetchRequests int64 `json:"web_fetch_requests" api:"required"`
// The number of web search tool requests.
WebSearchRequests int64 `json:"web_search_requests" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
WebFetchRequests respjson.Field
WebSearchRequests respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaServerToolUsage) RawJSON ¶
func (r BetaServerToolUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaServerToolUsage) UnmarshalJSON ¶
func (r *BetaServerToolUsage) UnmarshalJSON(data []byte) error
type BetaServerToolUseBlock ¶
type BetaServerToolUseBlock struct {
ID string `json:"id" api:"required"`
Input any `json:"input" api:"required"`
// Any of "advisor", "web_search", "web_fetch", "code_execution",
// "bash_code_execution", "text_editor_code_execution", "tool_search_tool_regex",
// "tool_search_tool_bm25".
Name BetaServerToolUseBlockName `json:"name" api:"required"`
Type constant.ServerToolUse `json:"type" default:"server_tool_use"`
// Tool invocation directly from the model.
Caller BetaServerToolUseBlockCallerUnion `json:"caller"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Input respjson.Field
Name respjson.Field
Type respjson.Field
Caller respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaServerToolUseBlock) RawJSON ¶
func (r BetaServerToolUseBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaServerToolUseBlock) ToParam ¶ added in v1.20.0
func (r BetaServerToolUseBlock) ToParam() BetaServerToolUseBlockParam
func (*BetaServerToolUseBlock) UnmarshalJSON ¶
func (r *BetaServerToolUseBlock) UnmarshalJSON(data []byte) error
type BetaServerToolUseBlockCallerUnion ¶ added in v1.19.0
type BetaServerToolUseBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaServerToolUseBlockCallerUnion contains all possible properties and values from BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller20260120.
Use the BetaServerToolUseBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaServerToolUseBlockCallerUnion) AsAny ¶ added in v1.19.0
func (u BetaServerToolUseBlockCallerUnion) AsAny() anyBetaServerToolUseBlockCaller
Use the following switch statement to find the correct variant
switch variant := BetaServerToolUseBlockCallerUnion.AsAny().(type) {
case anthropic.BetaDirectCaller:
case anthropic.BetaServerToolCaller:
case anthropic.BetaServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (BetaServerToolUseBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.19.0
func (u BetaServerToolUseBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
func (BetaServerToolUseBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u BetaServerToolUseBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
func (BetaServerToolUseBlockCallerUnion) AsDirect ¶ added in v1.19.0
func (u BetaServerToolUseBlockCallerUnion) AsDirect() (v BetaDirectCaller)
func (BetaServerToolUseBlockCallerUnion) RawJSON ¶ added in v1.19.0
func (u BetaServerToolUseBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaServerToolUseBlockCallerUnion) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaServerToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
type BetaServerToolUseBlockName ¶ added in v1.2.0
type BetaServerToolUseBlockName string
const ( BetaServerToolUseBlockNameAdvisor BetaServerToolUseBlockName = "advisor" BetaServerToolUseBlockNameWebSearch BetaServerToolUseBlockName = "web_search" BetaServerToolUseBlockNameWebFetch BetaServerToolUseBlockName = "web_fetch" BetaServerToolUseBlockNameCodeExecution BetaServerToolUseBlockName = "code_execution" BetaServerToolUseBlockNameBashCodeExecution BetaServerToolUseBlockName = "bash_code_execution" BetaServerToolUseBlockNameTextEditorCodeExecution BetaServerToolUseBlockName = "text_editor_code_execution" BetaServerToolUseBlockNameToolSearchToolRegex BetaServerToolUseBlockName = "tool_search_tool_regex" BetaServerToolUseBlockNameToolSearchToolBm25 BetaServerToolUseBlockName = "tool_search_tool_bm25" )
type BetaServerToolUseBlockParam ¶
type BetaServerToolUseBlockParam struct {
ID string `json:"id" api:"required"`
Input any `json:"input,omitzero" api:"required"`
// Any of "advisor", "web_search", "web_fetch", "code_execution",
// "bash_code_execution", "text_editor_code_execution", "tool_search_tool_regex",
// "tool_search_tool_bm25".
Name BetaServerToolUseBlockParamName `json:"name,omitzero" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller BetaServerToolUseBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as "server_tool_use".
Type constant.ServerToolUse `json:"type" default:"server_tool_use"`
// contains filtered or unexported fields
}
The properties ID, Input, Name, Type are required.
func (BetaServerToolUseBlockParam) MarshalJSON ¶
func (r BetaServerToolUseBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaServerToolUseBlockParam) UnmarshalJSON ¶
func (r *BetaServerToolUseBlockParam) UnmarshalJSON(data []byte) error
type BetaServerToolUseBlockParamCallerUnion ¶ added in v1.19.0
type BetaServerToolUseBlockParamCallerUnion struct {
OfDirect *BetaDirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *BetaServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaServerToolUseBlockParamCallerUnion) GetToolID ¶ added in v1.19.0
func (u BetaServerToolUseBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaServerToolUseBlockParamCallerUnion) GetType ¶ added in v1.19.0
func (u BetaServerToolUseBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaServerToolUseBlockParamCallerUnion) MarshalJSON ¶ added in v1.19.0
func (u BetaServerToolUseBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*BetaServerToolUseBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.19.0
func (u *BetaServerToolUseBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type BetaServerToolUseBlockParamName ¶ added in v1.2.0
type BetaServerToolUseBlockParamName string
const ( BetaServerToolUseBlockParamNameAdvisor BetaServerToolUseBlockParamName = "advisor" BetaServerToolUseBlockParamNameWebSearch BetaServerToolUseBlockParamName = "web_search" BetaServerToolUseBlockParamNameWebFetch BetaServerToolUseBlockParamName = "web_fetch" BetaServerToolUseBlockParamNameCodeExecution BetaServerToolUseBlockParamName = "code_execution" BetaServerToolUseBlockParamNameBashCodeExecution BetaServerToolUseBlockParamName = "bash_code_execution" BetaServerToolUseBlockParamNameTextEditorCodeExecution BetaServerToolUseBlockParamName = "text_editor_code_execution" BetaServerToolUseBlockParamNameToolSearchToolRegex BetaServerToolUseBlockParamName = "tool_search_tool_regex" BetaServerToolUseBlockParamNameToolSearchToolBm25 BetaServerToolUseBlockParamName = "tool_search_tool_bm25" )
type BetaService ¶
type BetaService struct {
Options []option.RequestOption
Models BetaModelService
Messages BetaMessageService
Agents BetaAgentService
Environments BetaEnvironmentService
Sessions BetaSessionService
Vaults BetaVaultService
MemoryStores BetaMemoryStoreService
Files BetaFileService
Skills BetaSkillService
UserProfiles BetaUserProfileService
}
BetaService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaService method instead.
func NewBetaService ¶
func NewBetaService(opts ...option.RequestOption) (r BetaService)
NewBetaService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
type BetaSessionArchiveParams ¶ added in v1.33.0
type BetaSessionArchiveParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSessionDeleteParams ¶ added in v1.33.0
type BetaSessionDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSessionEventListParams ¶ added in v1.33.0
type BetaSessionEventListParams struct {
// Query parameter for limit
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque pagination cursor from a previous response's next_page.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Sort direction for results, ordered by created_at. Defaults to asc
// (chronological).
//
// Any of "asc", "desc".
Order BetaSessionEventListParamsOrder `query:"order,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionEventListParams) URLQuery ¶ added in v1.33.0
func (r BetaSessionEventListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaSessionEventListParams's query parameters as `url.Values`.
type BetaSessionEventListParamsOrder ¶ added in v1.33.0
type BetaSessionEventListParamsOrder string
Sort direction for results, ordered by created_at. Defaults to asc (chronological).
const ( BetaSessionEventListParamsOrderAsc BetaSessionEventListParamsOrder = "asc" BetaSessionEventListParamsOrderDesc BetaSessionEventListParamsOrder = "desc" )
type BetaSessionEventSendParams ¶ added in v1.33.0
type BetaSessionEventSendParams struct {
// Events to send to the `session`.
Events []BetaManagedAgentsEventParamsUnion `json:"events,omitzero" api:"required"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionEventSendParams) MarshalJSON ¶ added in v1.33.0
func (r BetaSessionEventSendParams) MarshalJSON() (data []byte, err error)
func (*BetaSessionEventSendParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionEventSendParams) UnmarshalJSON(data []byte) error
type BetaSessionEventService ¶ added in v1.33.0
type BetaSessionEventService struct {
Options []option.RequestOption
}
BetaSessionEventService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaSessionEventService method instead.
func NewBetaSessionEventService ¶ added in v1.33.0
func NewBetaSessionEventService(opts ...option.RequestOption) (r BetaSessionEventService)
NewBetaSessionEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaSessionEventService) List ¶ added in v1.33.0
func (r *BetaSessionEventService) List(ctx context.Context, sessionID string, params BetaSessionEventListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsSessionEventUnion], err error)
List Events
func (*BetaSessionEventService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaSessionEventService) ListAutoPaging(ctx context.Context, sessionID string, params BetaSessionEventListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsSessionEventUnion]
List Events
func (*BetaSessionEventService) Send ¶ added in v1.33.0
func (r *BetaSessionEventService) Send(ctx context.Context, sessionID string, params BetaSessionEventSendParams, opts ...option.RequestOption) (res *BetaManagedAgentsSendSessionEvents, err error)
Send Events
func (*BetaSessionEventService) StreamEvents ¶ added in v1.33.0
func (r *BetaSessionEventService) StreamEvents(ctx context.Context, sessionID string, query BetaSessionEventStreamParams, opts ...option.RequestOption) (stream *ssestream.Stream[BetaManagedAgentsStreamSessionEventsUnion])
Stream Events
type BetaSessionEventStreamParams ¶ added in v1.33.0
type BetaSessionEventStreamParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSessionGetParams ¶ added in v1.33.0
type BetaSessionGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSessionListParams ¶ added in v1.33.0
type BetaSessionListParams struct {
// Filter sessions created with this agent ID.
AgentID param.Opt[string] `query:"agent_id,omitzero" json:"-"`
// Filter by agent version. Only applies when agent_id is also set.
AgentVersion param.Opt[int64] `query:"agent_version,omitzero" json:"-"`
// Return sessions created after this time (exclusive).
CreatedAtGt param.Opt[time.Time] `query:"created_at[gt],omitzero" format:"date-time" json:"-"`
// Return sessions created at or after this time (inclusive).
CreatedAtGte param.Opt[time.Time] `query:"created_at[gte],omitzero" format:"date-time" json:"-"`
// Return sessions created before this time (exclusive).
CreatedAtLt param.Opt[time.Time] `query:"created_at[lt],omitzero" format:"date-time" json:"-"`
// Return sessions created at or before this time (inclusive).
CreatedAtLte param.Opt[time.Time] `query:"created_at[lte],omitzero" format:"date-time" json:"-"`
// When true, includes archived sessions. Default: false (exclude archived).
IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
// Maximum number of results to return.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque pagination cursor from a previous response's next_page.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Sort direction for results, ordered by created_at. Defaults to desc (newest
// first).
//
// Any of "asc", "desc".
Order BetaSessionListParamsOrder `query:"order,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionListParams) URLQuery ¶ added in v1.33.0
func (r BetaSessionListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaSessionListParams's query parameters as `url.Values`.
type BetaSessionListParamsOrder ¶ added in v1.33.0
type BetaSessionListParamsOrder string
Sort direction for results, ordered by created_at. Defaults to desc (newest first).
const ( BetaSessionListParamsOrderAsc BetaSessionListParamsOrder = "asc" BetaSessionListParamsOrderDesc BetaSessionListParamsOrder = "desc" )
type BetaSessionNewParams ¶ added in v1.33.0
type BetaSessionNewParams struct {
// Agent identifier. Accepts the `agent` ID string, which pins the latest version
// for the session, or an `agent` object with both id and version specified.
Agent BetaSessionNewParamsAgentUnion `json:"agent,omitzero" api:"required"`
// ID of the `environment` defining the container configuration for this session.
EnvironmentID string `json:"environment_id" api:"required"`
// Human-readable session title.
Title param.Opt[string] `json:"title,omitzero"`
// Arbitrary key-value metadata attached to the session. Maximum 16 pairs, keys up
// to 64 chars, values up to 512 chars.
Metadata map[string]string `json:"metadata,omitzero"`
// Resources (e.g. repositories, files) to mount into the session's container.
Resources []BetaSessionNewParamsResourceUnion `json:"resources,omitzero"`
// Vault IDs for stored credentials the agent can use during the session.
VaultIDs []string `json:"vault_ids,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionNewParams) MarshalJSON ¶ added in v1.33.0
func (r BetaSessionNewParams) MarshalJSON() (data []byte, err error)
func (*BetaSessionNewParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionNewParams) UnmarshalJSON(data []byte) error
type BetaSessionNewParamsAgentUnion ¶ added in v1.33.0
type BetaSessionNewParamsAgentUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfBetaManagedAgentsAgents *BetaManagedAgentsAgentParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaSessionNewParamsAgentUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaSessionNewParamsAgentUnion) MarshalJSON() ([]byte, error)
func (*BetaSessionNewParamsAgentUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaSessionNewParamsAgentUnion) UnmarshalJSON(data []byte) error
type BetaSessionNewParamsResourceUnion ¶ added in v1.33.0
type BetaSessionNewParamsResourceUnion struct {
OfGitHubRepository *BetaManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"`
OfFile *BetaManagedAgentsFileResourceParams `json:",omitzero,inline"`
OfMemoryStore *BetaManagedAgentsMemoryStoreResourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaSessionNewParamsResourceUnion) GetAccess ¶ added in v1.38.0
func (u BetaSessionNewParamsResourceUnion) GetAccess() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetAuthorizationToken ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) GetAuthorizationToken() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetCheckout ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) GetCheckout() *BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetFileID ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetInstructions ¶ added in v1.38.0
func (u BetaSessionNewParamsResourceUnion) GetInstructions() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetMemoryStoreID ¶ added in v1.38.0
func (u BetaSessionNewParamsResourceUnion) GetMemoryStoreID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetMountPath ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) GetMountPath() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetType ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) GetURL ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaSessionNewParamsResourceUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaSessionNewParamsResourceUnion) MarshalJSON() ([]byte, error)
func (*BetaSessionNewParamsResourceUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaSessionNewParamsResourceUnion) UnmarshalJSON(data []byte) error
type BetaSessionResourceAddParams ¶ added in v1.33.0
type BetaSessionResourceAddParams struct {
// Mount a file uploaded via the Files API into the session.
BetaManagedAgentsFileResourceParams BetaManagedAgentsFileResourceParams
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionResourceAddParams) MarshalJSON ¶ added in v1.33.0
func (r BetaSessionResourceAddParams) MarshalJSON() (data []byte, err error)
func (*BetaSessionResourceAddParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionResourceAddParams) UnmarshalJSON(data []byte) error
type BetaSessionResourceDeleteParams ¶ added in v1.33.0
type BetaSessionResourceDeleteParams struct {
SessionID string `path:"session_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSessionResourceGetParams ¶ added in v1.33.0
type BetaSessionResourceGetParams struct {
SessionID string `path:"session_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSessionResourceGetResponseUnion ¶ added in v1.33.0
type BetaSessionResourceGetResponseUnion struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
MountPath string `json:"mount_path"`
// Any of "github_repository", "file", "memory_store".
Type string `json:"type"`
UpdatedAt time.Time `json:"updated_at"`
// This field is from variant [BetaManagedAgentsGitHubRepositoryResource].
URL string `json:"url"`
// This field is from variant [BetaManagedAgentsGitHubRepositoryResource].
Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion `json:"checkout"`
// This field is from variant [BetaManagedAgentsFileResource].
FileID string `json:"file_id"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
MemoryStoreID string `json:"memory_store_id"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Access BetaManagedAgentsMemoryStoreResourceAccess `json:"access"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Description string `json:"description"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Instructions string `json:"instructions"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Name string `json:"name"`
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
MountPath respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
URL respjson.Field
Checkout respjson.Field
FileID respjson.Field
MemoryStoreID respjson.Field
Access respjson.Field
Description respjson.Field
Instructions respjson.Field
Name respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaSessionResourceGetResponseUnion contains all possible properties and values from BetaManagedAgentsGitHubRepositoryResource, BetaManagedAgentsFileResource, BetaManagedAgentsMemoryStoreResource.
Use the BetaSessionResourceGetResponseUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaSessionResourceGetResponseUnion) AsAny ¶ added in v1.33.0
func (u BetaSessionResourceGetResponseUnion) AsAny() anyBetaSessionResourceGetResponse
Use the following switch statement to find the correct variant
switch variant := BetaSessionResourceGetResponseUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsGitHubRepositoryResource:
case anthropic.BetaManagedAgentsFileResource:
case anthropic.BetaManagedAgentsMemoryStoreResource:
default:
fmt.Errorf("no variant present")
}
func (BetaSessionResourceGetResponseUnion) AsFile ¶ added in v1.33.0
func (u BetaSessionResourceGetResponseUnion) AsFile() (v BetaManagedAgentsFileResource)
func (BetaSessionResourceGetResponseUnion) AsGitHubRepository ¶ added in v1.33.0
func (u BetaSessionResourceGetResponseUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResource)
func (BetaSessionResourceGetResponseUnion) AsMemoryStore ¶ added in v1.38.0
func (u BetaSessionResourceGetResponseUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResource)
func (BetaSessionResourceGetResponseUnion) RawJSON ¶ added in v1.33.0
func (u BetaSessionResourceGetResponseUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSessionResourceGetResponseUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionResourceGetResponseUnion) UnmarshalJSON(data []byte) error
type BetaSessionResourceListParams ¶ added in v1.33.0
type BetaSessionResourceListParams struct {
// Maximum number of resources to return per page (max 1000). If omitted, returns
// all resources.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque cursor from a previous response's next_page field.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionResourceListParams) URLQuery ¶ added in v1.33.0
func (r BetaSessionResourceListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaSessionResourceListParams's query parameters as `url.Values`.
type BetaSessionResourceService ¶ added in v1.33.0
type BetaSessionResourceService struct {
Options []option.RequestOption
}
BetaSessionResourceService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaSessionResourceService method instead.
func NewBetaSessionResourceService ¶ added in v1.33.0
func NewBetaSessionResourceService(opts ...option.RequestOption) (r BetaSessionResourceService)
NewBetaSessionResourceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaSessionResourceService) Add ¶ added in v1.33.0
func (r *BetaSessionResourceService) Add(ctx context.Context, sessionID string, params BetaSessionResourceAddParams, opts ...option.RequestOption) (res *BetaManagedAgentsFileResource, err error)
Add Session Resource
func (*BetaSessionResourceService) Delete ¶ added in v1.33.0
func (r *BetaSessionResourceService) Delete(ctx context.Context, resourceID string, params BetaSessionResourceDeleteParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeleteSessionResource, err error)
Delete Session Resource
func (*BetaSessionResourceService) Get ¶ added in v1.33.0
func (r *BetaSessionResourceService) Get(ctx context.Context, resourceID string, params BetaSessionResourceGetParams, opts ...option.RequestOption) (res *BetaSessionResourceGetResponseUnion, err error)
Get Session Resource
func (*BetaSessionResourceService) List ¶ added in v1.33.0
func (r *BetaSessionResourceService) List(ctx context.Context, sessionID string, params BetaSessionResourceListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsSessionResourceUnion], err error)
List Session Resources
func (*BetaSessionResourceService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaSessionResourceService) ListAutoPaging(ctx context.Context, sessionID string, params BetaSessionResourceListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsSessionResourceUnion]
List Session Resources
func (*BetaSessionResourceService) Update ¶ added in v1.33.0
func (r *BetaSessionResourceService) Update(ctx context.Context, resourceID string, params BetaSessionResourceUpdateParams, opts ...option.RequestOption) (res *BetaSessionResourceUpdateResponseUnion, err error)
Update Session Resource
type BetaSessionResourceUpdateParams ¶ added in v1.33.0
type BetaSessionResourceUpdateParams struct {
SessionID string `path:"session_id" api:"required" json:"-"`
// New authorization token for the resource. Currently only `github_repository`
// resources support token rotation.
AuthorizationToken string `json:"authorization_token" api:"required"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionResourceUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaSessionResourceUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaSessionResourceUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionResourceUpdateParams) UnmarshalJSON(data []byte) error
type BetaSessionResourceUpdateResponseUnion ¶ added in v1.33.0
type BetaSessionResourceUpdateResponseUnion struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
MountPath string `json:"mount_path"`
// Any of "github_repository", "file", "memory_store".
Type string `json:"type"`
UpdatedAt time.Time `json:"updated_at"`
// This field is from variant [BetaManagedAgentsGitHubRepositoryResource].
URL string `json:"url"`
// This field is from variant [BetaManagedAgentsGitHubRepositoryResource].
Checkout BetaManagedAgentsGitHubRepositoryResourceCheckoutUnion `json:"checkout"`
// This field is from variant [BetaManagedAgentsFileResource].
FileID string `json:"file_id"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
MemoryStoreID string `json:"memory_store_id"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Access BetaManagedAgentsMemoryStoreResourceAccess `json:"access"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Description string `json:"description"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Instructions string `json:"instructions"`
// This field is from variant [BetaManagedAgentsMemoryStoreResource].
Name string `json:"name"`
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
MountPath respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
URL respjson.Field
Checkout respjson.Field
FileID respjson.Field
MemoryStoreID respjson.Field
Access respjson.Field
Description respjson.Field
Instructions respjson.Field
Name respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaSessionResourceUpdateResponseUnion contains all possible properties and values from BetaManagedAgentsGitHubRepositoryResource, BetaManagedAgentsFileResource, BetaManagedAgentsMemoryStoreResource.
Use the BetaSessionResourceUpdateResponseUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaSessionResourceUpdateResponseUnion) AsAny ¶ added in v1.33.0
func (u BetaSessionResourceUpdateResponseUnion) AsAny() anyBetaSessionResourceUpdateResponse
Use the following switch statement to find the correct variant
switch variant := BetaSessionResourceUpdateResponseUnion.AsAny().(type) {
case anthropic.BetaManagedAgentsGitHubRepositoryResource:
case anthropic.BetaManagedAgentsFileResource:
case anthropic.BetaManagedAgentsMemoryStoreResource:
default:
fmt.Errorf("no variant present")
}
func (BetaSessionResourceUpdateResponseUnion) AsFile ¶ added in v1.33.0
func (u BetaSessionResourceUpdateResponseUnion) AsFile() (v BetaManagedAgentsFileResource)
func (BetaSessionResourceUpdateResponseUnion) AsGitHubRepository ¶ added in v1.33.0
func (u BetaSessionResourceUpdateResponseUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResource)
func (BetaSessionResourceUpdateResponseUnion) AsMemoryStore ¶ added in v1.38.0
func (u BetaSessionResourceUpdateResponseUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResource)
func (BetaSessionResourceUpdateResponseUnion) RawJSON ¶ added in v1.33.0
func (u BetaSessionResourceUpdateResponseUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSessionResourceUpdateResponseUnion) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionResourceUpdateResponseUnion) UnmarshalJSON(data []byte) error
type BetaSessionService ¶ added in v1.33.0
type BetaSessionService struct {
Options []option.RequestOption
Events BetaSessionEventService
Resources BetaSessionResourceService
}
BetaSessionService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaSessionService method instead.
func NewBetaSessionService ¶ added in v1.33.0
func NewBetaSessionService(opts ...option.RequestOption) (r BetaSessionService)
NewBetaSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaSessionService) Archive ¶ added in v1.33.0
func (r *BetaSessionService) Archive(ctx context.Context, sessionID string, body BetaSessionArchiveParams, opts ...option.RequestOption) (res *BetaManagedAgentsSession, err error)
Archive Session
func (*BetaSessionService) Delete ¶ added in v1.33.0
func (r *BetaSessionService) Delete(ctx context.Context, sessionID string, body BetaSessionDeleteParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeletedSession, err error)
Delete Session
func (*BetaSessionService) Get ¶ added in v1.33.0
func (r *BetaSessionService) Get(ctx context.Context, sessionID string, query BetaSessionGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsSession, err error)
Get Session
func (*BetaSessionService) List ¶ added in v1.33.0
func (r *BetaSessionService) List(ctx context.Context, params BetaSessionListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsSession], err error)
List Sessions
func (*BetaSessionService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaSessionService) ListAutoPaging(ctx context.Context, params BetaSessionListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsSession]
List Sessions
func (*BetaSessionService) New ¶ added in v1.33.0
func (r *BetaSessionService) New(ctx context.Context, params BetaSessionNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsSession, err error)
Create Session
func (*BetaSessionService) Update ¶ added in v1.33.0
func (r *BetaSessionService) Update(ctx context.Context, sessionID string, params BetaSessionUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsSession, err error)
Update Session
type BetaSessionUpdateParams ¶ added in v1.33.0
type BetaSessionUpdateParams struct {
// Human-readable session title.
Title param.Opt[string] `json:"title,omitzero"`
// Metadata patch. Set a key to a string to upsert it, or to null to delete it.
// Omit the field to preserve.
Metadata map[string]string `json:"metadata,omitzero"`
// Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests
// setting this field are rejected. Reserved for future use.
VaultIDs []string `json:"vault_ids,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSessionUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaSessionUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaSessionUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaSessionUpdateParams) UnmarshalJSON(data []byte) error
type BetaSignatureDelta ¶
type BetaSignatureDelta struct {
Signature string `json:"signature" api:"required"`
Type constant.SignatureDelta `json:"type" default:"signature_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Signature respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSignatureDelta) RawJSON ¶
func (r BetaSignatureDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSignatureDelta) UnmarshalJSON ¶
func (r *BetaSignatureDelta) UnmarshalJSON(data []byte) error
type BetaSkill ¶ added in v1.15.0
type BetaSkill struct {
// Skill ID
SkillID string `json:"skill_id" api:"required"`
// Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
//
// Any of "anthropic", "custom".
Type BetaSkillType `json:"type" api:"required"`
// Skill version or 'latest' for most recent version
Version string `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A skill that was loaded in a container (response model).
func (*BetaSkill) UnmarshalJSON ¶ added in v1.15.0
type BetaSkillDeleteParams ¶ added in v1.15.0
type BetaSkillDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSkillDeleteResponse ¶ added in v1.15.0
type BetaSkillDeleteResponse struct {
// Unique identifier for the skill.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// Deleted object type.
//
// For Skills, this is always `"skill_deleted"`.
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillDeleteResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillDeleteResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillDeleteResponse) UnmarshalJSON(data []byte) error
type BetaSkillGetParams ¶ added in v1.15.0
type BetaSkillGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSkillGetResponse ¶ added in v1.15.0
type BetaSkillGetResponse struct {
// Unique identifier for the skill.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// ISO 8601 timestamp of when the skill was created.
CreatedAt string `json:"created_at" api:"required"`
// Display title for the skill.
//
// This is a human-readable label that is not included in the prompt sent to the
// model.
DisplayTitle string `json:"display_title" api:"required"`
// The latest version identifier for the skill.
//
// This represents the most recent version of the skill that has been created.
LatestVersion string `json:"latest_version" api:"required"`
// Source of the skill.
//
// This may be one of the following values:
//
// - `"custom"`: the skill was created by a user
// - `"anthropic"`: the skill was created by Anthropic
Source string `json:"source" api:"required"`
// Object type.
//
// For Skills, this is always `"skill"`.
Type string `json:"type" api:"required"`
// ISO 8601 timestamp of when the skill was last updated.
UpdatedAt string `json:"updated_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DisplayTitle respjson.Field
LatestVersion respjson.Field
Source respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillGetResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillGetResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillGetResponse) UnmarshalJSON(data []byte) error
type BetaSkillListParams ¶ added in v1.15.0
type BetaSkillListParams struct {
// Pagination token for fetching a specific page of results.
//
// Pass the value from a previous response's `next_page` field to get the next page
// of results.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Filter skills by source.
//
// If provided, only skills from the specified source will be returned:
//
// - `"custom"`: only return user-created skills
// - `"anthropic"`: only return Anthropic-created skills
Source param.Opt[string] `query:"source,omitzero" json:"-"`
// Number of results to return per page.
//
// Maximum value is 100. Defaults to 20.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSkillListParams) URLQuery ¶ added in v1.15.0
func (r BetaSkillListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaSkillListParams's query parameters as `url.Values`.
type BetaSkillListResponse ¶ added in v1.15.0
type BetaSkillListResponse struct {
// Unique identifier for the skill.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// ISO 8601 timestamp of when the skill was created.
CreatedAt string `json:"created_at" api:"required"`
// Display title for the skill.
//
// This is a human-readable label that is not included in the prompt sent to the
// model.
DisplayTitle string `json:"display_title" api:"required"`
// The latest version identifier for the skill.
//
// This represents the most recent version of the skill that has been created.
LatestVersion string `json:"latest_version" api:"required"`
// Source of the skill.
//
// This may be one of the following values:
//
// - `"custom"`: the skill was created by a user
// - `"anthropic"`: the skill was created by Anthropic
Source string `json:"source" api:"required"`
// Object type.
//
// For Skills, this is always `"skill"`.
Type string `json:"type" api:"required"`
// ISO 8601 timestamp of when the skill was last updated.
UpdatedAt string `json:"updated_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DisplayTitle respjson.Field
LatestVersion respjson.Field
Source respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillListResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillListResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillListResponse) UnmarshalJSON(data []byte) error
type BetaSkillNewParams ¶ added in v1.15.0
type BetaSkillNewParams struct {
// Display title for the skill.
//
// This is a human-readable label that is not included in the prompt sent to the
// model.
DisplayTitle param.Opt[string] `json:"display_title,omitzero"`
// Files to upload for the skill.
//
// All files must be in the same top-level directory and must include a SKILL.md
// file at the root of that directory.
Files []io.Reader `json:"files,omitzero" format:"binary"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSkillNewParams) MarshalMultipart ¶ added in v1.15.0
func (r BetaSkillNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type BetaSkillNewResponse ¶ added in v1.15.0
type BetaSkillNewResponse struct {
// Unique identifier for the skill.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// ISO 8601 timestamp of when the skill was created.
CreatedAt string `json:"created_at" api:"required"`
// Display title for the skill.
//
// This is a human-readable label that is not included in the prompt sent to the
// model.
DisplayTitle string `json:"display_title" api:"required"`
// The latest version identifier for the skill.
//
// This represents the most recent version of the skill that has been created.
LatestVersion string `json:"latest_version" api:"required"`
// Source of the skill.
//
// This may be one of the following values:
//
// - `"custom"`: the skill was created by a user
// - `"anthropic"`: the skill was created by Anthropic
Source string `json:"source" api:"required"`
// Object type.
//
// For Skills, this is always `"skill"`.
Type string `json:"type" api:"required"`
// ISO 8601 timestamp of when the skill was last updated.
UpdatedAt string `json:"updated_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
DisplayTitle respjson.Field
LatestVersion respjson.Field
Source respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillNewResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillNewResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillNewResponse) UnmarshalJSON(data []byte) error
type BetaSkillParams ¶ added in v1.15.0
type BetaSkillParams struct {
// Skill ID
SkillID string `json:"skill_id" api:"required"`
// Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
//
// Any of "anthropic", "custom".
Type BetaSkillParamsType `json:"type,omitzero" api:"required"`
// Skill version or 'latest' for most recent version
Version param.Opt[string] `json:"version,omitzero"`
// contains filtered or unexported fields
}
Specification for a skill to be loaded in a container (request model).
The properties SkillID, Type are required.
func (BetaSkillParams) MarshalJSON ¶ added in v1.15.0
func (r BetaSkillParams) MarshalJSON() (data []byte, err error)
func (*BetaSkillParams) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillParams) UnmarshalJSON(data []byte) error
type BetaSkillParamsType ¶ added in v1.15.0
type BetaSkillParamsType string
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
const ( BetaSkillParamsTypeAnthropic BetaSkillParamsType = "anthropic" BetaSkillParamsTypeCustom BetaSkillParamsType = "custom" )
type BetaSkillService ¶ added in v1.15.0
type BetaSkillService struct {
Options []option.RequestOption
Versions BetaSkillVersionService
}
BetaSkillService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaSkillService method instead.
func NewBetaSkillService ¶ added in v1.15.0
func NewBetaSkillService(opts ...option.RequestOption) (r BetaSkillService)
NewBetaSkillService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaSkillService) Delete ¶ added in v1.15.0
func (r *BetaSkillService) Delete(ctx context.Context, skillID string, body BetaSkillDeleteParams, opts ...option.RequestOption) (res *BetaSkillDeleteResponse, err error)
Delete Skill
func (*BetaSkillService) Get ¶ added in v1.15.0
func (r *BetaSkillService) Get(ctx context.Context, skillID string, query BetaSkillGetParams, opts ...option.RequestOption) (res *BetaSkillGetResponse, err error)
Get Skill
func (*BetaSkillService) List ¶ added in v1.15.0
func (r *BetaSkillService) List(ctx context.Context, params BetaSkillListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaSkillListResponse], err error)
List Skills
func (*BetaSkillService) ListAutoPaging ¶ added in v1.15.0
func (r *BetaSkillService) ListAutoPaging(ctx context.Context, params BetaSkillListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaSkillListResponse]
List Skills
func (*BetaSkillService) New ¶ added in v1.15.0
func (r *BetaSkillService) New(ctx context.Context, params BetaSkillNewParams, opts ...option.RequestOption) (res *BetaSkillNewResponse, err error)
Create Skill
type BetaSkillType ¶ added in v1.15.0
type BetaSkillType string
Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
const ( BetaSkillTypeAnthropic BetaSkillType = "anthropic" BetaSkillTypeCustom BetaSkillType = "custom" )
type BetaSkillVersionDeleteParams ¶ added in v1.15.0
type BetaSkillVersionDeleteParams struct {
// Unique identifier for the skill.
//
// The format and length of IDs may change over time.
SkillID string `path:"skill_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSkillVersionDeleteResponse ¶ added in v1.15.0
type BetaSkillVersionDeleteResponse struct {
// Version identifier for the skill.
//
// Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
ID string `json:"id" api:"required"`
// Deleted object type.
//
// For Skill Versions, this is always `"skill_version_deleted"`.
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillVersionDeleteResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillVersionDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillVersionDeleteResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillVersionDeleteResponse) UnmarshalJSON(data []byte) error
type BetaSkillVersionGetParams ¶ added in v1.15.0
type BetaSkillVersionGetParams struct {
// Unique identifier for the skill.
//
// The format and length of IDs may change over time.
SkillID string `path:"skill_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaSkillVersionGetResponse ¶ added in v1.15.0
type BetaSkillVersionGetResponse struct {
// Unique identifier for the skill version.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// ISO 8601 timestamp of when the skill version was created.
CreatedAt string `json:"created_at" api:"required"`
// Description of the skill version.
//
// This is extracted from the SKILL.md file in the skill upload.
Description string `json:"description" api:"required"`
// Directory name of the skill version.
//
// This is the top-level directory name that was extracted from the uploaded files.
Directory string `json:"directory" api:"required"`
// Human-readable name of the skill version.
//
// This is extracted from the SKILL.md file in the skill upload.
Name string `json:"name" api:"required"`
// Identifier for the skill that this version belongs to.
SkillID string `json:"skill_id" api:"required"`
// Object type.
//
// For Skill Versions, this is always `"skill_version"`.
Type string `json:"type" api:"required"`
// Version identifier for the skill.
//
// Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
Version string `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Directory respjson.Field
Name respjson.Field
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillVersionGetResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillVersionGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillVersionGetResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillVersionGetResponse) UnmarshalJSON(data []byte) error
type BetaSkillVersionListParams ¶ added in v1.15.0
type BetaSkillVersionListParams struct {
// Number of items to return per page.
//
// Defaults to `20`. Ranges from `1` to `1000`.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optionally set to the `next_page` token from the previous response.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSkillVersionListParams) URLQuery ¶ added in v1.15.0
func (r BetaSkillVersionListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaSkillVersionListParams's query parameters as `url.Values`.
type BetaSkillVersionListResponse ¶ added in v1.15.0
type BetaSkillVersionListResponse struct {
// Unique identifier for the skill version.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// ISO 8601 timestamp of when the skill version was created.
CreatedAt string `json:"created_at" api:"required"`
// Description of the skill version.
//
// This is extracted from the SKILL.md file in the skill upload.
Description string `json:"description" api:"required"`
// Directory name of the skill version.
//
// This is the top-level directory name that was extracted from the uploaded files.
Directory string `json:"directory" api:"required"`
// Human-readable name of the skill version.
//
// This is extracted from the SKILL.md file in the skill upload.
Name string `json:"name" api:"required"`
// Identifier for the skill that this version belongs to.
SkillID string `json:"skill_id" api:"required"`
// Object type.
//
// For Skill Versions, this is always `"skill_version"`.
Type string `json:"type" api:"required"`
// Version identifier for the skill.
//
// Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
Version string `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Directory respjson.Field
Name respjson.Field
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillVersionListResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillVersionListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillVersionListResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillVersionListResponse) UnmarshalJSON(data []byte) error
type BetaSkillVersionNewParams ¶ added in v1.15.0
type BetaSkillVersionNewParams struct {
// Files to upload for the skill.
//
// All files must be in the same top-level directory and must include a SKILL.md
// file at the root of that directory.
Files []io.Reader `json:"files,omitzero" format:"binary"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaSkillVersionNewParams) MarshalMultipart ¶ added in v1.15.0
func (r BetaSkillVersionNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type BetaSkillVersionNewResponse ¶ added in v1.15.0
type BetaSkillVersionNewResponse struct {
// Unique identifier for the skill version.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// ISO 8601 timestamp of when the skill version was created.
CreatedAt string `json:"created_at" api:"required"`
// Description of the skill version.
//
// This is extracted from the SKILL.md file in the skill upload.
Description string `json:"description" api:"required"`
// Directory name of the skill version.
//
// This is the top-level directory name that was extracted from the uploaded files.
Directory string `json:"directory" api:"required"`
// Human-readable name of the skill version.
//
// This is extracted from the SKILL.md file in the skill upload.
Name string `json:"name" api:"required"`
// Identifier for the skill that this version belongs to.
SkillID string `json:"skill_id" api:"required"`
// Object type.
//
// For Skill Versions, this is always `"skill_version"`.
Type string `json:"type" api:"required"`
// Version identifier for the skill.
//
// Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129").
Version string `json:"version" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Description respjson.Field
Directory respjson.Field
Name respjson.Field
SkillID respjson.Field
Type respjson.Field
Version respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaSkillVersionNewResponse) RawJSON ¶ added in v1.15.0
func (r BetaSkillVersionNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaSkillVersionNewResponse) UnmarshalJSON ¶ added in v1.15.0
func (r *BetaSkillVersionNewResponse) UnmarshalJSON(data []byte) error
type BetaSkillVersionService ¶ added in v1.15.0
type BetaSkillVersionService struct {
Options []option.RequestOption
}
BetaSkillVersionService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaSkillVersionService method instead.
func NewBetaSkillVersionService ¶ added in v1.15.0
func NewBetaSkillVersionService(opts ...option.RequestOption) (r BetaSkillVersionService)
NewBetaSkillVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaSkillVersionService) Delete ¶ added in v1.15.0
func (r *BetaSkillVersionService) Delete(ctx context.Context, version string, params BetaSkillVersionDeleteParams, opts ...option.RequestOption) (res *BetaSkillVersionDeleteResponse, err error)
Delete Skill Version
func (*BetaSkillVersionService) Get ¶ added in v1.15.0
func (r *BetaSkillVersionService) Get(ctx context.Context, version string, params BetaSkillVersionGetParams, opts ...option.RequestOption) (res *BetaSkillVersionGetResponse, err error)
Get Skill Version
func (*BetaSkillVersionService) List ¶ added in v1.15.0
func (r *BetaSkillVersionService) List(ctx context.Context, skillID string, params BetaSkillVersionListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaSkillVersionListResponse], err error)
List Skill Versions
func (*BetaSkillVersionService) ListAutoPaging ¶ added in v1.15.0
func (r *BetaSkillVersionService) ListAutoPaging(ctx context.Context, skillID string, params BetaSkillVersionListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaSkillVersionListResponse]
List Skill Versions
func (*BetaSkillVersionService) New ¶ added in v1.15.0
func (r *BetaSkillVersionService) New(ctx context.Context, skillID string, params BetaSkillVersionNewParams, opts ...option.RequestOption) (res *BetaSkillVersionNewResponse, err error)
Create Skill Version
type BetaStopReason ¶
type BetaStopReason string
const ( BetaStopReasonEndTurn BetaStopReason = "end_turn" BetaStopReasonMaxTokens BetaStopReason = "max_tokens" BetaStopReasonStopSequence BetaStopReason = "stop_sequence" BetaStopReasonToolUse BetaStopReason = "tool_use" BetaStopReasonPauseTurn BetaStopReason = "pause_turn" BetaStopReasonCompaction BetaStopReason = "compaction" BetaStopReasonRefusal BetaStopReason = "refusal" BetaStopReasonModelContextWindowExceeded BetaStopReason = "model_context_window_exceeded" )
type BetaTextBlock ¶
type BetaTextBlock struct {
// Citations supporting the text block.
//
// The type of citation returned will depend on the type of document being cited.
// Citing a PDF results in `page_location`, plain text results in `char_location`,
// and content document results in `content_block_location`.
Citations []BetaTextCitationUnion `json:"citations" api:"required"`
Text string `json:"text" api:"required"`
Type constant.Text `json:"type" default:"text"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Citations respjson.Field
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextBlock) RawJSON ¶
func (r BetaTextBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaTextBlock) ToParam ¶
func (r BetaTextBlock) ToParam() BetaTextBlockParam
func (*BetaTextBlock) UnmarshalJSON ¶
func (r *BetaTextBlock) UnmarshalJSON(data []byte) error
type BetaTextBlockParam ¶
type BetaTextBlockParam struct {
Text string `json:"text" api:"required"`
Citations []BetaTextCitationParamUnion `json:"citations,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "text".
Type constant.Text `json:"type" default:"text"`
// contains filtered or unexported fields
}
The properties Text, Type are required.
func (BetaTextBlockParam) MarshalJSON ¶
func (r BetaTextBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaTextBlockParam) UnmarshalJSON ¶
func (r *BetaTextBlockParam) UnmarshalJSON(data []byte) error
type BetaTextCitationParamUnion ¶
type BetaTextCitationParamUnion struct {
OfCharLocation *BetaCitationCharLocationParam `json:",omitzero,inline"`
OfPageLocation *BetaCitationPageLocationParam `json:",omitzero,inline"`
OfContentBlockLocation *BetaCitationContentBlockLocationParam `json:",omitzero,inline"`
OfWebSearchResultLocation *BetaCitationWebSearchResultLocationParam `json:",omitzero,inline"`
OfSearchResultLocation *BetaCitationSearchResultLocationParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaTextCitationParamUnion) GetCitedText ¶
func (u BetaTextCitationParamUnion) GetCitedText() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetDocumentIndex ¶
func (u BetaTextCitationParamUnion) GetDocumentIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetDocumentTitle ¶
func (u BetaTextCitationParamUnion) GetDocumentTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetEncryptedIndex ¶
func (u BetaTextCitationParamUnion) GetEncryptedIndex() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetEndBlockIndex ¶
func (u BetaTextCitationParamUnion) GetEndBlockIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetEndCharIndex ¶
func (u BetaTextCitationParamUnion) GetEndCharIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetEndPageNumber ¶
func (u BetaTextCitationParamUnion) GetEndPageNumber() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetSearchResultIndex ¶ added in v1.5.0
func (u BetaTextCitationParamUnion) GetSearchResultIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetSource ¶ added in v1.5.0
func (u BetaTextCitationParamUnion) GetSource() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetStartBlockIndex ¶
func (u BetaTextCitationParamUnion) GetStartBlockIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetStartCharIndex ¶
func (u BetaTextCitationParamUnion) GetStartCharIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetStartPageNumber ¶
func (u BetaTextCitationParamUnion) GetStartPageNumber() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetTitle ¶
func (u BetaTextCitationParamUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetType ¶
func (u BetaTextCitationParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) GetURL ¶
func (u BetaTextCitationParamUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextCitationParamUnion) MarshalJSON ¶
func (u BetaTextCitationParamUnion) MarshalJSON() ([]byte, error)
func (*BetaTextCitationParamUnion) UnmarshalJSON ¶
func (u *BetaTextCitationParamUnion) UnmarshalJSON(data []byte) error
type BetaTextCitationUnion ¶
type BetaTextCitationUnion struct {
CitedText string `json:"cited_text"`
DocumentIndex int64 `json:"document_index"`
DocumentTitle string `json:"document_title"`
// This field is from variant [BetaCitationCharLocation].
EndCharIndex int64 `json:"end_char_index"`
FileID string `json:"file_id"`
// This field is from variant [BetaCitationCharLocation].
StartCharIndex int64 `json:"start_char_index"`
// Any of "char_location", "page_location", "content_block_location",
// "web_search_result_location", "search_result_location".
Type string `json:"type"`
// This field is from variant [BetaCitationPageLocation].
EndPageNumber int64 `json:"end_page_number"`
// This field is from variant [BetaCitationPageLocation].
StartPageNumber int64 `json:"start_page_number"`
EndBlockIndex int64 `json:"end_block_index"`
StartBlockIndex int64 `json:"start_block_index"`
// This field is from variant [BetaCitationsWebSearchResultLocation].
EncryptedIndex string `json:"encrypted_index"`
Title string `json:"title"`
// This field is from variant [BetaCitationsWebSearchResultLocation].
URL string `json:"url"`
// This field is from variant [BetaCitationSearchResultLocation].
SearchResultIndex int64 `json:"search_result_index"`
// This field is from variant [BetaCitationSearchResultLocation].
Source string `json:"source"`
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndCharIndex respjson.Field
FileID respjson.Field
StartCharIndex respjson.Field
Type respjson.Field
EndPageNumber respjson.Field
StartPageNumber respjson.Field
EndBlockIndex respjson.Field
StartBlockIndex respjson.Field
EncryptedIndex respjson.Field
Title respjson.Field
URL respjson.Field
SearchResultIndex respjson.Field
Source respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaTextCitationUnion contains all possible properties and values from BetaCitationCharLocation, BetaCitationPageLocation, BetaCitationContentBlockLocation, BetaCitationsWebSearchResultLocation, BetaCitationSearchResultLocation.
Use the BetaTextCitationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaTextCitationUnion) AsAny ¶
func (u BetaTextCitationUnion) AsAny() anyBetaTextCitation
Use the following switch statement to find the correct variant
switch variant := BetaTextCitationUnion.AsAny().(type) {
case anthropic.BetaCitationCharLocation:
case anthropic.BetaCitationPageLocation:
case anthropic.BetaCitationContentBlockLocation:
case anthropic.BetaCitationsWebSearchResultLocation:
case anthropic.BetaCitationSearchResultLocation:
default:
fmt.Errorf("no variant present")
}
func (BetaTextCitationUnion) AsCharLocation ¶
func (u BetaTextCitationUnion) AsCharLocation() (v BetaCitationCharLocation)
func (BetaTextCitationUnion) AsContentBlockLocation ¶
func (u BetaTextCitationUnion) AsContentBlockLocation() (v BetaCitationContentBlockLocation)
func (BetaTextCitationUnion) AsPageLocation ¶
func (u BetaTextCitationUnion) AsPageLocation() (v BetaCitationPageLocation)
func (BetaTextCitationUnion) AsSearchResultLocation ¶ added in v1.5.0
func (u BetaTextCitationUnion) AsSearchResultLocation() (v BetaCitationSearchResultLocation)
func (BetaTextCitationUnion) AsWebSearchResultLocation ¶
func (u BetaTextCitationUnion) AsWebSearchResultLocation() (v BetaCitationsWebSearchResultLocation)
func (BetaTextCitationUnion) RawJSON ¶
func (u BetaTextCitationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextCitationUnion) UnmarshalJSON ¶
func (r *BetaTextCitationUnion) UnmarshalJSON(data []byte) error
type BetaTextDelta ¶
type BetaTextDelta struct {
Text string `json:"text" api:"required"`
Type constant.TextDelta `json:"type" default:"text_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextDelta) RawJSON ¶
func (r BetaTextDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextDelta) UnmarshalJSON ¶
func (r *BetaTextDelta) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionCreateResultBlock ¶ added in v1.10.0
type BetaTextEditorCodeExecutionCreateResultBlock struct {
IsFileUpdate bool `json:"is_file_update" api:"required"`
Type constant.TextEditorCodeExecutionCreateResult `json:"type" default:"text_editor_code_execution_create_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
IsFileUpdate respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextEditorCodeExecutionCreateResultBlock) RawJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionCreateResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextEditorCodeExecutionCreateResultBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionCreateResultBlock) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionCreateResultBlockParam ¶ added in v1.10.0
type BetaTextEditorCodeExecutionCreateResultBlockParam struct {
IsFileUpdate bool `json:"is_file_update" api:"required"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_create_result".
Type constant.TextEditorCodeExecutionCreateResult `json:"type" default:"text_editor_code_execution_create_result"`
// contains filtered or unexported fields
}
The properties IsFileUpdate, Type are required.
func (BetaTextEditorCodeExecutionCreateResultBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionCreateResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaTextEditorCodeExecutionCreateResultBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionCreateResultBlockParam) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionStrReplaceResultBlock ¶ added in v1.10.0
type BetaTextEditorCodeExecutionStrReplaceResultBlock struct {
Lines []string `json:"lines" api:"required"`
NewLines int64 `json:"new_lines" api:"required"`
NewStart int64 `json:"new_start" api:"required"`
OldLines int64 `json:"old_lines" api:"required"`
OldStart int64 `json:"old_start" api:"required"`
Type constant.TextEditorCodeExecutionStrReplaceResult `json:"type" default:"text_editor_code_execution_str_replace_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextEditorCodeExecutionStrReplaceResultBlock) RawJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionStrReplaceResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextEditorCodeExecutionStrReplaceResultBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionStrReplaceResultBlock) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionStrReplaceResultBlockParam ¶ added in v1.10.0
type BetaTextEditorCodeExecutionStrReplaceResultBlockParam struct {
NewLines param.Opt[int64] `json:"new_lines,omitzero"`
NewStart param.Opt[int64] `json:"new_start,omitzero"`
OldLines param.Opt[int64] `json:"old_lines,omitzero"`
OldStart param.Opt[int64] `json:"old_start,omitzero"`
Lines []string `json:"lines,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_str_replace_result".
Type constant.TextEditorCodeExecutionStrReplaceResult `json:"type" default:"text_editor_code_execution_str_replace_result"`
// contains filtered or unexported fields
}
The property Type is required.
func (BetaTextEditorCodeExecutionStrReplaceResultBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionStrReplaceResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaTextEditorCodeExecutionStrReplaceResultBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionStrReplaceResultBlockParam) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultBlock ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultBlock struct {
Content BetaTextEditorCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.TextEditorCodeExecutionToolResult `json:"type" default:"text_editor_code_execution_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextEditorCodeExecutionToolResultBlock) RawJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextEditorCodeExecutionToolResultBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultBlockContentUnion ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultBlockContentUnion struct {
// This field is from variant [BetaTextEditorCodeExecutionToolResultError].
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode `json:"error_code"`
// This field is from variant [BetaTextEditorCodeExecutionToolResultError].
ErrorMessage string `json:"error_message"`
Type string `json:"type"`
// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
Content string `json:"content"`
// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
NumLines int64 `json:"num_lines"`
// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
StartLine int64 `json:"start_line"`
// This field is from variant [BetaTextEditorCodeExecutionViewResultBlock].
TotalLines int64 `json:"total_lines"`
// This field is from variant [BetaTextEditorCodeExecutionCreateResultBlock].
IsFileUpdate bool `json:"is_file_update"`
// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
Lines []string `json:"lines"`
// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
NewLines int64 `json:"new_lines"`
// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
NewStart int64 `json:"new_start"`
// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
OldLines int64 `json:"old_lines"`
// This field is from variant [BetaTextEditorCodeExecutionStrReplaceResultBlock].
OldStart int64 `json:"old_start"`
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
Content respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
IsFileUpdate respjson.Field
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaTextEditorCodeExecutionToolResultBlockContentUnion contains all possible properties and values from BetaTextEditorCodeExecutionToolResultError, BetaTextEditorCodeExecutionViewResultBlock, BetaTextEditorCodeExecutionCreateResultBlock, BetaTextEditorCodeExecutionStrReplaceResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock() (v BetaTextEditorCodeExecutionCreateResultBlock)
func (BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock() (v BetaTextEditorCodeExecutionStrReplaceResultBlock)
func (BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError() (v BetaTextEditorCodeExecutionToolResultError)
func (BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock() (v BetaTextEditorCodeExecutionViewResultBlock)
func (BetaTextEditorCodeExecutionToolResultBlockContentUnion) RawJSON ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultBlockParam ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultBlockParam struct {
Content BetaTextEditorCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_tool_result".
Type constant.TextEditorCodeExecutionToolResult `json:"type" default:"text_editor_code_execution_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaTextEditorCodeExecutionToolResultBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaTextEditorCodeExecutionToolResultBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultBlockParamContentUnion ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultBlockParamContentUnion struct {
OfRequestTextEditorCodeExecutionToolResultError *BetaTextEditorCodeExecutionToolResultErrorParam `json:",omitzero,inline"`
OfRequestTextEditorCodeExecutionViewResultBlock *BetaTextEditorCodeExecutionViewResultBlockParam `json:",omitzero,inline"`
OfRequestTextEditorCodeExecutionCreateResultBlock *BetaTextEditorCodeExecutionCreateResultBlockParam `json:",omitzero,inline"`
OfRequestTextEditorCodeExecutionStrReplaceResultBlock *BetaTextEditorCodeExecutionStrReplaceResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines() []string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetType ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.10.0
func (u BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.10.0
func (u *BetaTextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultError ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "file_not_found".
ErrorCode BetaTextEditorCodeExecutionToolResultErrorErrorCode `json:"error_code" api:"required"`
ErrorMessage string `json:"error_message" api:"required"`
Type constant.TextEditorCodeExecutionToolResultError `json:"type" default:"text_editor_code_execution_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextEditorCodeExecutionToolResultError) RawJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextEditorCodeExecutionToolResultError) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionToolResultError) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultErrorErrorCode ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultErrorErrorCode string
const ( BetaTextEditorCodeExecutionToolResultErrorErrorCodeInvalidToolInput BetaTextEditorCodeExecutionToolResultErrorErrorCode = "invalid_tool_input" BetaTextEditorCodeExecutionToolResultErrorErrorCodeTooManyRequests BetaTextEditorCodeExecutionToolResultErrorErrorCode = "too_many_requests" BetaTextEditorCodeExecutionToolResultErrorErrorCodeExecutionTimeExceeded BetaTextEditorCodeExecutionToolResultErrorErrorCode = "execution_time_exceeded" BetaTextEditorCodeExecutionToolResultErrorErrorCodeFileNotFound BetaTextEditorCodeExecutionToolResultErrorErrorCode = "file_not_found" )
type BetaTextEditorCodeExecutionToolResultErrorParam ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "file_not_found".
ErrorCode BetaTextEditorCodeExecutionToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
ErrorMessage param.Opt[string] `json:"error_message,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_tool_result_error".
Type constant.TextEditorCodeExecutionToolResultError `json:"type" default:"text_editor_code_execution_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaTextEditorCodeExecutionToolResultErrorParam) MarshalJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*BetaTextEditorCodeExecutionToolResultErrorParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionToolResultErrorParamErrorCode ¶ added in v1.10.0
type BetaTextEditorCodeExecutionToolResultErrorParamErrorCode string
const ( BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeInvalidToolInput BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "invalid_tool_input" BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeTooManyRequests BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "too_many_requests" BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeExecutionTimeExceeded BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "execution_time_exceeded" BetaTextEditorCodeExecutionToolResultErrorParamErrorCodeFileNotFound BetaTextEditorCodeExecutionToolResultErrorParamErrorCode = "file_not_found" )
type BetaTextEditorCodeExecutionViewResultBlock ¶ added in v1.10.0
type BetaTextEditorCodeExecutionViewResultBlock struct {
Content string `json:"content" api:"required"`
// Any of "text", "image", "pdf".
FileType BetaTextEditorCodeExecutionViewResultBlockFileType `json:"file_type" api:"required"`
NumLines int64 `json:"num_lines" api:"required"`
StartLine int64 `json:"start_line" api:"required"`
TotalLines int64 `json:"total_lines" api:"required"`
Type constant.TextEditorCodeExecutionViewResult `json:"type" default:"text_editor_code_execution_view_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaTextEditorCodeExecutionViewResultBlock) RawJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionViewResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaTextEditorCodeExecutionViewResultBlock) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionViewResultBlock) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionViewResultBlockFileType ¶ added in v1.10.0
type BetaTextEditorCodeExecutionViewResultBlockFileType string
const ( BetaTextEditorCodeExecutionViewResultBlockFileTypeText BetaTextEditorCodeExecutionViewResultBlockFileType = "text" BetaTextEditorCodeExecutionViewResultBlockFileTypeImage BetaTextEditorCodeExecutionViewResultBlockFileType = "image" BetaTextEditorCodeExecutionViewResultBlockFileTypePDF BetaTextEditorCodeExecutionViewResultBlockFileType = "pdf" )
type BetaTextEditorCodeExecutionViewResultBlockParam ¶ added in v1.10.0
type BetaTextEditorCodeExecutionViewResultBlockParam struct {
Content string `json:"content" api:"required"`
// Any of "text", "image", "pdf".
FileType BetaTextEditorCodeExecutionViewResultBlockParamFileType `json:"file_type,omitzero" api:"required"`
NumLines param.Opt[int64] `json:"num_lines,omitzero"`
StartLine param.Opt[int64] `json:"start_line,omitzero"`
TotalLines param.Opt[int64] `json:"total_lines,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_view_result".
Type constant.TextEditorCodeExecutionViewResult `json:"type" default:"text_editor_code_execution_view_result"`
// contains filtered or unexported fields
}
The properties Content, FileType, Type are required.
func (BetaTextEditorCodeExecutionViewResultBlockParam) MarshalJSON ¶ added in v1.10.0
func (r BetaTextEditorCodeExecutionViewResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaTextEditorCodeExecutionViewResultBlockParam) UnmarshalJSON ¶ added in v1.10.0
func (r *BetaTextEditorCodeExecutionViewResultBlockParam) UnmarshalJSON(data []byte) error
type BetaTextEditorCodeExecutionViewResultBlockParamFileType ¶ added in v1.10.0
type BetaTextEditorCodeExecutionViewResultBlockParamFileType string
const ( BetaTextEditorCodeExecutionViewResultBlockParamFileTypeText BetaTextEditorCodeExecutionViewResultBlockParamFileType = "text" BetaTextEditorCodeExecutionViewResultBlockParamFileTypeImage BetaTextEditorCodeExecutionViewResultBlockParamFileType = "image" BetaTextEditorCodeExecutionViewResultBlockParamFileTypePDF BetaTextEditorCodeExecutionViewResultBlockParamFileType = "pdf" )
type BetaThinkingBlock ¶
type BetaThinkingBlock struct {
Signature string `json:"signature" api:"required"`
Thinking string `json:"thinking" api:"required"`
Type constant.Thinking `json:"type" default:"thinking"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Signature respjson.Field
Thinking respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaThinkingBlock) RawJSON ¶
func (r BetaThinkingBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaThinkingBlock) ToParam ¶
func (r BetaThinkingBlock) ToParam() BetaThinkingBlockParam
func (*BetaThinkingBlock) UnmarshalJSON ¶
func (r *BetaThinkingBlock) UnmarshalJSON(data []byte) error
type BetaThinkingBlockParam ¶
type BetaThinkingBlockParam struct {
Signature string `json:"signature" api:"required"`
Thinking string `json:"thinking" api:"required"`
// This field can be elided, and will marshal its zero value as "thinking".
Type constant.Thinking `json:"type" default:"thinking"`
// contains filtered or unexported fields
}
The properties Signature, Thinking, Type are required.
func (BetaThinkingBlockParam) MarshalJSON ¶
func (r BetaThinkingBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaThinkingBlockParam) UnmarshalJSON ¶
func (r *BetaThinkingBlockParam) UnmarshalJSON(data []byte) error
type BetaThinkingCapability ¶ added in v1.27.1
type BetaThinkingCapability struct {
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// Supported thinking type configurations.
Types BetaThinkingTypes `json:"types" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Supported respjson.Field
Types respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Thinking capability details.
func (BetaThinkingCapability) RawJSON ¶ added in v1.27.1
func (r BetaThinkingCapability) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaThinkingCapability) UnmarshalJSON ¶ added in v1.27.1
func (r *BetaThinkingCapability) UnmarshalJSON(data []byte) error
type BetaThinkingConfigAdaptiveDisplay ¶ added in v1.27.0
type BetaThinkingConfigAdaptiveDisplay string
Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
const ( BetaThinkingConfigAdaptiveDisplaySummarized BetaThinkingConfigAdaptiveDisplay = "summarized" BetaThinkingConfigAdaptiveDisplayOmitted BetaThinkingConfigAdaptiveDisplay = "omitted" )
type BetaThinkingConfigAdaptiveParam ¶ added in v1.21.0
type BetaThinkingConfigAdaptiveParam struct {
// Controls how thinking content appears in the response. When set to `summarized`,
// thinking is returned normally. When set to `omitted`, thinking content is
// redacted but a signature is returned for multi-turn continuity. Defaults to
// `summarized`.
//
// Any of "summarized", "omitted".
Display BetaThinkingConfigAdaptiveDisplay `json:"display,omitzero"`
// This field can be elided, and will marshal its zero value as "adaptive".
Type constant.Adaptive `json:"type" default:"adaptive"`
// contains filtered or unexported fields
}
The property Type is required.
func (BetaThinkingConfigAdaptiveParam) MarshalJSON ¶ added in v1.21.0
func (r BetaThinkingConfigAdaptiveParam) MarshalJSON() (data []byte, err error)
func (*BetaThinkingConfigAdaptiveParam) UnmarshalJSON ¶ added in v1.21.0
func (r *BetaThinkingConfigAdaptiveParam) UnmarshalJSON(data []byte) error
type BetaThinkingConfigDisabledParam ¶
type BetaThinkingConfigDisabledParam struct {
Type constant.Disabled `json:"type" default:"disabled"`
// contains filtered or unexported fields
}
This struct has a constant value, construct it with NewBetaThinkingConfigDisabledParam.
func NewBetaThinkingConfigDisabledParam ¶
func NewBetaThinkingConfigDisabledParam() BetaThinkingConfigDisabledParam
func (BetaThinkingConfigDisabledParam) MarshalJSON ¶
func (r BetaThinkingConfigDisabledParam) MarshalJSON() (data []byte, err error)
func (*BetaThinkingConfigDisabledParam) UnmarshalJSON ¶
func (r *BetaThinkingConfigDisabledParam) UnmarshalJSON(data []byte) error
type BetaThinkingConfigEnabledDisplay ¶ added in v1.27.0
type BetaThinkingConfigEnabledDisplay string
Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
const ( BetaThinkingConfigEnabledDisplaySummarized BetaThinkingConfigEnabledDisplay = "summarized" BetaThinkingConfigEnabledDisplayOmitted BetaThinkingConfigEnabledDisplay = "omitted" )
type BetaThinkingConfigEnabledParam ¶
type BetaThinkingConfigEnabledParam struct {
// Determines how many tokens Claude can use for its internal reasoning process.
// Larger budgets can enable more thorough analysis for complex problems, improving
// response quality.
//
// Must be ≥1024 and less than `max_tokens`.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
BudgetTokens int64 `json:"budget_tokens" api:"required"`
// Controls how thinking content appears in the response. When set to `summarized`,
// thinking is returned normally. When set to `omitted`, thinking content is
// redacted but a signature is returned for multi-turn continuity. Defaults to
// `summarized`.
//
// Any of "summarized", "omitted".
Display BetaThinkingConfigEnabledDisplay `json:"display,omitzero"`
// This field can be elided, and will marshal its zero value as "enabled".
Type constant.Enabled `json:"type" default:"enabled"`
// contains filtered or unexported fields
}
The properties BudgetTokens, Type are required.
func (BetaThinkingConfigEnabledParam) MarshalJSON ¶
func (r BetaThinkingConfigEnabledParam) MarshalJSON() (data []byte, err error)
func (*BetaThinkingConfigEnabledParam) UnmarshalJSON ¶
func (r *BetaThinkingConfigEnabledParam) UnmarshalJSON(data []byte) error
type BetaThinkingConfigParamUnion ¶
type BetaThinkingConfigParamUnion struct {
OfEnabled *BetaThinkingConfigEnabledParam `json:",omitzero,inline"`
OfDisabled *BetaThinkingConfigDisabledParam `json:",omitzero,inline"`
OfAdaptive *BetaThinkingConfigAdaptiveParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaThinkingConfigParamOfEnabled ¶
func BetaThinkingConfigParamOfEnabled(budgetTokens int64) BetaThinkingConfigParamUnion
func (BetaThinkingConfigParamUnion) GetBudgetTokens ¶
func (u BetaThinkingConfigParamUnion) GetBudgetTokens() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaThinkingConfigParamUnion) GetDisplay ¶ added in v1.27.0
func (u BetaThinkingConfigParamUnion) GetDisplay() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThinkingConfigParamUnion) GetType ¶
func (u BetaThinkingConfigParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThinkingConfigParamUnion) MarshalJSON ¶
func (u BetaThinkingConfigParamUnion) MarshalJSON() ([]byte, error)
func (*BetaThinkingConfigParamUnion) UnmarshalJSON ¶
func (u *BetaThinkingConfigParamUnion) UnmarshalJSON(data []byte) error
type BetaThinkingDelta ¶
type BetaThinkingDelta struct {
Thinking string `json:"thinking" api:"required"`
Type constant.ThinkingDelta `json:"type" default:"thinking_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Thinking respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaThinkingDelta) RawJSON ¶
func (r BetaThinkingDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaThinkingDelta) UnmarshalJSON ¶
func (r *BetaThinkingDelta) UnmarshalJSON(data []byte) error
type BetaThinkingTurnsParam ¶ added in v1.16.0
type BetaThinkingTurnsParam struct {
Value int64 `json:"value" api:"required"`
// This field can be elided, and will marshal its zero value as "thinking_turns".
Type constant.ThinkingTurns `json:"type" default:"thinking_turns"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (BetaThinkingTurnsParam) MarshalJSON ¶ added in v1.16.0
func (r BetaThinkingTurnsParam) MarshalJSON() (data []byte, err error)
func (*BetaThinkingTurnsParam) UnmarshalJSON ¶ added in v1.16.0
func (r *BetaThinkingTurnsParam) UnmarshalJSON(data []byte) error
type BetaThinkingTypes ¶ added in v1.27.1
type BetaThinkingTypes struct {
// Whether the model supports thinking with type 'adaptive' (auto).
Adaptive BetaCapabilitySupport `json:"adaptive" api:"required"`
// Whether the model supports thinking with type 'enabled'.
Enabled BetaCapabilitySupport `json:"enabled" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Adaptive respjson.Field
Enabled respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Supported thinking type configurations.
func (BetaThinkingTypes) RawJSON ¶ added in v1.27.1
func (r BetaThinkingTypes) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaThinkingTypes) UnmarshalJSON ¶ added in v1.27.1
func (r *BetaThinkingTypes) UnmarshalJSON(data []byte) error
type BetaTokenTaskBudgetParam ¶ added in v1.37.0
type BetaTokenTaskBudgetParam struct {
// Total token budget across all contexts in the session.
Total int64 `json:"total" api:"required"`
// Remaining tokens in the budget. Use this to track usage across contexts when
// implementing compaction client-side. Defaults to total if not provided.
Remaining param.Opt[int64] `json:"remaining,omitzero"`
// The budget type. Currently only 'tokens' is supported.
//
// This field can be elided, and will marshal its zero value as "tokens".
Type constant.Tokens `json:"type" default:"tokens"`
// contains filtered or unexported fields
}
User-configurable total token budget across contexts.
The properties Total, Type are required.
func (BetaTokenTaskBudgetParam) MarshalJSON ¶ added in v1.37.0
func (r BetaTokenTaskBudgetParam) MarshalJSON() (data []byte, err error)
func (*BetaTokenTaskBudgetParam) UnmarshalJSON ¶ added in v1.37.0
func (r *BetaTokenTaskBudgetParam) UnmarshalJSON(data []byte) error
type BetaTool ¶ added in v1.26.0
type BetaTool interface {
// Name returns the tool's name
Name() string
// Description returns the tool's description
Description() string
// InputSchema returns the JSON schema for the tool's input
InputSchema() BetaToolInputSchemaParam
// Execute runs the tool with raw JSON input and returns one or more result blocks.
Execute(ctx context.Context, input json.RawMessage) ([]BetaToolResultBlockParamContentUnion, error)
}
BetaTool represents a tool that can be executed by the BetaToolRunner.
type BetaToolBash20241022Param ¶
type BetaToolBash20241022Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "bash".
Name constant.Bash `json:"name" default:"bash"`
// This field can be elided, and will marshal its zero value as "bash_20241022".
Type constant.Bash20241022 `json:"type" default:"bash_20241022"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolBash20241022Param) MarshalJSON ¶
func (r BetaToolBash20241022Param) MarshalJSON() (data []byte, err error)
func (*BetaToolBash20241022Param) UnmarshalJSON ¶
func (r *BetaToolBash20241022Param) UnmarshalJSON(data []byte) error
type BetaToolBash20250124Param ¶
type BetaToolBash20250124Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "bash".
Name constant.Bash `json:"name" default:"bash"`
// This field can be elided, and will marshal its zero value as "bash_20250124".
Type constant.Bash20250124 `json:"type" default:"bash_20250124"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolBash20250124Param) MarshalJSON ¶
func (r BetaToolBash20250124Param) MarshalJSON() (data []byte, err error)
func (*BetaToolBash20250124Param) UnmarshalJSON ¶
func (r *BetaToolBash20250124Param) UnmarshalJSON(data []byte) error
type BetaToolChoiceAnyParam ¶
type BetaToolChoiceAnyParam struct {
// Whether to disable parallel tool use.
//
// Defaults to `false`. If set to `true`, the model will output exactly one tool
// use.
DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
// This field can be elided, and will marshal its zero value as "any".
Type constant.Any `json:"type" default:"any"`
// contains filtered or unexported fields
}
The model will use any available tools.
The property Type is required.
func (BetaToolChoiceAnyParam) MarshalJSON ¶
func (r BetaToolChoiceAnyParam) MarshalJSON() (data []byte, err error)
func (*BetaToolChoiceAnyParam) UnmarshalJSON ¶
func (r *BetaToolChoiceAnyParam) UnmarshalJSON(data []byte) error
type BetaToolChoiceAutoParam ¶
type BetaToolChoiceAutoParam struct {
// Whether to disable parallel tool use.
//
// Defaults to `false`. If set to `true`, the model will output at most one tool
// use.
DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
// This field can be elided, and will marshal its zero value as "auto".
Type constant.Auto `json:"type" default:"auto"`
// contains filtered or unexported fields
}
The model will automatically decide whether to use tools.
The property Type is required.
func (BetaToolChoiceAutoParam) MarshalJSON ¶
func (r BetaToolChoiceAutoParam) MarshalJSON() (data []byte, err error)
func (*BetaToolChoiceAutoParam) UnmarshalJSON ¶
func (r *BetaToolChoiceAutoParam) UnmarshalJSON(data []byte) error
type BetaToolChoiceNoneParam ¶
type BetaToolChoiceNoneParam struct {
Type constant.None `json:"type" default:"none"`
// contains filtered or unexported fields
}
The model will not be allowed to use tools.
This struct has a constant value, construct it with NewBetaToolChoiceNoneParam.
func NewBetaToolChoiceNoneParam ¶
func NewBetaToolChoiceNoneParam() BetaToolChoiceNoneParam
func (BetaToolChoiceNoneParam) MarshalJSON ¶
func (r BetaToolChoiceNoneParam) MarshalJSON() (data []byte, err error)
func (*BetaToolChoiceNoneParam) UnmarshalJSON ¶
func (r *BetaToolChoiceNoneParam) UnmarshalJSON(data []byte) error
type BetaToolChoiceToolParam ¶
type BetaToolChoiceToolParam struct {
// The name of the tool to use.
Name string `json:"name" api:"required"`
// Whether to disable parallel tool use.
//
// Defaults to `false`. If set to `true`, the model will output exactly one tool
// use.
DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
// This field can be elided, and will marshal its zero value as "tool".
Type constant.Tool `json:"type" default:"tool"`
// contains filtered or unexported fields
}
The model will use the specified tool with `tool_choice.name`.
The properties Name, Type are required.
func (BetaToolChoiceToolParam) MarshalJSON ¶
func (r BetaToolChoiceToolParam) MarshalJSON() (data []byte, err error)
func (*BetaToolChoiceToolParam) UnmarshalJSON ¶
func (r *BetaToolChoiceToolParam) UnmarshalJSON(data []byte) error
type BetaToolChoiceUnionParam ¶
type BetaToolChoiceUnionParam struct {
OfAuto *BetaToolChoiceAutoParam `json:",omitzero,inline"`
OfAny *BetaToolChoiceAnyParam `json:",omitzero,inline"`
OfTool *BetaToolChoiceToolParam `json:",omitzero,inline"`
OfNone *BetaToolChoiceNoneParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaToolChoiceParamOfTool ¶
func BetaToolChoiceParamOfTool(name string) BetaToolChoiceUnionParam
func (BetaToolChoiceUnionParam) GetDisableParallelToolUse ¶
func (u BetaToolChoiceUnionParam) GetDisableParallelToolUse() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaToolChoiceUnionParam) GetName ¶
func (u BetaToolChoiceUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolChoiceUnionParam) GetType ¶
func (u BetaToolChoiceUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolChoiceUnionParam) MarshalJSON ¶
func (u BetaToolChoiceUnionParam) MarshalJSON() ([]byte, error)
func (*BetaToolChoiceUnionParam) UnmarshalJSON ¶
func (u *BetaToolChoiceUnionParam) UnmarshalJSON(data []byte) error
type BetaToolComputerUse20241022Param ¶
type BetaToolComputerUse20241022Param struct {
// The height of the display in pixels.
DisplayHeightPx int64 `json:"display_height_px" api:"required"`
// The width of the display in pixels.
DisplayWidthPx int64 `json:"display_width_px" api:"required"`
// The X11 display number (e.g. 0, 1) for the display.
DisplayNumber param.Opt[int64] `json:"display_number,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "computer".
Name constant.Computer `json:"name" default:"computer"`
// This field can be elided, and will marshal its zero value as
// "computer_20241022".
Type constant.Computer20241022 `json:"type" default:"computer_20241022"`
// contains filtered or unexported fields
}
The properties DisplayHeightPx, DisplayWidthPx, Name, Type are required.
func (BetaToolComputerUse20241022Param) MarshalJSON ¶
func (r BetaToolComputerUse20241022Param) MarshalJSON() (data []byte, err error)
func (*BetaToolComputerUse20241022Param) UnmarshalJSON ¶
func (r *BetaToolComputerUse20241022Param) UnmarshalJSON(data []byte) error
type BetaToolComputerUse20250124Param ¶
type BetaToolComputerUse20250124Param struct {
// The height of the display in pixels.
DisplayHeightPx int64 `json:"display_height_px" api:"required"`
// The width of the display in pixels.
DisplayWidthPx int64 `json:"display_width_px" api:"required"`
// The X11 display number (e.g. 0, 1) for the display.
DisplayNumber param.Opt[int64] `json:"display_number,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "computer".
Name constant.Computer `json:"name" default:"computer"`
// This field can be elided, and will marshal its zero value as
// "computer_20250124".
Type constant.Computer20250124 `json:"type" default:"computer_20250124"`
// contains filtered or unexported fields
}
The properties DisplayHeightPx, DisplayWidthPx, Name, Type are required.
func (BetaToolComputerUse20250124Param) MarshalJSON ¶
func (r BetaToolComputerUse20250124Param) MarshalJSON() (data []byte, err error)
func (*BetaToolComputerUse20250124Param) UnmarshalJSON ¶
func (r *BetaToolComputerUse20250124Param) UnmarshalJSON(data []byte) error
type BetaToolComputerUse20251124Param ¶ added in v1.19.0
type BetaToolComputerUse20251124Param struct {
// The height of the display in pixels.
DisplayHeightPx int64 `json:"display_height_px" api:"required"`
// The width of the display in pixels.
DisplayWidthPx int64 `json:"display_width_px" api:"required"`
// The X11 display number (e.g. 0, 1) for the display.
DisplayNumber param.Opt[int64] `json:"display_number,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// Whether to enable an action to take a zoomed-in screenshot of the screen.
EnableZoom param.Opt[bool] `json:"enable_zoom,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "computer".
Name constant.Computer `json:"name" default:"computer"`
// This field can be elided, and will marshal its zero value as
// "computer_20251124".
Type constant.Computer20251124 `json:"type" default:"computer_20251124"`
// contains filtered or unexported fields
}
The properties DisplayHeightPx, DisplayWidthPx, Name, Type are required.
func (BetaToolComputerUse20251124Param) MarshalJSON ¶ added in v1.19.0
func (r BetaToolComputerUse20251124Param) MarshalJSON() (data []byte, err error)
func (*BetaToolComputerUse20251124Param) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolComputerUse20251124Param) UnmarshalJSON(data []byte) error
type BetaToolInputSchemaParam ¶
type BetaToolInputSchemaParam struct {
Properties any `json:"properties,omitzero"`
Required []string `json:"required,omitzero"`
// This field can be elided, and will marshal its zero value as "object".
Type constant.Object `json:"type" default:"object"`
ExtraFields map[string]any `json:"-"`
// contains filtered or unexported fields
}
[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
This defines the shape of the `input` that your tool accepts and that the model will produce.
The property Type is required.
func BetaToolInputSchema ¶ added in v1.18.0
func BetaToolInputSchema(jsonSchema map[string]any) BetaToolInputSchemaParam
BetaToolInputSchema creates a BetaToolInputSchemaParam from a JSON schema map. It transforms the schema to ensure compatibility with Anthropic's tool calling requirements.
func (BetaToolInputSchemaParam) MarshalJSON ¶
func (r BetaToolInputSchemaParam) MarshalJSON() (data []byte, err error)
func (*BetaToolInputSchemaParam) UnmarshalJSON ¶
func (r *BetaToolInputSchemaParam) UnmarshalJSON(data []byte) error
type BetaToolParam ¶
type BetaToolParam struct {
// [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
//
// This defines the shape of the `input` that your tool accepts and that the model
// will produce.
InputSchema BetaToolInputSchemaParam `json:"input_schema,omitzero" api:"required"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
Name string `json:"name" api:"required"`
// Enable eager input streaming for this tool. When true, tool input parameters
// will be streamed incrementally as they are generated, and types will be inferred
// on-the-fly rather than buffering the full JSON output. When false, streaming is
// disabled for this tool even if the fine-grained-tool-streaming beta is active.
// When null (default), uses the default behavior based on beta headers.
EagerInputStreaming param.Opt[bool] `json:"eager_input_streaming,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// Description of what this tool does.
//
// Tool descriptions should be as detailed as possible. The more information that
// the model has about what the tool is and how to use it, the better it will
// perform. You can use natural language descriptions to reinforce important
// aspects of the tool input JSON schema.
Description param.Opt[string] `json:"description,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "custom".
Type BetaToolType `json:"type,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// contains filtered or unexported fields
}
The properties InputSchema, Name are required.
func (BetaToolParam) MarshalJSON ¶
func (r BetaToolParam) MarshalJSON() (data []byte, err error)
func (*BetaToolParam) UnmarshalJSON ¶
func (r *BetaToolParam) UnmarshalJSON(data []byte) error
type BetaToolReferenceBlock ¶ added in v1.19.0
type BetaToolReferenceBlock struct {
ToolName string `json:"tool_name" api:"required"`
Type constant.ToolReference `json:"type" default:"tool_reference"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolName respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaToolReferenceBlock) RawJSON ¶ added in v1.19.0
func (r BetaToolReferenceBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaToolReferenceBlock) ToParam ¶ added in v1.20.0
func (r BetaToolReferenceBlock) ToParam() BetaToolReferenceBlockParam
func (*BetaToolReferenceBlock) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolReferenceBlock) UnmarshalJSON(data []byte) error
type BetaToolReferenceBlockParam ¶ added in v1.19.0
type BetaToolReferenceBlockParam struct {
ToolName string `json:"tool_name" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "tool_reference".
Type constant.ToolReference `json:"type" default:"tool_reference"`
// contains filtered or unexported fields
}
Tool reference block that can be included in tool_result content.
The properties ToolName, Type are required.
func (BetaToolReferenceBlockParam) MarshalJSON ¶ added in v1.19.0
func (r BetaToolReferenceBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaToolReferenceBlockParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolReferenceBlockParam) UnmarshalJSON(data []byte) error
type BetaToolResultBlockParam ¶
type BetaToolResultBlockParam struct {
ToolUseID string `json:"tool_use_id" api:"required"`
IsError param.Opt[bool] `json:"is_error,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
Content []BetaToolResultBlockParamContentUnion `json:"content,omitzero"`
// This field can be elided, and will marshal its zero value as "tool_result".
Type constant.ToolResult `json:"type" default:"tool_result"`
// contains filtered or unexported fields
}
The properties ToolUseID, Type are required.
func NewBetaToolResultTextBlockParam ¶ added in v1.26.0
func NewBetaToolResultTextBlockParam(toolUseID string, text string, isError bool) BetaToolResultBlockParam
func (BetaToolResultBlockParam) MarshalJSON ¶
func (r BetaToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaToolResultBlockParam) UnmarshalJSON ¶
func (r *BetaToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaToolResultBlockParamContentUnion ¶
type BetaToolResultBlockParamContentUnion struct {
OfText *BetaTextBlockParam `json:",omitzero,inline"`
OfImage *BetaImageBlockParam `json:",omitzero,inline"`
OfSearchResult *BetaSearchResultBlockParam `json:",omitzero,inline"`
OfDocument *BetaRequestDocumentBlockParam `json:",omitzero,inline"`
OfToolReference *BetaToolReferenceBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaToolResultBlockParamContentUnion) GetCacheControl ¶
func (u BetaToolResultBlockParamContentUnion) GetCacheControl() *BetaCacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (BetaToolResultBlockParamContentUnion) GetCitations ¶
func (u BetaToolResultBlockParamContentUnion) GetCitations() (res betaToolResultBlockParamContentUnionCitations)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaToolResultBlockParamContentUnion) GetContent ¶ added in v1.5.0
func (u BetaToolResultBlockParamContentUnion) GetContent() []BetaTextBlockParam
Returns a pointer to the underlying variant's property, if present.
func (BetaToolResultBlockParamContentUnion) GetContext ¶ added in v1.11.0
func (u BetaToolResultBlockParamContentUnion) GetContext() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolResultBlockParamContentUnion) GetSource ¶
func (u BetaToolResultBlockParamContentUnion) GetSource() (res betaToolResultBlockParamContentUnionSource)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (BetaToolResultBlockParamContentUnion) GetText ¶
func (u BetaToolResultBlockParamContentUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolResultBlockParamContentUnion) GetTitle ¶ added in v1.5.0
func (u BetaToolResultBlockParamContentUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolResultBlockParamContentUnion) GetToolName ¶ added in v1.19.0
func (u BetaToolResultBlockParamContentUnion) GetToolName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolResultBlockParamContentUnion) GetType ¶
func (u BetaToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolResultBlockParamContentUnion) MarshalJSON ¶
func (u BetaToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaToolResultBlockParamContentUnion) UnmarshalJSON ¶
func (u *BetaToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaToolRunner ¶ added in v1.26.0
type BetaToolRunner struct {
// contains filtered or unexported fields
}
BetaToolRunner manages the automatic conversation loop between the assistant and tools using non-streaming API calls. It implements an iterator pattern for processing conversation turns.
A BetaToolRunner is NOT safe for concurrent use. All methods must be called from a single goroutine. However, tool handlers ARE called concurrently when multiple tools are invoked in a single turn - ensure your handlers are thread-safe.
func (*BetaToolRunner) All ¶ added in v1.26.0
func (r *BetaToolRunner) All(ctx context.Context) iter.Seq2[*BetaMessage, error]
All returns an iterator that yields all messages until the conversation completes. This is a convenience method for iterating over the entire conversation.
Example usage:
for message, err := range runner.All(ctx) {
if err != nil {
return err
}
// process message
}
func (*BetaToolRunner) AppendMessages ¶ added in v1.26.0
func (b *BetaToolRunner) AppendMessages(messages ...BetaMessageParam)
AppendMessages adds messages to the conversation history. This is a convenience method equivalent to:
runner.Params.Messages = append(runner.Params.Messages, messages...)
func (*BetaToolRunner) Err ¶ added in v1.26.0
func (b *BetaToolRunner) Err() error
Err returns the last error that occurred during iteration, if any. This is useful when using All() or AllStreaming() to check for errors after the iteration completes.
func (*BetaToolRunner) IsCompleted ¶ added in v1.26.0
func (b *BetaToolRunner) IsCompleted() bool
IsCompleted returns true if the conversation has finished, either because the model stopped using tools or the maximum iteration limit was reached.
func (*BetaToolRunner) IterationCount ¶ added in v1.26.0
func (b *BetaToolRunner) IterationCount() int
IterationCount returns the number of API calls made so far. This is incremented each time a turn makes an API call.
func (*BetaToolRunner) LastMessage ¶ added in v1.26.0
func (b *BetaToolRunner) LastMessage() *BetaMessage
LastMessage returns the most recent assistant message, or nil if no messages have been received yet.
func (*BetaToolRunner) Messages ¶ added in v1.26.0
func (b *BetaToolRunner) Messages() []BetaMessageParam
Messages returns a copy of the current conversation history. The returned slice can be safely modified without affecting the runner's state.
func (*BetaToolRunner) NextMessage ¶ added in v1.26.0
func (r *BetaToolRunner) NextMessage(ctx context.Context) (*BetaMessage, error)
NextMessage advances the conversation by one turn. It executes any pending tool calls from the previous message, then makes an API call to get the model's next response.
Returns:
- (message, nil) on success with the assistant's response
- (nil, nil) when the conversation is complete (no more tool calls or max iterations reached)
- (nil, error) if an error occurred during tool execution or API call
func (*BetaToolRunner) RunToCompletion ¶ added in v1.26.0
func (r *BetaToolRunner) RunToCompletion(ctx context.Context) (*BetaMessage, error)
RunToCompletion repeatedly calls NextMessage until the conversation is complete, either because the model stopped using tools or the maximum iteration limit was reached.
Returns the final assistant message and any error that occurred.
type BetaToolRunnerParams ¶ added in v1.26.0
type BetaToolRunnerParams struct {
BetaMessageNewParams
// MaxIterations limits the number of API calls. When set to 0 (the default),
// there is no limit and the runner continues until the model stops using tools.
MaxIterations int
}
BetaToolRunnerParams contains parameters for creating a BetaToolRunner or BetaToolRunnerStreaming.
type BetaToolRunnerStreaming ¶ added in v1.26.0
type BetaToolRunnerStreaming struct {
// contains filtered or unexported fields
}
BetaToolRunnerStreaming manages the automatic conversation loop between the assistant and tools using streaming API calls. It implements an iterator pattern for processing streaming events across conversation turns.
A BetaToolRunnerStreaming is NOT safe for concurrent use. All methods must be called from a single goroutine. However, tool handlers ARE called concurrently when multiple tools are invoked in a single turn - ensure your handlers are thread-safe.
func (*BetaToolRunnerStreaming) AllStreaming ¶ added in v1.26.0
func (r *BetaToolRunnerStreaming) AllStreaming(ctx context.Context) iter.Seq2[iter.Seq2[BetaRawMessageStreamEventUnion, error], error]
AllStreaming returns an iterator of iterators, where each inner iterator yields streaming events for a single turn of the conversation. The outer iterator continues until the conversation completes.
Example usage:
for events, err := range runner.AllStreaming(ctx) {
if err != nil {
return err
}
for event, err := range events {
if err != nil {
return err
}
// process streaming event
}
}
func (*BetaToolRunnerStreaming) AppendMessages ¶ added in v1.26.0
func (b *BetaToolRunnerStreaming) AppendMessages(messages ...BetaMessageParam)
AppendMessages adds messages to the conversation history. This is a convenience method equivalent to:
runner.Params.Messages = append(runner.Params.Messages, messages...)
func (*BetaToolRunnerStreaming) Err ¶ added in v1.26.0
func (b *BetaToolRunnerStreaming) Err() error
Err returns the last error that occurred during iteration, if any. This is useful when using All() or AllStreaming() to check for errors after the iteration completes.
func (*BetaToolRunnerStreaming) IsCompleted ¶ added in v1.26.0
func (b *BetaToolRunnerStreaming) IsCompleted() bool
IsCompleted returns true if the conversation has finished, either because the model stopped using tools or the maximum iteration limit was reached.
func (*BetaToolRunnerStreaming) IterationCount ¶ added in v1.26.0
func (b *BetaToolRunnerStreaming) IterationCount() int
IterationCount returns the number of API calls made so far. This is incremented each time a turn makes an API call.
func (*BetaToolRunnerStreaming) LastMessage ¶ added in v1.26.0
func (b *BetaToolRunnerStreaming) LastMessage() *BetaMessage
LastMessage returns the most recent assistant message, or nil if no messages have been received yet.
func (*BetaToolRunnerStreaming) Messages ¶ added in v1.26.0
func (b *BetaToolRunnerStreaming) Messages() []BetaMessageParam
Messages returns a copy of the current conversation history. The returned slice can be safely modified without affecting the runner's state.
func (*BetaToolRunnerStreaming) NextStreaming ¶ added in v1.26.0
func (r *BetaToolRunnerStreaming) NextStreaming(ctx context.Context) iter.Seq2[BetaRawMessageStreamEventUnion, error]
NextStreaming advances the conversation by one turn with streaming. It executes any pending tool calls from the previous message, then makes a streaming API call.
Returns an iterator that yields streaming events as they arrive. The iterator should be fully consumed to ensure the message is properly accumulated for subsequent turns.
If an error occurs, it will be yielded as the second value in the iterator pair. Check IsCompleted() after consuming the iterator to determine if the conversation has finished.
type BetaToolSearchToolBm25_20251119Param ¶ added in v1.19.0
type BetaToolSearchToolBm25_20251119Param struct {
// Any of "tool_search_tool_bm25_20251119", "tool_search_tool_bm25".
Type BetaToolSearchToolBm25_20251119Type `json:"type,omitzero" api:"required"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_bm25".
Name constant.ToolSearchToolBm25 `json:"name" default:"tool_search_tool_bm25"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolSearchToolBm25_20251119Param) MarshalJSON ¶ added in v1.19.0
func (r BetaToolSearchToolBm25_20251119Param) MarshalJSON() (data []byte, err error)
func (*BetaToolSearchToolBm25_20251119Param) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolBm25_20251119Param) UnmarshalJSON(data []byte) error
type BetaToolSearchToolBm25_20251119Type ¶ added in v1.19.0
type BetaToolSearchToolBm25_20251119Type string
const ( BetaToolSearchToolBm25_20251119TypeToolSearchToolBm25_20251119 BetaToolSearchToolBm25_20251119Type = "tool_search_tool_bm25_20251119" BetaToolSearchToolBm25_20251119TypeToolSearchToolBm25 BetaToolSearchToolBm25_20251119Type = "tool_search_tool_bm25" )
type BetaToolSearchToolRegex20251119Param ¶ added in v1.19.0
type BetaToolSearchToolRegex20251119Param struct {
// Any of "tool_search_tool_regex_20251119", "tool_search_tool_regex".
Type BetaToolSearchToolRegex20251119Type `json:"type,omitzero" api:"required"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_regex".
Name constant.ToolSearchToolRegex `json:"name" default:"tool_search_tool_regex"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolSearchToolRegex20251119Param) MarshalJSON ¶ added in v1.19.0
func (r BetaToolSearchToolRegex20251119Param) MarshalJSON() (data []byte, err error)
func (*BetaToolSearchToolRegex20251119Param) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolRegex20251119Param) UnmarshalJSON(data []byte) error
type BetaToolSearchToolRegex20251119Type ¶ added in v1.19.0
type BetaToolSearchToolRegex20251119Type string
const ( BetaToolSearchToolRegex20251119TypeToolSearchToolRegex20251119 BetaToolSearchToolRegex20251119Type = "tool_search_tool_regex_20251119" BetaToolSearchToolRegex20251119TypeToolSearchToolRegex BetaToolSearchToolRegex20251119Type = "tool_search_tool_regex" )
type BetaToolSearchToolResultBlock ¶ added in v1.19.0
type BetaToolSearchToolResultBlock struct {
Content BetaToolSearchToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.ToolSearchToolResult `json:"type" default:"tool_search_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaToolSearchToolResultBlock) RawJSON ¶ added in v1.19.0
func (r BetaToolSearchToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaToolSearchToolResultBlock) ToParam ¶ added in v1.20.0
func (r BetaToolSearchToolResultBlock) ToParam() BetaToolSearchToolResultBlockParam
func (*BetaToolSearchToolResultBlock) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolResultBlock) UnmarshalJSON(data []byte) error
type BetaToolSearchToolResultBlockContentUnion ¶ added in v1.19.0
type BetaToolSearchToolResultBlockContentUnion struct {
// This field is from variant [BetaToolSearchToolResultError].
ErrorCode BetaToolSearchToolResultErrorErrorCode `json:"error_code"`
// This field is from variant [BetaToolSearchToolResultError].
ErrorMessage string `json:"error_message"`
Type string `json:"type"`
// This field is from variant [BetaToolSearchToolSearchResultBlock].
ToolReferences []BetaToolReferenceBlock `json:"tool_references"`
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
ToolReferences respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaToolSearchToolResultBlockContentUnion contains all possible properties and values from BetaToolSearchToolResultError, BetaToolSearchToolSearchResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError() (v BetaToolSearchToolResultError)
func (BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock() (v BetaToolSearchToolSearchResultBlock)
func (BetaToolSearchToolResultBlockContentUnion) RawJSON ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaToolSearchToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaToolSearchToolResultBlockParam ¶ added in v1.19.0
type BetaToolSearchToolResultBlockParam struct {
Content BetaToolSearchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_result".
Type constant.ToolSearchToolResult `json:"type" default:"tool_search_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaToolSearchToolResultBlockParam) MarshalJSON ¶ added in v1.19.0
func (r BetaToolSearchToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaToolSearchToolResultBlockParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaToolSearchToolResultBlockParamContentUnion ¶ added in v1.19.0
type BetaToolSearchToolResultBlockParamContentUnion struct {
OfRequestToolSearchToolResultError *BetaToolSearchToolResultErrorParam `json:",omitzero,inline"`
OfRequestToolSearchToolSearchResultBlock *BetaToolSearchToolSearchResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaToolSearchToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolSearchToolResultBlockParamContentUnion) GetToolReferences ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockParamContentUnion) GetToolReferences() []BetaToolReferenceBlockParam
Returns a pointer to the underlying variant's property, if present.
func (BetaToolSearchToolResultBlockParamContentUnion) GetType ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolSearchToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.19.0
func (u BetaToolSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaToolSearchToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.19.0
func (u *BetaToolSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaToolSearchToolResultError ¶ added in v1.19.0
type BetaToolSearchToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode BetaToolSearchToolResultErrorErrorCode `json:"error_code" api:"required"`
ErrorMessage string `json:"error_message" api:"required"`
Type constant.ToolSearchToolResultError `json:"type" default:"tool_search_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaToolSearchToolResultError) RawJSON ¶ added in v1.19.0
func (r BetaToolSearchToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaToolSearchToolResultError) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolResultError) UnmarshalJSON(data []byte) error
type BetaToolSearchToolResultErrorErrorCode ¶ added in v1.19.0
type BetaToolSearchToolResultErrorErrorCode string
const ( BetaToolSearchToolResultErrorErrorCodeInvalidToolInput BetaToolSearchToolResultErrorErrorCode = "invalid_tool_input" BetaToolSearchToolResultErrorErrorCodeTooManyRequests BetaToolSearchToolResultErrorErrorCode = "too_many_requests" BetaToolSearchToolResultErrorErrorCodeExecutionTimeExceeded BetaToolSearchToolResultErrorErrorCode = "execution_time_exceeded" )
type BetaToolSearchToolResultErrorParam ¶ added in v1.19.0
type BetaToolSearchToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode BetaToolSearchToolResultErrorParamErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_result_error".
Type constant.ToolSearchToolResultError `json:"type" default:"tool_search_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaToolSearchToolResultErrorParam) MarshalJSON ¶ added in v1.19.0
func (r BetaToolSearchToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*BetaToolSearchToolResultErrorParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolResultErrorParam) UnmarshalJSON(data []byte) error
type BetaToolSearchToolResultErrorParamErrorCode ¶ added in v1.19.0
type BetaToolSearchToolResultErrorParamErrorCode string
const ( BetaToolSearchToolResultErrorParamErrorCodeInvalidToolInput BetaToolSearchToolResultErrorParamErrorCode = "invalid_tool_input" BetaToolSearchToolResultErrorParamErrorCodeTooManyRequests BetaToolSearchToolResultErrorParamErrorCode = "too_many_requests" BetaToolSearchToolResultErrorParamErrorCodeExecutionTimeExceeded BetaToolSearchToolResultErrorParamErrorCode = "execution_time_exceeded" )
type BetaToolSearchToolSearchResultBlock ¶ added in v1.19.0
type BetaToolSearchToolSearchResultBlock struct {
ToolReferences []BetaToolReferenceBlock `json:"tool_references" api:"required"`
Type constant.ToolSearchToolSearchResult `json:"type" default:"tool_search_tool_search_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolReferences respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaToolSearchToolSearchResultBlock) RawJSON ¶ added in v1.19.0
func (r BetaToolSearchToolSearchResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaToolSearchToolSearchResultBlock) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolSearchResultBlock) UnmarshalJSON(data []byte) error
type BetaToolSearchToolSearchResultBlockParam ¶ added in v1.19.0
type BetaToolSearchToolSearchResultBlockParam struct {
ToolReferences []BetaToolReferenceBlockParam `json:"tool_references,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_search_result".
Type constant.ToolSearchToolSearchResult `json:"type" default:"tool_search_tool_search_result"`
// contains filtered or unexported fields
}
The properties ToolReferences, Type are required.
func (BetaToolSearchToolSearchResultBlockParam) MarshalJSON ¶ added in v1.19.0
func (r BetaToolSearchToolSearchResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaToolSearchToolSearchResultBlockParam) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolSearchToolSearchResultBlockParam) UnmarshalJSON(data []byte) error
type BetaToolTextEditor20241022Param ¶
type BetaToolTextEditor20241022Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_editor".
Name constant.StrReplaceEditor `json:"name" default:"str_replace_editor"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20241022".
Type constant.TextEditor20241022 `json:"type" default:"text_editor_20241022"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolTextEditor20241022Param) MarshalJSON ¶
func (r BetaToolTextEditor20241022Param) MarshalJSON() (data []byte, err error)
func (*BetaToolTextEditor20241022Param) UnmarshalJSON ¶
func (r *BetaToolTextEditor20241022Param) UnmarshalJSON(data []byte) error
type BetaToolTextEditor20250124Param ¶
type BetaToolTextEditor20250124Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_editor".
Name constant.StrReplaceEditor `json:"name" default:"str_replace_editor"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20250124".
Type constant.TextEditor20250124 `json:"type" default:"text_editor_20250124"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolTextEditor20250124Param) MarshalJSON ¶
func (r BetaToolTextEditor20250124Param) MarshalJSON() (data []byte, err error)
func (*BetaToolTextEditor20250124Param) UnmarshalJSON ¶
func (r *BetaToolTextEditor20250124Param) UnmarshalJSON(data []byte) error
type BetaToolTextEditor20250429Param ¶ added in v1.2.0
type BetaToolTextEditor20250429Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_based_edit_tool".
Name constant.StrReplaceBasedEditTool `json:"name" default:"str_replace_based_edit_tool"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20250429".
Type constant.TextEditor20250429 `json:"type" default:"text_editor_20250429"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolTextEditor20250429Param) MarshalJSON ¶ added in v1.2.0
func (r BetaToolTextEditor20250429Param) MarshalJSON() (data []byte, err error)
func (*BetaToolTextEditor20250429Param) UnmarshalJSON ¶ added in v1.2.0
func (r *BetaToolTextEditor20250429Param) UnmarshalJSON(data []byte) error
type BetaToolTextEditor20250728Param ¶ added in v1.7.0
type BetaToolTextEditor20250728Param struct {
// Maximum number of characters to display when viewing a file. If not specified,
// defaults to displaying the full file.
MaxCharacters param.Opt[int64] `json:"max_characters,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_based_edit_tool".
Name constant.StrReplaceBasedEditTool `json:"name" default:"str_replace_based_edit_tool"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20250728".
Type constant.TextEditor20250728 `json:"type" default:"text_editor_20250728"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaToolTextEditor20250728Param) MarshalJSON ¶ added in v1.7.0
func (r BetaToolTextEditor20250728Param) MarshalJSON() (data []byte, err error)
func (*BetaToolTextEditor20250728Param) UnmarshalJSON ¶ added in v1.7.0
func (r *BetaToolTextEditor20250728Param) UnmarshalJSON(data []byte) error
type BetaToolUnionParam ¶
type BetaToolUnionParam struct {
OfTool *BetaToolParam `json:",omitzero,inline"`
OfBashTool20241022 *BetaToolBash20241022Param `json:",omitzero,inline"`
OfBashTool20250124 *BetaToolBash20250124Param `json:",omitzero,inline"`
OfCodeExecutionTool20250522 *BetaCodeExecutionTool20250522Param `json:",omitzero,inline"`
OfCodeExecutionTool20250825 *BetaCodeExecutionTool20250825Param `json:",omitzero,inline"`
OfCodeExecutionTool20260120 *BetaCodeExecutionTool20260120Param `json:",omitzero,inline"`
OfComputerUseTool20241022 *BetaToolComputerUse20241022Param `json:",omitzero,inline"`
OfMemoryTool20250818 *BetaMemoryTool20250818Param `json:",omitzero,inline"`
OfComputerUseTool20250124 *BetaToolComputerUse20250124Param `json:",omitzero,inline"`
OfTextEditor20241022 *BetaToolTextEditor20241022Param `json:",omitzero,inline"`
OfComputerUseTool20251124 *BetaToolComputerUse20251124Param `json:",omitzero,inline"`
OfTextEditor20250124 *BetaToolTextEditor20250124Param `json:",omitzero,inline"`
OfTextEditor20250429 *BetaToolTextEditor20250429Param `json:",omitzero,inline"`
OfTextEditor20250728 *BetaToolTextEditor20250728Param `json:",omitzero,inline"`
OfWebSearchTool20250305 *BetaWebSearchTool20250305Param `json:",omitzero,inline"`
OfWebFetchTool20250910 *BetaWebFetchTool20250910Param `json:",omitzero,inline"`
OfWebSearchTool20260209 *BetaWebSearchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260209 *BetaWebFetchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260309 *BetaWebFetchTool20260309Param `json:",omitzero,inline"`
OfAdvisorTool20260301 *BetaAdvisorTool20260301Param `json:",omitzero,inline"`
OfToolSearchToolBm25_20251119 *BetaToolSearchToolBm25_20251119Param `json:",omitzero,inline"`
OfToolSearchToolRegex20251119 *BetaToolSearchToolRegex20251119Param `json:",omitzero,inline"`
OfMCPToolset *BetaMCPToolsetParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaToolUnionParamOfAdvisorTool20260301 ¶ added in v1.34.0
func BetaToolUnionParamOfAdvisorTool20260301(model Model) BetaToolUnionParam
func BetaToolUnionParamOfComputerUseTool20241022 ¶
func BetaToolUnionParamOfComputerUseTool20241022(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam
func BetaToolUnionParamOfComputerUseTool20250124 ¶
func BetaToolUnionParamOfComputerUseTool20250124(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam
func BetaToolUnionParamOfComputerUseTool20251124 ¶ added in v1.19.0
func BetaToolUnionParamOfComputerUseTool20251124(displayHeightPx int64, displayWidthPx int64) BetaToolUnionParam
func BetaToolUnionParamOfMCPToolset ¶ added in v1.19.0
func BetaToolUnionParamOfMCPToolset(mcpServerName string) BetaToolUnionParam
func BetaToolUnionParamOfTool ¶
func BetaToolUnionParamOfTool(inputSchema BetaToolInputSchemaParam, name string) BetaToolUnionParam
func BetaToolUnionParamOfToolSearchToolBm25_20251119 ¶ added in v1.19.0
func BetaToolUnionParamOfToolSearchToolBm25_20251119(type_ BetaToolSearchToolBm25_20251119Type) BetaToolUnionParam
func BetaToolUnionParamOfToolSearchToolRegex20251119 ¶ added in v1.19.0
func BetaToolUnionParamOfToolSearchToolRegex20251119(type_ BetaToolSearchToolRegex20251119Type) BetaToolUnionParam
func (BetaToolUnionParam) GetAllowedCallers ¶ added in v1.19.0
func (u BetaToolUnionParam) GetAllowedCallers() []string
Returns a pointer to the underlying variant's AllowedCallers property, if present.
func (BetaToolUnionParam) GetAllowedDomains ¶
func (u BetaToolUnionParam) GetAllowedDomains() []string
Returns a pointer to the underlying variant's AllowedDomains property, if present.
func (BetaToolUnionParam) GetBlockedDomains ¶
func (u BetaToolUnionParam) GetBlockedDomains() []string
Returns a pointer to the underlying variant's BlockedDomains property, if present.
func (BetaToolUnionParam) GetCacheControl ¶
func (u BetaToolUnionParam) GetCacheControl() *BetaCacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (BetaToolUnionParam) GetCaching ¶ added in v1.34.0
func (u BetaToolUnionParam) GetCaching() *BetaCacheControlEphemeralParam
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetCitations ¶ added in v1.12.0
func (u BetaToolUnionParam) GetCitations() *BetaCitationsConfigParam
Returns a pointer to the underlying variant's Citations property, if present.
func (BetaToolUnionParam) GetConfigs ¶ added in v1.19.0
func (u BetaToolUnionParam) GetConfigs() map[string]BetaMCPToolConfigParam
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetDefaultConfig ¶ added in v1.19.0
func (u BetaToolUnionParam) GetDefaultConfig() *BetaMCPToolDefaultConfigParam
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetDeferLoading ¶ added in v1.19.0
func (u BetaToolUnionParam) GetDeferLoading() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetDescription ¶
func (u BetaToolUnionParam) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetDisplayHeightPx ¶
func (u BetaToolUnionParam) GetDisplayHeightPx() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetDisplayNumber ¶
func (u BetaToolUnionParam) GetDisplayNumber() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetDisplayWidthPx ¶
func (u BetaToolUnionParam) GetDisplayWidthPx() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetEagerInputStreaming ¶ added in v1.21.0
func (u BetaToolUnionParam) GetEagerInputStreaming() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetEnableZoom ¶ added in v1.19.0
func (u BetaToolUnionParam) GetEnableZoom() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetInputExamples ¶ added in v1.19.0
func (u BetaToolUnionParam) GetInputExamples() []map[string]any
Returns a pointer to the underlying variant's InputExamples property, if present.
func (BetaToolUnionParam) GetInputSchema ¶
func (u BetaToolUnionParam) GetInputSchema() *BetaToolInputSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetMCPServerName ¶ added in v1.19.0
func (u BetaToolUnionParam) GetMCPServerName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetMaxCharacters ¶ added in v1.7.0
func (u BetaToolUnionParam) GetMaxCharacters() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetMaxContentTokens ¶ added in v1.12.0
func (u BetaToolUnionParam) GetMaxContentTokens() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetMaxUses ¶
func (u BetaToolUnionParam) GetMaxUses() *int64
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetModel ¶ added in v1.34.0
func (u BetaToolUnionParam) GetModel() *Model
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetName ¶
func (u BetaToolUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetStrict ¶ added in v1.18.0
func (u BetaToolUnionParam) GetStrict() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetType ¶
func (u BetaToolUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetUseCache ¶ added in v1.27.0
func (u BetaToolUnionParam) GetUseCache() *bool
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUnionParam) GetUserLocation ¶
func (u BetaToolUnionParam) GetUserLocation() *BetaUserLocationParam
Returns a pointer to the underlying variant's UserLocation property, if present.
func (BetaToolUnionParam) MarshalJSON ¶
func (u BetaToolUnionParam) MarshalJSON() ([]byte, error)
func (*BetaToolUnionParam) UnmarshalJSON ¶
func (u *BetaToolUnionParam) UnmarshalJSON(data []byte) error
type BetaToolUseBlock ¶
type BetaToolUseBlock struct {
ID string `json:"id" api:"required"`
Input any `json:"input" api:"required"`
Name string `json:"name" api:"required"`
Type constant.ToolUse `json:"type" default:"tool_use"`
// Tool invocation directly from the model.
Caller BetaToolUseBlockCallerUnion `json:"caller"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Input respjson.Field
Name respjson.Field
Type respjson.Field
Caller respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaToolUseBlock) RawJSON ¶
func (r BetaToolUseBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaToolUseBlock) ToParam ¶
func (r BetaToolUseBlock) ToParam() BetaToolUseBlockParam
func (*BetaToolUseBlock) UnmarshalJSON ¶
func (r *BetaToolUseBlock) UnmarshalJSON(data []byte) error
type BetaToolUseBlockCallerUnion ¶ added in v1.19.0
type BetaToolUseBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaToolUseBlockCallerUnion contains all possible properties and values from BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller20260120.
Use the BetaToolUseBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaToolUseBlockCallerUnion) AsAny ¶ added in v1.19.0
func (u BetaToolUseBlockCallerUnion) AsAny() anyBetaToolUseBlockCaller
Use the following switch statement to find the correct variant
switch variant := BetaToolUseBlockCallerUnion.AsAny().(type) {
case anthropic.BetaDirectCaller:
case anthropic.BetaServerToolCaller:
case anthropic.BetaServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (BetaToolUseBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.19.0
func (u BetaToolUseBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
func (BetaToolUseBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u BetaToolUseBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
func (BetaToolUseBlockCallerUnion) AsDirect ¶ added in v1.19.0
func (u BetaToolUseBlockCallerUnion) AsDirect() (v BetaDirectCaller)
func (BetaToolUseBlockCallerUnion) RawJSON ¶ added in v1.19.0
func (u BetaToolUseBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaToolUseBlockCallerUnion) UnmarshalJSON ¶ added in v1.19.0
func (r *BetaToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
type BetaToolUseBlockParam ¶
type BetaToolUseBlockParam struct {
ID string `json:"id" api:"required"`
Input any `json:"input,omitzero" api:"required"`
Name string `json:"name" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller BetaToolUseBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as "tool_use".
Type constant.ToolUse `json:"type" default:"tool_use"`
// contains filtered or unexported fields
}
The properties ID, Input, Name, Type are required.
func (BetaToolUseBlockParam) MarshalJSON ¶
func (r BetaToolUseBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaToolUseBlockParam) UnmarshalJSON ¶
func (r *BetaToolUseBlockParam) UnmarshalJSON(data []byte) error
type BetaToolUseBlockParamCallerUnion ¶ added in v1.19.0
type BetaToolUseBlockParamCallerUnion struct {
OfDirect *BetaDirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *BetaServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaToolUseBlockParamCallerUnion) GetToolID ¶ added in v1.19.0
func (u BetaToolUseBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUseBlockParamCallerUnion) GetType ¶ added in v1.19.0
func (u BetaToolUseBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaToolUseBlockParamCallerUnion) MarshalJSON ¶ added in v1.19.0
func (u BetaToolUseBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*BetaToolUseBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.19.0
func (u *BetaToolUseBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type BetaToolUsesKeepParam ¶ added in v1.13.0
type BetaToolUsesKeepParam struct {
Value int64 `json:"value" api:"required"`
// This field can be elided, and will marshal its zero value as "tool_uses".
Type constant.ToolUses `json:"type" default:"tool_uses"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (BetaToolUsesKeepParam) MarshalJSON ¶ added in v1.13.0
func (r BetaToolUsesKeepParam) MarshalJSON() (data []byte, err error)
func (*BetaToolUsesKeepParam) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaToolUsesKeepParam) UnmarshalJSON(data []byte) error
type BetaToolUsesTriggerParam ¶ added in v1.13.0
type BetaToolUsesTriggerParam struct {
Value int64 `json:"value" api:"required"`
// This field can be elided, and will marshal its zero value as "tool_uses".
Type constant.ToolUses `json:"type" default:"tool_uses"`
// contains filtered or unexported fields
}
The properties Type, Value are required.
func (BetaToolUsesTriggerParam) MarshalJSON ¶ added in v1.13.0
func (r BetaToolUsesTriggerParam) MarshalJSON() (data []byte, err error)
func (*BetaToolUsesTriggerParam) UnmarshalJSON ¶ added in v1.13.0
func (r *BetaToolUsesTriggerParam) UnmarshalJSON(data []byte) error
type BetaURLImageSourceParam ¶
type BetaURLImageSourceParam struct {
URL string `json:"url" api:"required"`
// This field can be elided, and will marshal its zero value as "url".
Type constant.URL `json:"type" default:"url"`
// contains filtered or unexported fields
}
The properties Type, URL are required.
func (BetaURLImageSourceParam) MarshalJSON ¶
func (r BetaURLImageSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaURLImageSourceParam) UnmarshalJSON ¶
func (r *BetaURLImageSourceParam) UnmarshalJSON(data []byte) error
type BetaURLPDFSourceParam ¶
type BetaURLPDFSourceParam struct {
URL string `json:"url" api:"required"`
// This field can be elided, and will marshal its zero value as "url".
Type constant.URL `json:"type" default:"url"`
// contains filtered or unexported fields
}
The properties Type, URL are required.
func (BetaURLPDFSourceParam) MarshalJSON ¶
func (r BetaURLPDFSourceParam) MarshalJSON() (data []byte, err error)
func (*BetaURLPDFSourceParam) UnmarshalJSON ¶
func (r *BetaURLPDFSourceParam) UnmarshalJSON(data []byte) error
type BetaUnrestrictedNetwork ¶ added in v1.33.0
type BetaUnrestrictedNetwork struct {
// Network policy type
Type constant.Unrestricted `json:"type" default:"unrestricted"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Unrestricted network access.
func (BetaUnrestrictedNetwork) RawJSON ¶ added in v1.33.0
func (r BetaUnrestrictedNetwork) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaUnrestrictedNetwork) ToParam ¶ added in v1.33.0
func (r BetaUnrestrictedNetwork) ToParam() BetaUnrestrictedNetworkParam
ToParam converts this BetaUnrestrictedNetwork to a BetaUnrestrictedNetworkParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BetaUnrestrictedNetworkParam.Overrides()
func (*BetaUnrestrictedNetwork) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaUnrestrictedNetwork) UnmarshalJSON(data []byte) error
type BetaUnrestrictedNetworkParam ¶ added in v1.33.0
type BetaUnrestrictedNetworkParam struct {
// Network policy type
Type constant.Unrestricted `json:"type" default:"unrestricted"`
// contains filtered or unexported fields
}
Unrestricted network access.
This struct has a constant value, construct it with NewBetaUnrestrictedNetworkParam.
func NewBetaUnrestrictedNetworkParam ¶ added in v1.33.0
func NewBetaUnrestrictedNetworkParam() BetaUnrestrictedNetworkParam
func (BetaUnrestrictedNetworkParam) MarshalJSON ¶ added in v1.33.0
func (r BetaUnrestrictedNetworkParam) MarshalJSON() (data []byte, err error)
func (*BetaUnrestrictedNetworkParam) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaUnrestrictedNetworkParam) UnmarshalJSON(data []byte) error
type BetaUsage ¶
type BetaUsage struct {
// Breakdown of cached tokens by TTL
CacheCreation BetaCacheCreation `json:"cache_creation" api:"required"`
// The number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The geographic region where inference was performed for this request.
InferenceGeo string `json:"inference_geo" api:"required"`
// The number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// Per-iteration token usage breakdown.
//
// Each entry represents one sampling iteration, with its own input/output token
// counts and cache statistics. This allows you to:
//
// - Determine which iterations exceeded long context thresholds (>=200k tokens)
// - Calculate the true context window size from the last iteration
// - Understand token accumulation across server-side tool use loops
Iterations BetaIterationsUsage `json:"iterations" api:"required"`
// The number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// The number of server tool requests.
ServerToolUse BetaServerToolUsage `json:"server_tool_use" api:"required"`
// If the request used the priority, standard, or batch tier.
//
// Any of "standard", "priority", "batch".
ServiceTier BetaUsageServiceTier `json:"service_tier" api:"required"`
// The inference speed mode used for this request.
//
// Any of "standard", "fast".
Speed BetaUsageSpeed `json:"speed" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreation respjson.Field
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InferenceGeo respjson.Field
InputTokens respjson.Field
Iterations respjson.Field
OutputTokens respjson.Field
ServerToolUse respjson.Field
ServiceTier respjson.Field
Speed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*BetaUsage) UnmarshalJSON ¶
type BetaUsageServiceTier ¶ added in v1.2.0
type BetaUsageServiceTier string
If the request used the priority, standard, or batch tier.
const ( BetaUsageServiceTierStandard BetaUsageServiceTier = "standard" BetaUsageServiceTierPriority BetaUsageServiceTier = "priority" BetaUsageServiceTierBatch BetaUsageServiceTier = "batch" )
type BetaUsageSpeed ¶ added in v1.22.0
type BetaUsageSpeed string
The inference speed mode used for this request.
const ( BetaUsageSpeedStandard BetaUsageSpeed = "standard" BetaUsageSpeedFast BetaUsageSpeed = "fast" )
type BetaUserLocationParam ¶ added in v1.23.0
type BetaUserLocationParam struct {
// The city of the user.
City param.Opt[string] `json:"city,omitzero"`
// The two letter
// [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
// user.
Country param.Opt[string] `json:"country,omitzero"`
// The region of the user.
Region param.Opt[string] `json:"region,omitzero"`
// The [IANA timezone](https://nodatime.org/TimeZones) of the user.
Timezone param.Opt[string] `json:"timezone,omitzero"`
// This field can be elided, and will marshal its zero value as "approximate".
Type constant.Approximate `json:"type" default:"approximate"`
// contains filtered or unexported fields
}
The property Type is required.
func (BetaUserLocationParam) MarshalJSON ¶ added in v1.23.0
func (r BetaUserLocationParam) MarshalJSON() (data []byte, err error)
func (*BetaUserLocationParam) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaUserLocationParam) UnmarshalJSON(data []byte) error
type BetaUserProfile ¶ added in v1.37.0
type BetaUserProfile struct {
// Unique identifier for this user profile, prefixed `uprof_`.
ID string `json:"id" api:"required"`
// A timestamp in RFC 3339 format
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up
// to 512 chars.
Metadata map[string]string `json:"metadata" api:"required"`
// Trust grants for this profile, keyed by grant name. Key omitted when no grant is
// active or in flight.
TrustGrants map[string]BetaUserProfileTrustGrant `json:"trust_grants" api:"required"`
// Object type. Always `user_profile`.
//
// Any of "user_profile".
Type BetaUserProfileType `json:"type" api:"required"`
// A timestamp in RFC 3339 format
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Platform's own identifier for this user. Not enforced unique.
ExternalID string `json:"external_id" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Metadata respjson.Field
TrustGrants respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ExternalID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaUserProfile) RawJSON ¶ added in v1.37.0
func (r BetaUserProfile) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaUserProfile) UnmarshalJSON ¶ added in v1.37.0
func (r *BetaUserProfile) UnmarshalJSON(data []byte) error
type BetaUserProfileEnrollmentURL ¶ added in v1.37.0
type BetaUserProfileEnrollmentURL struct {
// A timestamp in RFC 3339 format
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// Object type. Always `enrollment_url`.
//
// Any of "enrollment_url".
Type BetaUserProfileEnrollmentURLType `json:"type" api:"required"`
// Enrollment URL to send to the end user. Valid until `expires_at`.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ExpiresAt respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaUserProfileEnrollmentURL) RawJSON ¶ added in v1.37.0
func (r BetaUserProfileEnrollmentURL) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaUserProfileEnrollmentURL) UnmarshalJSON ¶ added in v1.37.0
func (r *BetaUserProfileEnrollmentURL) UnmarshalJSON(data []byte) error
type BetaUserProfileEnrollmentURLType ¶ added in v1.37.0
type BetaUserProfileEnrollmentURLType string
Object type. Always `enrollment_url`.
const (
BetaUserProfileEnrollmentURLTypeEnrollmentURL BetaUserProfileEnrollmentURLType = "enrollment_url"
)
type BetaUserProfileGetParams ¶ added in v1.37.0
type BetaUserProfileGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaUserProfileListParams ¶ added in v1.37.0
type BetaUserProfileListParams struct {
// Query parameter for limit
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Query parameter for page
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Query parameter for order
//
// Any of "asc", "desc".
Order BetaUserProfileListParamsOrder `query:"order,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaUserProfileListParams) URLQuery ¶ added in v1.37.0
func (r BetaUserProfileListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaUserProfileListParams's query parameters as `url.Values`.
type BetaUserProfileListParamsOrder ¶ added in v1.37.0
type BetaUserProfileListParamsOrder string
Query parameter for order
const ( BetaUserProfileListParamsOrderAsc BetaUserProfileListParamsOrder = "asc" BetaUserProfileListParamsOrderDesc BetaUserProfileListParamsOrder = "desc" )
type BetaUserProfileNewEnrollmentURLParams ¶ added in v1.37.0
type BetaUserProfileNewEnrollmentURLParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaUserProfileNewParams ¶ added in v1.37.0
type BetaUserProfileNewParams struct {
// Platform's own identifier for this user. Not enforced unique. Maximum 255
// characters.
ExternalID param.Opt[string] `json:"external_id,omitzero"`
// Free-form key-value data to attach to this user profile. Maximum 16 keys, with
// keys up to 64 characters and values up to 512 characters. Values must be
// non-empty strings.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaUserProfileNewParams) MarshalJSON ¶ added in v1.37.0
func (r BetaUserProfileNewParams) MarshalJSON() (data []byte, err error)
func (*BetaUserProfileNewParams) UnmarshalJSON ¶ added in v1.37.0
func (r *BetaUserProfileNewParams) UnmarshalJSON(data []byte) error
type BetaUserProfileService ¶ added in v1.37.0
type BetaUserProfileService struct {
Options []option.RequestOption
}
BetaUserProfileService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaUserProfileService method instead.
func NewBetaUserProfileService ¶ added in v1.37.0
func NewBetaUserProfileService(opts ...option.RequestOption) (r BetaUserProfileService)
NewBetaUserProfileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaUserProfileService) Get ¶ added in v1.37.0
func (r *BetaUserProfileService) Get(ctx context.Context, userProfileID string, query BetaUserProfileGetParams, opts ...option.RequestOption) (res *BetaUserProfile, err error)
Get User Profile
func (*BetaUserProfileService) List ¶ added in v1.37.0
func (r *BetaUserProfileService) List(ctx context.Context, params BetaUserProfileListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaUserProfile], err error)
List User Profiles
func (*BetaUserProfileService) ListAutoPaging ¶ added in v1.37.0
func (r *BetaUserProfileService) ListAutoPaging(ctx context.Context, params BetaUserProfileListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaUserProfile]
List User Profiles
func (*BetaUserProfileService) New ¶ added in v1.37.0
func (r *BetaUserProfileService) New(ctx context.Context, params BetaUserProfileNewParams, opts ...option.RequestOption) (res *BetaUserProfile, err error)
Create User Profile
func (*BetaUserProfileService) NewEnrollmentURL ¶ added in v1.37.0
func (r *BetaUserProfileService) NewEnrollmentURL(ctx context.Context, userProfileID string, body BetaUserProfileNewEnrollmentURLParams, opts ...option.RequestOption) (res *BetaUserProfileEnrollmentURL, err error)
Create Enrollment URL
func (*BetaUserProfileService) Update ¶ added in v1.37.0
func (r *BetaUserProfileService) Update(ctx context.Context, userProfileID string, params BetaUserProfileUpdateParams, opts ...option.RequestOption) (res *BetaUserProfile, err error)
Update User Profile
type BetaUserProfileTrustGrant ¶ added in v1.37.0
type BetaUserProfileTrustGrant struct {
// Status of the trust grant.
//
// Any of "active", "pending", "rejected".
Status BetaUserProfileTrustGrantStatus `json:"status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaUserProfileTrustGrant) RawJSON ¶ added in v1.37.0
func (r BetaUserProfileTrustGrant) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaUserProfileTrustGrant) UnmarshalJSON ¶ added in v1.37.0
func (r *BetaUserProfileTrustGrant) UnmarshalJSON(data []byte) error
type BetaUserProfileTrustGrantStatus ¶ added in v1.37.0
type BetaUserProfileTrustGrantStatus string
Status of the trust grant.
const ( BetaUserProfileTrustGrantStatusActive BetaUserProfileTrustGrantStatus = "active" BetaUserProfileTrustGrantStatusPending BetaUserProfileTrustGrantStatus = "pending" BetaUserProfileTrustGrantStatusRejected BetaUserProfileTrustGrantStatus = "rejected" )
type BetaUserProfileType ¶ added in v1.37.0
type BetaUserProfileType string
Object type. Always `user_profile`.
const (
BetaUserProfileTypeUserProfile BetaUserProfileType = "user_profile"
)
type BetaUserProfileUpdateParams ¶ added in v1.37.0
type BetaUserProfileUpdateParams struct {
// If present, replaces the stored external_id. Omit to leave unchanged. Maximum
// 255 characters.
ExternalID param.Opt[string] `json:"external_id,omitzero"`
// Key-value pairs to merge into the stored metadata. Keys provided overwrite
// existing values. To remove a key, set its value to an empty string. Keys not
// provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and
// values up to 512 characters.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaUserProfileUpdateParams) MarshalJSON ¶ added in v1.37.0
func (r BetaUserProfileUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaUserProfileUpdateParams) UnmarshalJSON ¶ added in v1.37.0
func (r *BetaUserProfileUpdateParams) UnmarshalJSON(data []byte) error
type BetaVaultArchiveParams ¶ added in v1.33.0
type BetaVaultArchiveParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaVaultCredentialArchiveParams ¶ added in v1.33.0
type BetaVaultCredentialArchiveParams struct {
VaultID string `path:"vault_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaVaultCredentialDeleteParams ¶ added in v1.33.0
type BetaVaultCredentialDeleteParams struct {
VaultID string `path:"vault_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaVaultCredentialGetParams ¶ added in v1.33.0
type BetaVaultCredentialGetParams struct {
VaultID string `path:"vault_id" api:"required" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaVaultCredentialListParams ¶ added in v1.33.0
type BetaVaultCredentialListParams struct {
// Whether to include archived credentials in the results.
IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
// Maximum number of credentials to return per page. Defaults to 20, maximum 100.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque pagination token from a previous `list_credentials` response.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaVaultCredentialListParams) URLQuery ¶ added in v1.33.0
func (r BetaVaultCredentialListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaVaultCredentialListParams's query parameters as `url.Values`.
type BetaVaultCredentialNewParams ¶ added in v1.33.0
type BetaVaultCredentialNewParams struct {
// Authentication details for creating a credential.
Auth BetaVaultCredentialNewParamsAuthUnion `json:"auth,omitzero" api:"required"`
// Human-readable name for the credential. Up to 255 characters.
DisplayName param.Opt[string] `json:"display_name,omitzero"`
// Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys
// up to 64 chars, values up to 512 chars.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaVaultCredentialNewParams) MarshalJSON ¶ added in v1.33.0
func (r BetaVaultCredentialNewParams) MarshalJSON() (data []byte, err error)
func (*BetaVaultCredentialNewParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaVaultCredentialNewParams) UnmarshalJSON(data []byte) error
type BetaVaultCredentialNewParamsAuthUnion ¶ added in v1.33.0
type BetaVaultCredentialNewParamsAuthUnion struct {
OfMCPOAuth *BetaManagedAgentsMCPOAuthCreateParams `json:",omitzero,inline"`
OfStaticBearer *BetaManagedAgentsStaticBearerCreateParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaVaultCredentialNewParamsAuthUnion) GetAccessToken ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) GetAccessToken() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialNewParamsAuthUnion) GetExpiresAt ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) GetExpiresAt() *time.Time
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialNewParamsAuthUnion) GetMCPServerURL ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) GetMCPServerURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialNewParamsAuthUnion) GetRefresh ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) GetRefresh() *BetaManagedAgentsMCPOAuthRefreshParams
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialNewParamsAuthUnion) GetToken ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) GetToken() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialNewParamsAuthUnion) GetType ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialNewParamsAuthUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaVaultCredentialNewParamsAuthUnion) MarshalJSON() ([]byte, error)
func (*BetaVaultCredentialNewParamsAuthUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaVaultCredentialNewParamsAuthUnion) UnmarshalJSON(data []byte) error
type BetaVaultCredentialService ¶ added in v1.33.0
type BetaVaultCredentialService struct {
Options []option.RequestOption
}
BetaVaultCredentialService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaVaultCredentialService method instead.
func NewBetaVaultCredentialService ¶ added in v1.33.0
func NewBetaVaultCredentialService(opts ...option.RequestOption) (r BetaVaultCredentialService)
NewBetaVaultCredentialService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaVaultCredentialService) Archive ¶ added in v1.33.0
func (r *BetaVaultCredentialService) Archive(ctx context.Context, credentialID string, params BetaVaultCredentialArchiveParams, opts ...option.RequestOption) (res *BetaManagedAgentsCredential, err error)
Archive Credential
func (*BetaVaultCredentialService) Delete ¶ added in v1.33.0
func (r *BetaVaultCredentialService) Delete(ctx context.Context, credentialID string, params BetaVaultCredentialDeleteParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeletedCredential, err error)
Delete Credential
func (*BetaVaultCredentialService) Get ¶ added in v1.33.0
func (r *BetaVaultCredentialService) Get(ctx context.Context, credentialID string, params BetaVaultCredentialGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsCredential, err error)
Get Credential
func (*BetaVaultCredentialService) List ¶ added in v1.33.0
func (r *BetaVaultCredentialService) List(ctx context.Context, vaultID string, params BetaVaultCredentialListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsCredential], err error)
List Credentials
func (*BetaVaultCredentialService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaVaultCredentialService) ListAutoPaging(ctx context.Context, vaultID string, params BetaVaultCredentialListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsCredential]
List Credentials
func (*BetaVaultCredentialService) New ¶ added in v1.33.0
func (r *BetaVaultCredentialService) New(ctx context.Context, vaultID string, params BetaVaultCredentialNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsCredential, err error)
Create Credential
func (*BetaVaultCredentialService) Update ¶ added in v1.33.0
func (r *BetaVaultCredentialService) Update(ctx context.Context, credentialID string, params BetaVaultCredentialUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsCredential, err error)
Update Credential
type BetaVaultCredentialUpdateParams ¶ added in v1.33.0
type BetaVaultCredentialUpdateParams struct {
VaultID string `path:"vault_id" api:"required" json:"-"`
// Updated human-readable name for the credential. 1-255 characters.
DisplayName param.Opt[string] `json:"display_name,omitzero"`
// Metadata patch. Set a key to a string to upsert it, or to null to delete it.
// Omitted keys are preserved.
Metadata map[string]string `json:"metadata,omitzero"`
// Updated authentication details for a credential.
Auth BetaVaultCredentialUpdateParamsAuthUnion `json:"auth,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaVaultCredentialUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaVaultCredentialUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaVaultCredentialUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaVaultCredentialUpdateParams) UnmarshalJSON(data []byte) error
type BetaVaultCredentialUpdateParamsAuthUnion ¶ added in v1.33.0
type BetaVaultCredentialUpdateParamsAuthUnion struct {
OfMCPOAuth *BetaManagedAgentsMCPOAuthUpdateParams `json:",omitzero,inline"`
OfStaticBearer *BetaManagedAgentsStaticBearerUpdateParams `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaVaultCredentialUpdateParamsAuthUnion) GetAccessToken ¶ added in v1.33.0
func (u BetaVaultCredentialUpdateParamsAuthUnion) GetAccessToken() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialUpdateParamsAuthUnion) GetExpiresAt ¶ added in v1.33.0
func (u BetaVaultCredentialUpdateParamsAuthUnion) GetExpiresAt() *time.Time
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialUpdateParamsAuthUnion) GetRefresh ¶ added in v1.33.0
func (u BetaVaultCredentialUpdateParamsAuthUnion) GetRefresh() *BetaManagedAgentsMCPOAuthRefreshUpdateParams
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialUpdateParamsAuthUnion) GetToken ¶ added in v1.33.0
func (u BetaVaultCredentialUpdateParamsAuthUnion) GetToken() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialUpdateParamsAuthUnion) GetType ¶ added in v1.33.0
func (u BetaVaultCredentialUpdateParamsAuthUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaVaultCredentialUpdateParamsAuthUnion) MarshalJSON ¶ added in v1.33.0
func (u BetaVaultCredentialUpdateParamsAuthUnion) MarshalJSON() ([]byte, error)
func (*BetaVaultCredentialUpdateParamsAuthUnion) UnmarshalJSON ¶ added in v1.33.0
func (u *BetaVaultCredentialUpdateParamsAuthUnion) UnmarshalJSON(data []byte) error
type BetaVaultDeleteParams ¶ added in v1.33.0
type BetaVaultDeleteParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaVaultGetParams ¶ added in v1.33.0
type BetaVaultGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type BetaVaultListParams ¶ added in v1.33.0
type BetaVaultListParams struct {
// Whether to include archived vaults in the results.
IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
// Maximum number of vaults to return per page. Defaults to 20, maximum 100.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Opaque pagination token from a previous `list_vaults` response.
Page param.Opt[string] `query:"page,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaVaultListParams) URLQuery ¶ added in v1.33.0
func (r BetaVaultListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaVaultListParams's query parameters as `url.Values`.
type BetaVaultNewParams ¶ added in v1.33.0
type BetaVaultNewParams struct {
// Human-readable name for the vault. 1-255 characters.
DisplayName string `json:"display_name" api:"required"`
// Arbitrary key-value metadata to attach to the vault. Maximum 16 pairs, keys up
// to 64 chars, values up to 512 chars.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaVaultNewParams) MarshalJSON ¶ added in v1.33.0
func (r BetaVaultNewParams) MarshalJSON() (data []byte, err error)
func (*BetaVaultNewParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaVaultNewParams) UnmarshalJSON(data []byte) error
type BetaVaultService ¶ added in v1.33.0
type BetaVaultService struct {
Options []option.RequestOption
Credentials BetaVaultCredentialService
}
BetaVaultService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBetaVaultService method instead.
func NewBetaVaultService ¶ added in v1.33.0
func NewBetaVaultService(opts ...option.RequestOption) (r BetaVaultService)
NewBetaVaultService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BetaVaultService) Archive ¶ added in v1.33.0
func (r *BetaVaultService) Archive(ctx context.Context, vaultID string, body BetaVaultArchiveParams, opts ...option.RequestOption) (res *BetaManagedAgentsVault, err error)
Archive Vault
func (*BetaVaultService) Delete ¶ added in v1.33.0
func (r *BetaVaultService) Delete(ctx context.Context, vaultID string, body BetaVaultDeleteParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeletedVault, err error)
Delete Vault
func (*BetaVaultService) Get ¶ added in v1.33.0
func (r *BetaVaultService) Get(ctx context.Context, vaultID string, query BetaVaultGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsVault, err error)
Get Vault
func (*BetaVaultService) List ¶ added in v1.33.0
func (r *BetaVaultService) List(ctx context.Context, params BetaVaultListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsVault], err error)
List Vaults
func (*BetaVaultService) ListAutoPaging ¶ added in v1.33.0
func (r *BetaVaultService) ListAutoPaging(ctx context.Context, params BetaVaultListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsVault]
List Vaults
func (*BetaVaultService) New ¶ added in v1.33.0
func (r *BetaVaultService) New(ctx context.Context, params BetaVaultNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsVault, err error)
Create Vault
func (*BetaVaultService) Update ¶ added in v1.33.0
func (r *BetaVaultService) Update(ctx context.Context, vaultID string, params BetaVaultUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsVault, err error)
Update Vault
type BetaVaultUpdateParams ¶ added in v1.33.0
type BetaVaultUpdateParams struct {
// Updated human-readable name for the vault. 1-255 characters.
DisplayName param.Opt[string] `json:"display_name,omitzero"`
// Metadata patch. Set a key to a string to upsert it, or to null to delete it.
// Omitted keys are preserved.
Metadata map[string]string `json:"metadata,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BetaVaultUpdateParams) MarshalJSON ¶ added in v1.33.0
func (r BetaVaultUpdateParams) MarshalJSON() (data []byte, err error)
func (*BetaVaultUpdateParams) UnmarshalJSON ¶ added in v1.33.0
func (r *BetaVaultUpdateParams) UnmarshalJSON(data []byte) error
type BetaWebFetchBlock ¶ added in v1.12.0
type BetaWebFetchBlock struct {
Content BetaDocumentBlock `json:"content" api:"required"`
// ISO 8601 timestamp when the content was retrieved
RetrievedAt string `json:"retrieved_at" api:"required"`
Type constant.WebFetchResult `json:"type" default:"web_fetch_result"`
// Fetched content URL
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
RetrievedAt respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaWebFetchBlock) RawJSON ¶ added in v1.12.0
func (r BetaWebFetchBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebFetchBlock) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchBlock) UnmarshalJSON(data []byte) error
type BetaWebFetchBlockParam ¶ added in v1.12.0
type BetaWebFetchBlockParam struct {
Content BetaRequestDocumentBlockParam `json:"content,omitzero" api:"required"`
// Fetched content URL
URL string `json:"url" api:"required"`
// ISO 8601 timestamp when the content was retrieved
RetrievedAt param.Opt[string] `json:"retrieved_at,omitzero"`
// This field can be elided, and will marshal its zero value as "web_fetch_result".
Type constant.WebFetchResult `json:"type" default:"web_fetch_result"`
// contains filtered or unexported fields
}
The properties Content, Type, URL are required.
func (BetaWebFetchBlockParam) MarshalJSON ¶ added in v1.12.0
func (r BetaWebFetchBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaWebFetchBlockParam) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchBlockParam) UnmarshalJSON(data []byte) error
type BetaWebFetchTool20250910Param ¶ added in v1.12.0
type BetaWebFetchTool20250910Param struct {
// Maximum number of tokens used by including web page text content in the context.
// The limit is approximate and does not apply to binary content such as PDFs.
MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// List of domains to allow fetching from
AllowedDomains []string `json:"allowed_domains,omitzero"`
// List of domains to block fetching from
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Citations configuration for fetched documents. Citations are disabled by
// default.
Citations BetaCitationsConfigParam `json:"citations,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_fetch".
Name constant.WebFetch `json:"name" default:"web_fetch"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_20250910".
Type constant.WebFetch20250910 `json:"type" default:"web_fetch_20250910"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaWebFetchTool20250910Param) MarshalJSON ¶ added in v1.12.0
func (r BetaWebFetchTool20250910Param) MarshalJSON() (data []byte, err error)
func (*BetaWebFetchTool20250910Param) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchTool20250910Param) UnmarshalJSON(data []byte) error
type BetaWebFetchTool20260209Param ¶ added in v1.23.0
type BetaWebFetchTool20260209Param struct {
// Maximum number of tokens used by including web page text content in the context.
// The limit is approximate and does not apply to binary content such as PDFs.
MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// List of domains to allow fetching from
AllowedDomains []string `json:"allowed_domains,omitzero"`
// List of domains to block fetching from
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Citations configuration for fetched documents. Citations are disabled by
// default.
Citations BetaCitationsConfigParam `json:"citations,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_fetch".
Name constant.WebFetch `json:"name" default:"web_fetch"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_20260209".
Type constant.WebFetch20260209 `json:"type" default:"web_fetch_20260209"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaWebFetchTool20260209Param) MarshalJSON ¶ added in v1.23.0
func (r BetaWebFetchTool20260209Param) MarshalJSON() (data []byte, err error)
func (*BetaWebFetchTool20260209Param) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaWebFetchTool20260209Param) UnmarshalJSON(data []byte) error
type BetaWebFetchTool20260309Param ¶ added in v1.27.0
type BetaWebFetchTool20260309Param struct {
// Maximum number of tokens used by including web page text content in the context.
// The limit is approximate and does not apply to binary content such as PDFs.
MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Whether to use cached content. Set to false to bypass the cache and fetch fresh
// content. Only set to false when the user explicitly requests fresh content or
// when fetching rapidly-changing sources.
UseCache param.Opt[bool] `json:"use_cache,omitzero"`
// List of domains to allow fetching from
AllowedDomains []string `json:"allowed_domains,omitzero"`
// List of domains to block fetching from
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Citations configuration for fetched documents. Citations are disabled by
// default.
Citations BetaCitationsConfigParam `json:"citations,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_fetch".
Name constant.WebFetch `json:"name" default:"web_fetch"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_20260309".
Type constant.WebFetch20260309 `json:"type" default:"web_fetch_20260309"`
// contains filtered or unexported fields
}
Web fetch tool with use_cache parameter for bypassing cached content.
The properties Name, Type are required.
func (BetaWebFetchTool20260309Param) MarshalJSON ¶ added in v1.27.0
func (r BetaWebFetchTool20260309Param) MarshalJSON() (data []byte, err error)
func (*BetaWebFetchTool20260309Param) UnmarshalJSON ¶ added in v1.27.0
func (r *BetaWebFetchTool20260309Param) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultBlock ¶ added in v1.12.0
type BetaWebFetchToolResultBlock struct {
Content BetaWebFetchToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.WebFetchToolResult `json:"type" default:"web_fetch_tool_result"`
// Tool invocation directly from the model.
Caller BetaWebFetchToolResultBlockCallerUnion `json:"caller"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
Caller respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaWebFetchToolResultBlock) RawJSON ¶ added in v1.12.0
func (r BetaWebFetchToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaWebFetchToolResultBlock) ToParam ¶ added in v1.20.0
func (r BetaWebFetchToolResultBlock) ToParam() BetaWebFetchToolResultBlockParam
func (*BetaWebFetchToolResultBlock) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchToolResultBlock) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultBlockCallerUnion ¶ added in v1.23.0
type BetaWebFetchToolResultBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaWebFetchToolResultBlockCallerUnion contains all possible properties and values from BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller20260120.
Use the BetaWebFetchToolResultBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaWebFetchToolResultBlockCallerUnion) AsAny ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockCallerUnion) AsAny() anyBetaWebFetchToolResultBlockCaller
Use the following switch statement to find the correct variant
switch variant := BetaWebFetchToolResultBlockCallerUnion.AsAny().(type) {
case anthropic.BetaDirectCaller:
case anthropic.BetaServerToolCaller:
case anthropic.BetaServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
func (BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
func (BetaWebFetchToolResultBlockCallerUnion) AsDirect ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockCallerUnion) AsDirect() (v BetaDirectCaller)
func (BetaWebFetchToolResultBlockCallerUnion) RawJSON ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebFetchToolResultBlockCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaWebFetchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultBlockContentUnion ¶ added in v1.12.0
type BetaWebFetchToolResultBlockContentUnion struct {
// This field is from variant [BetaWebFetchToolResultErrorBlock].
ErrorCode BetaWebFetchToolResultErrorCode `json:"error_code"`
Type string `json:"type"`
// This field is from variant [BetaWebFetchBlock].
Content BetaDocumentBlock `json:"content"`
// This field is from variant [BetaWebFetchBlock].
RetrievedAt string `json:"retrieved_at"`
// This field is from variant [BetaWebFetchBlock].
URL string `json:"url"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
RetrievedAt respjson.Field
URL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaWebFetchToolResultBlockContentUnion contains all possible properties and values from BetaWebFetchToolResultErrorBlock, BetaWebFetchBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock() (v BetaWebFetchBlock)
func (BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError() (v BetaWebFetchToolResultErrorBlock)
func (BetaWebFetchToolResultBlockContentUnion) RawJSON ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebFetchToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultBlockParam ¶ added in v1.12.0
type BetaWebFetchToolResultBlockParam struct {
Content BetaWebFetchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller BetaWebFetchToolResultBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_tool_result".
Type constant.WebFetchToolResult `json:"type" default:"web_fetch_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaWebFetchToolResultBlockParam) MarshalJSON ¶ added in v1.12.0
func (r BetaWebFetchToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaWebFetchToolResultBlockParam) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultBlockParamCallerUnion ¶ added in v1.23.0
type BetaWebFetchToolResultBlockParamCallerUnion struct {
OfDirect *BetaDirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *BetaServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaWebFetchToolResultBlockParamCallerUnion) GetToolID ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamCallerUnion) GetType ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamCallerUnion) MarshalJSON ¶ added in v1.23.0
func (u BetaWebFetchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*BetaWebFetchToolResultBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *BetaWebFetchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultBlockParamContentUnion ¶ added in v1.12.0
type BetaWebFetchToolResultBlockParamContentUnion struct {
OfRequestWebFetchToolResultError *BetaWebFetchToolResultErrorBlockParam `json:",omitzero,inline"`
OfRequestWebFetchResultBlock *BetaWebFetchBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaWebFetchToolResultBlockParamContentUnion) GetContent ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockParamContentUnion) GetContent() *BetaRequestDocumentBlockParam
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamContentUnion) GetRetrievedAt ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockParamContentUnion) GetRetrievedAt() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamContentUnion) GetType ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamContentUnion) GetURL ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockParamContentUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebFetchToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.12.0
func (u BetaWebFetchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaWebFetchToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.12.0
func (u *BetaWebFetchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultErrorBlock ¶ added in v1.12.0
type BetaWebFetchToolResultErrorBlock struct {
// Any of "invalid_tool_input", "url_too_long", "url_not_allowed",
// "url_not_accessible", "unsupported_content_type", "too_many_requests",
// "max_uses_exceeded", "unavailable".
ErrorCode BetaWebFetchToolResultErrorCode `json:"error_code" api:"required"`
Type constant.WebFetchToolResultError `json:"type" default:"web_fetch_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaWebFetchToolResultErrorBlock) RawJSON ¶ added in v1.12.0
func (r BetaWebFetchToolResultErrorBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebFetchToolResultErrorBlock) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchToolResultErrorBlock) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultErrorBlockParam ¶ added in v1.12.0
type BetaWebFetchToolResultErrorBlockParam struct {
// Any of "invalid_tool_input", "url_too_long", "url_not_allowed",
// "url_not_accessible", "unsupported_content_type", "too_many_requests",
// "max_uses_exceeded", "unavailable".
ErrorCode BetaWebFetchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_tool_result_error".
Type constant.WebFetchToolResultError `json:"type" default:"web_fetch_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaWebFetchToolResultErrorBlockParam) MarshalJSON ¶ added in v1.12.0
func (r BetaWebFetchToolResultErrorBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaWebFetchToolResultErrorBlockParam) UnmarshalJSON ¶ added in v1.12.0
func (r *BetaWebFetchToolResultErrorBlockParam) UnmarshalJSON(data []byte) error
type BetaWebFetchToolResultErrorCode ¶ added in v1.12.0
type BetaWebFetchToolResultErrorCode string
const ( BetaWebFetchToolResultErrorCodeInvalidToolInput BetaWebFetchToolResultErrorCode = "invalid_tool_input" BetaWebFetchToolResultErrorCodeURLTooLong BetaWebFetchToolResultErrorCode = "url_too_long" BetaWebFetchToolResultErrorCodeURLNotAllowed BetaWebFetchToolResultErrorCode = "url_not_allowed" BetaWebFetchToolResultErrorCodeURLNotAccessible BetaWebFetchToolResultErrorCode = "url_not_accessible" BetaWebFetchToolResultErrorCodeUnsupportedContentType BetaWebFetchToolResultErrorCode = "unsupported_content_type" BetaWebFetchToolResultErrorCodeTooManyRequests BetaWebFetchToolResultErrorCode = "too_many_requests" BetaWebFetchToolResultErrorCodeMaxUsesExceeded BetaWebFetchToolResultErrorCode = "max_uses_exceeded" )
type BetaWebSearchResultBlock ¶
type BetaWebSearchResultBlock struct {
EncryptedContent string `json:"encrypted_content" api:"required"`
PageAge string `json:"page_age" api:"required"`
Title string `json:"title" api:"required"`
Type constant.WebSearchResult `json:"type" default:"web_search_result"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EncryptedContent respjson.Field
PageAge respjson.Field
Title respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaWebSearchResultBlock) RawJSON ¶
func (r BetaWebSearchResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaWebSearchResultBlock) ToParam ¶ added in v1.20.0
func (r BetaWebSearchResultBlock) ToParam() BetaWebSearchResultBlockParam
func (*BetaWebSearchResultBlock) UnmarshalJSON ¶
func (r *BetaWebSearchResultBlock) UnmarshalJSON(data []byte) error
type BetaWebSearchResultBlockParam ¶
type BetaWebSearchResultBlockParam struct {
EncryptedContent string `json:"encrypted_content" api:"required"`
Title string `json:"title" api:"required"`
URL string `json:"url" api:"required"`
PageAge param.Opt[string] `json:"page_age,omitzero"`
// This field can be elided, and will marshal its zero value as
// "web_search_result".
Type constant.WebSearchResult `json:"type" default:"web_search_result"`
// contains filtered or unexported fields
}
The properties EncryptedContent, Title, Type, URL are required.
func (BetaWebSearchResultBlockParam) MarshalJSON ¶
func (r BetaWebSearchResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaWebSearchResultBlockParam) UnmarshalJSON ¶
func (r *BetaWebSearchResultBlockParam) UnmarshalJSON(data []byte) error
type BetaWebSearchTool20250305Param ¶
type BetaWebSearchTool20250305Param struct {
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// If provided, only these domains will be included in results. Cannot be used
// alongside `blocked_domains`.
AllowedDomains []string `json:"allowed_domains,omitzero"`
// If provided, these domains will never appear in results. Cannot be used
// alongside `allowed_domains`.
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Parameters for the user's location. Used to provide more relevant search
// results.
UserLocation BetaUserLocationParam `json:"user_location,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_search".
Name constant.WebSearch `json:"name" default:"web_search"`
// This field can be elided, and will marshal its zero value as
// "web_search_20250305".
Type constant.WebSearch20250305 `json:"type" default:"web_search_20250305"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaWebSearchTool20250305Param) MarshalJSON ¶
func (r BetaWebSearchTool20250305Param) MarshalJSON() (data []byte, err error)
func (*BetaWebSearchTool20250305Param) UnmarshalJSON ¶
func (r *BetaWebSearchTool20250305Param) UnmarshalJSON(data []byte) error
type BetaWebSearchTool20260209Param ¶ added in v1.23.0
type BetaWebSearchTool20260209Param struct {
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// If provided, only these domains will be included in results. Cannot be used
// alongside `blocked_domains`.
AllowedDomains []string `json:"allowed_domains,omitzero"`
// If provided, these domains will never appear in results. Cannot be used
// alongside `allowed_domains`.
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Parameters for the user's location. Used to provide more relevant search
// results.
UserLocation BetaUserLocationParam `json:"user_location,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_search".
Name constant.WebSearch `json:"name" default:"web_search"`
// This field can be elided, and will marshal its zero value as
// "web_search_20260209".
Type constant.WebSearch20260209 `json:"type" default:"web_search_20260209"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (BetaWebSearchTool20260209Param) MarshalJSON ¶ added in v1.23.0
func (r BetaWebSearchTool20260209Param) MarshalJSON() (data []byte, err error)
func (*BetaWebSearchTool20260209Param) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaWebSearchTool20260209Param) UnmarshalJSON(data []byte) error
type BetaWebSearchToolRequestErrorParam ¶
type BetaWebSearchToolRequestErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "max_uses_exceeded",
// "too_many_requests", "query_too_long", "request_too_large".
ErrorCode BetaWebSearchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "web_search_tool_result_error".
Type constant.WebSearchToolResultError `json:"type" default:"web_search_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (BetaWebSearchToolRequestErrorParam) MarshalJSON ¶
func (r BetaWebSearchToolRequestErrorParam) MarshalJSON() (data []byte, err error)
func (*BetaWebSearchToolRequestErrorParam) UnmarshalJSON ¶
func (r *BetaWebSearchToolRequestErrorParam) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultBlock ¶
type BetaWebSearchToolResultBlock struct {
Content BetaWebSearchToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.WebSearchToolResult `json:"type" default:"web_search_tool_result"`
// Tool invocation directly from the model.
Caller BetaWebSearchToolResultBlockCallerUnion `json:"caller"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
Caller respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaWebSearchToolResultBlock) RawJSON ¶
func (r BetaWebSearchToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (BetaWebSearchToolResultBlock) ToParam ¶ added in v1.20.0
func (r BetaWebSearchToolResultBlock) ToParam() BetaWebSearchToolResultBlockParam
func (*BetaWebSearchToolResultBlock) UnmarshalJSON ¶
func (r *BetaWebSearchToolResultBlock) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultBlockCallerUnion ¶ added in v1.23.0
type BetaWebSearchToolResultBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaWebSearchToolResultBlockCallerUnion contains all possible properties and values from BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller20260120.
Use the BetaWebSearchToolResultBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BetaWebSearchToolResultBlockCallerUnion) AsAny ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockCallerUnion) AsAny() anyBetaWebSearchToolResultBlockCaller
Use the following switch statement to find the correct variant
switch variant := BetaWebSearchToolResultBlockCallerUnion.AsAny().(type) {
case anthropic.BetaDirectCaller:
case anthropic.BetaServerToolCaller:
case anthropic.BetaServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20250825() (v BetaServerToolCaller)
func (BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockCallerUnion) AsCodeExecution20260120() (v BetaServerToolCaller20260120)
func (BetaWebSearchToolResultBlockCallerUnion) AsDirect ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockCallerUnion) AsDirect() (v BetaDirectCaller)
func (BetaWebSearchToolResultBlockCallerUnion) RawJSON ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebSearchToolResultBlockCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *BetaWebSearchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultBlockContentUnion ¶
type BetaWebSearchToolResultBlockContentUnion struct {
// This field will be present if the value is a [[]BetaWebSearchResultBlock]
// instead of an object.
OfBetaWebSearchResultBlockArray []BetaWebSearchResultBlock `json:",inline"`
// This field is from variant [BetaWebSearchToolResultError].
ErrorCode BetaWebSearchToolResultErrorCode `json:"error_code"`
// This field is from variant [BetaWebSearchToolResultError].
Type constant.WebSearchToolResultError `json:"type"`
JSON struct {
OfBetaWebSearchResultBlockArray respjson.Field
ErrorCode respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BetaWebSearchToolResultBlockContentUnion contains all possible properties and values from BetaWebSearchToolResultError, [[]BetaWebSearchResultBlock].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfBetaWebSearchResultBlockArray]
func (BetaWebSearchToolResultBlockContentUnion) AsBetaWebSearchResultBlockArray ¶
func (u BetaWebSearchToolResultBlockContentUnion) AsBetaWebSearchResultBlockArray() (v []BetaWebSearchResultBlock)
func (BetaWebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError ¶
func (u BetaWebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError() (v BetaWebSearchToolResultError)
func (BetaWebSearchToolResultBlockContentUnion) RawJSON ¶
func (u BetaWebSearchToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebSearchToolResultBlockContentUnion) UnmarshalJSON ¶
func (r *BetaWebSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultBlockParam ¶
type BetaWebSearchToolResultBlockParam struct {
Content BetaWebSearchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl BetaCacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller BetaWebSearchToolResultBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as
// "web_search_tool_result".
Type constant.WebSearchToolResult `json:"type" default:"web_search_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (BetaWebSearchToolResultBlockParam) MarshalJSON ¶
func (r BetaWebSearchToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*BetaWebSearchToolResultBlockParam) UnmarshalJSON ¶
func (r *BetaWebSearchToolResultBlockParam) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultBlockParamCallerUnion ¶ added in v1.23.0
type BetaWebSearchToolResultBlockParamCallerUnion struct {
OfDirect *BetaDirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *BetaServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *BetaServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BetaWebSearchToolResultBlockParamCallerUnion) GetToolID ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebSearchToolResultBlockParamCallerUnion) GetType ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaWebSearchToolResultBlockParamCallerUnion) MarshalJSON ¶ added in v1.23.0
func (u BetaWebSearchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*BetaWebSearchToolResultBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *BetaWebSearchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultBlockParamContentUnion ¶
type BetaWebSearchToolResultBlockParamContentUnion struct {
OfResultBlock []BetaWebSearchResultBlockParam `json:",omitzero,inline"`
OfError *BetaWebSearchToolRequestErrorParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func BetaNewWebSearchToolRequestError ¶
func BetaNewWebSearchToolRequestError(errorCode BetaWebSearchToolResultErrorCode) BetaWebSearchToolResultBlockParamContentUnion
func (BetaWebSearchToolResultBlockParamContentUnion) MarshalJSON ¶
func (u BetaWebSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*BetaWebSearchToolResultBlockParamContentUnion) UnmarshalJSON ¶
func (u *BetaWebSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultError ¶
type BetaWebSearchToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "max_uses_exceeded",
// "too_many_requests", "query_too_long", "request_too_large".
ErrorCode BetaWebSearchToolResultErrorCode `json:"error_code" api:"required"`
Type constant.WebSearchToolResultError `json:"type" default:"web_search_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BetaWebSearchToolResultError) RawJSON ¶
func (r BetaWebSearchToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BetaWebSearchToolResultError) UnmarshalJSON ¶
func (r *BetaWebSearchToolResultError) UnmarshalJSON(data []byte) error
type BetaWebSearchToolResultErrorCode ¶ added in v1.2.0
type BetaWebSearchToolResultErrorCode string
const ( BetaWebSearchToolResultErrorCodeInvalidToolInput BetaWebSearchToolResultErrorCode = "invalid_tool_input" BetaWebSearchToolResultErrorCodeMaxUsesExceeded BetaWebSearchToolResultErrorCode = "max_uses_exceeded" BetaWebSearchToolResultErrorCodeTooManyRequests BetaWebSearchToolResultErrorCode = "too_many_requests" BetaWebSearchToolResultErrorCodeQueryTooLong BetaWebSearchToolResultErrorCode = "query_too_long" BetaWebSearchToolResultErrorCodeRequestTooLarge BetaWebSearchToolResultErrorCode = "request_too_large" )
type CacheControlEphemeralParam ¶
type CacheControlEphemeralParam struct {
// The time-to-live for the cache control breakpoint.
//
// This may be one the following values:
//
// - `5m`: 5 minutes
// - `1h`: 1 hour
//
// Defaults to `5m`.
//
// Any of "5m", "1h".
TTL CacheControlEphemeralTTL `json:"ttl,omitzero"`
Type constant.Ephemeral `json:"type" default:"ephemeral"`
// contains filtered or unexported fields
}
This struct has a constant value, construct it with NewCacheControlEphemeralParam.
func NewCacheControlEphemeralParam ¶
func NewCacheControlEphemeralParam() CacheControlEphemeralParam
func (CacheControlEphemeralParam) MarshalJSON ¶
func (r CacheControlEphemeralParam) MarshalJSON() (data []byte, err error)
func (*CacheControlEphemeralParam) UnmarshalJSON ¶
func (r *CacheControlEphemeralParam) UnmarshalJSON(data []byte) error
type CacheControlEphemeralTTL ¶ added in v1.10.0
type CacheControlEphemeralTTL string
The time-to-live for the cache control breakpoint.
This may be one the following values:
- `5m`: 5 minutes - `1h`: 1 hour
Defaults to `5m`.
const ( CacheControlEphemeralTTLTTL5m CacheControlEphemeralTTL = "5m" CacheControlEphemeralTTLTTL1h CacheControlEphemeralTTL = "1h" )
type CacheCreation ¶ added in v1.10.0
type CacheCreation struct {
// The number of input tokens used to create the 1 hour cache entry.
Ephemeral1hInputTokens int64 `json:"ephemeral_1h_input_tokens" api:"required"`
// The number of input tokens used to create the 5 minute cache entry.
Ephemeral5mInputTokens int64 `json:"ephemeral_5m_input_tokens" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Ephemeral1hInputTokens respjson.Field
Ephemeral5mInputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CacheCreation) RawJSON ¶ added in v1.10.0
func (r CacheCreation) RawJSON() string
Returns the unmodified JSON received from the API
func (*CacheCreation) UnmarshalJSON ¶ added in v1.10.0
func (r *CacheCreation) UnmarshalJSON(data []byte) error
type CapabilitySupport ¶ added in v1.27.1
type CapabilitySupport struct {
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Supported respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Indicates whether a capability is supported.
func (CapabilitySupport) RawJSON ¶ added in v1.27.1
func (r CapabilitySupport) RawJSON() string
Returns the unmodified JSON received from the API
func (*CapabilitySupport) UnmarshalJSON ¶ added in v1.27.1
func (r *CapabilitySupport) UnmarshalJSON(data []byte) error
type CitationCharLocation ¶
type CitationCharLocation struct {
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
DocumentTitle string `json:"document_title" api:"required"`
EndCharIndex int64 `json:"end_char_index" api:"required"`
FileID string `json:"file_id" api:"required"`
StartCharIndex int64 `json:"start_char_index" api:"required"`
Type constant.CharLocation `json:"type" default:"char_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndCharIndex respjson.Field
FileID respjson.Field
StartCharIndex respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationCharLocation) RawJSON ¶
func (r CitationCharLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationCharLocation) UnmarshalJSON ¶
func (r *CitationCharLocation) UnmarshalJSON(data []byte) error
type CitationCharLocationParam ¶
type CitationCharLocationParam struct {
DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
EndCharIndex int64 `json:"end_char_index" api:"required"`
StartCharIndex int64 `json:"start_char_index" api:"required"`
// This field can be elided, and will marshal its zero value as "char_location".
Type constant.CharLocation `json:"type" default:"char_location"`
// contains filtered or unexported fields
}
The properties CitedText, DocumentIndex, DocumentTitle, EndCharIndex, StartCharIndex, Type are required.
func (CitationCharLocationParam) MarshalJSON ¶
func (r CitationCharLocationParam) MarshalJSON() (data []byte, err error)
func (*CitationCharLocationParam) UnmarshalJSON ¶
func (r *CitationCharLocationParam) UnmarshalJSON(data []byte) error
type CitationContentBlockLocation ¶
type CitationContentBlockLocation struct {
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
DocumentTitle string `json:"document_title" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
FileID string `json:"file_id" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
Type constant.ContentBlockLocation `json:"type" default:"content_block_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndBlockIndex respjson.Field
FileID respjson.Field
StartBlockIndex respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationContentBlockLocation) RawJSON ¶
func (r CitationContentBlockLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationContentBlockLocation) UnmarshalJSON ¶
func (r *CitationContentBlockLocation) UnmarshalJSON(data []byte) error
type CitationContentBlockLocationParam ¶
type CitationContentBlockLocationParam struct {
DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
// This field can be elided, and will marshal its zero value as
// "content_block_location".
Type constant.ContentBlockLocation `json:"type" default:"content_block_location"`
// contains filtered or unexported fields
}
The properties CitedText, DocumentIndex, DocumentTitle, EndBlockIndex, StartBlockIndex, Type are required.
func (CitationContentBlockLocationParam) MarshalJSON ¶
func (r CitationContentBlockLocationParam) MarshalJSON() (data []byte, err error)
func (*CitationContentBlockLocationParam) UnmarshalJSON ¶
func (r *CitationContentBlockLocationParam) UnmarshalJSON(data []byte) error
type CitationPageLocation ¶
type CitationPageLocation struct {
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
DocumentTitle string `json:"document_title" api:"required"`
EndPageNumber int64 `json:"end_page_number" api:"required"`
FileID string `json:"file_id" api:"required"`
StartPageNumber int64 `json:"start_page_number" api:"required"`
Type constant.PageLocation `json:"type" default:"page_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndPageNumber respjson.Field
FileID respjson.Field
StartPageNumber respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationPageLocation) RawJSON ¶
func (r CitationPageLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationPageLocation) UnmarshalJSON ¶
func (r *CitationPageLocation) UnmarshalJSON(data []byte) error
type CitationPageLocationParam ¶
type CitationPageLocationParam struct {
DocumentTitle param.Opt[string] `json:"document_title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
DocumentIndex int64 `json:"document_index" api:"required"`
EndPageNumber int64 `json:"end_page_number" api:"required"`
StartPageNumber int64 `json:"start_page_number" api:"required"`
// This field can be elided, and will marshal its zero value as "page_location".
Type constant.PageLocation `json:"type" default:"page_location"`
// contains filtered or unexported fields
}
The properties CitedText, DocumentIndex, DocumentTitle, EndPageNumber, StartPageNumber, Type are required.
func (CitationPageLocationParam) MarshalJSON ¶
func (r CitationPageLocationParam) MarshalJSON() (data []byte, err error)
func (*CitationPageLocationParam) UnmarshalJSON ¶
func (r *CitationPageLocationParam) UnmarshalJSON(data []byte) error
type CitationSearchResultLocationParam ¶ added in v1.8.0
type CitationSearchResultLocationParam struct {
Title param.Opt[string] `json:"title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
SearchResultIndex int64 `json:"search_result_index" api:"required"`
Source string `json:"source" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
// This field can be elided, and will marshal its zero value as
// "search_result_location".
Type constant.SearchResultLocation `json:"type" default:"search_result_location"`
// contains filtered or unexported fields
}
The properties CitedText, EndBlockIndex, SearchResultIndex, Source, StartBlockIndex, Title, Type are required.
func (CitationSearchResultLocationParam) MarshalJSON ¶ added in v1.8.0
func (r CitationSearchResultLocationParam) MarshalJSON() (data []byte, err error)
func (*CitationSearchResultLocationParam) UnmarshalJSON ¶ added in v1.8.0
func (r *CitationSearchResultLocationParam) UnmarshalJSON(data []byte) error
type CitationWebSearchResultLocationParam ¶
type CitationWebSearchResultLocationParam struct {
Title param.Opt[string] `json:"title,omitzero" api:"required"`
CitedText string `json:"cited_text" api:"required"`
EncryptedIndex string `json:"encrypted_index" api:"required"`
URL string `json:"url" api:"required"`
// This field can be elided, and will marshal its zero value as
// "web_search_result_location".
Type constant.WebSearchResultLocation `json:"type" default:"web_search_result_location"`
// contains filtered or unexported fields
}
The properties CitedText, EncryptedIndex, Title, Type, URL are required.
func (CitationWebSearchResultLocationParam) MarshalJSON ¶
func (r CitationWebSearchResultLocationParam) MarshalJSON() (data []byte, err error)
func (*CitationWebSearchResultLocationParam) UnmarshalJSON ¶
func (r *CitationWebSearchResultLocationParam) UnmarshalJSON(data []byte) error
type CitationsConfig ¶ added in v1.23.0
type CitationsConfig struct {
Enabled bool `json:"enabled" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationsConfig) RawJSON ¶ added in v1.23.0
func (r CitationsConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationsConfig) UnmarshalJSON ¶ added in v1.23.0
func (r *CitationsConfig) UnmarshalJSON(data []byte) error
type CitationsConfigParam ¶
type CitationsConfigParam struct {
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// contains filtered or unexported fields
}
func (CitationsConfigParam) MarshalJSON ¶
func (r CitationsConfigParam) MarshalJSON() (data []byte, err error)
func (*CitationsConfigParam) UnmarshalJSON ¶
func (r *CitationsConfigParam) UnmarshalJSON(data []byte) error
type CitationsDelta ¶
type CitationsDelta struct {
Citation CitationsDeltaCitationUnion `json:"citation" api:"required"`
Type constant.CitationsDelta `json:"type" default:"citations_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Citation respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationsDelta) RawJSON ¶
func (r CitationsDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationsDelta) UnmarshalJSON ¶
func (r *CitationsDelta) UnmarshalJSON(data []byte) error
type CitationsDeltaCitationUnion ¶
type CitationsDeltaCitationUnion struct {
CitedText string `json:"cited_text"`
DocumentIndex int64 `json:"document_index"`
DocumentTitle string `json:"document_title"`
// This field is from variant [CitationCharLocation].
EndCharIndex int64 `json:"end_char_index"`
FileID string `json:"file_id"`
// This field is from variant [CitationCharLocation].
StartCharIndex int64 `json:"start_char_index"`
// Any of "char_location", "page_location", "content_block_location",
// "web_search_result_location", "search_result_location".
Type string `json:"type"`
// This field is from variant [CitationPageLocation].
EndPageNumber int64 `json:"end_page_number"`
// This field is from variant [CitationPageLocation].
StartPageNumber int64 `json:"start_page_number"`
EndBlockIndex int64 `json:"end_block_index"`
StartBlockIndex int64 `json:"start_block_index"`
// This field is from variant [CitationsWebSearchResultLocation].
EncryptedIndex string `json:"encrypted_index"`
Title string `json:"title"`
// This field is from variant [CitationsWebSearchResultLocation].
URL string `json:"url"`
// This field is from variant [CitationsSearchResultLocation].
SearchResultIndex int64 `json:"search_result_index"`
// This field is from variant [CitationsSearchResultLocation].
Source string `json:"source"`
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndCharIndex respjson.Field
FileID respjson.Field
StartCharIndex respjson.Field
Type respjson.Field
EndPageNumber respjson.Field
StartPageNumber respjson.Field
EndBlockIndex respjson.Field
StartBlockIndex respjson.Field
EncryptedIndex respjson.Field
Title respjson.Field
URL respjson.Field
SearchResultIndex respjson.Field
Source respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
CitationsDeltaCitationUnion contains all possible properties and values from CitationCharLocation, CitationPageLocation, CitationContentBlockLocation, CitationsWebSearchResultLocation, CitationsSearchResultLocation.
Use the CitationsDeltaCitationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (CitationsDeltaCitationUnion) AsAny ¶
func (u CitationsDeltaCitationUnion) AsAny() anyCitationsDeltaCitation
Use the following switch statement to find the correct variant
switch variant := CitationsDeltaCitationUnion.AsAny().(type) {
case anthropic.CitationCharLocation:
case anthropic.CitationPageLocation:
case anthropic.CitationContentBlockLocation:
case anthropic.CitationsWebSearchResultLocation:
case anthropic.CitationsSearchResultLocation:
default:
fmt.Errorf("no variant present")
}
func (CitationsDeltaCitationUnion) AsCharLocation ¶
func (u CitationsDeltaCitationUnion) AsCharLocation() (v CitationCharLocation)
func (CitationsDeltaCitationUnion) AsContentBlockLocation ¶
func (u CitationsDeltaCitationUnion) AsContentBlockLocation() (v CitationContentBlockLocation)
func (CitationsDeltaCitationUnion) AsPageLocation ¶
func (u CitationsDeltaCitationUnion) AsPageLocation() (v CitationPageLocation)
func (CitationsDeltaCitationUnion) AsSearchResultLocation ¶ added in v1.8.0
func (u CitationsDeltaCitationUnion) AsSearchResultLocation() (v CitationsSearchResultLocation)
func (CitationsDeltaCitationUnion) AsWebSearchResultLocation ¶
func (u CitationsDeltaCitationUnion) AsWebSearchResultLocation() (v CitationsWebSearchResultLocation)
func (CitationsDeltaCitationUnion) RawJSON ¶
func (u CitationsDeltaCitationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationsDeltaCitationUnion) UnmarshalJSON ¶
func (r *CitationsDeltaCitationUnion) UnmarshalJSON(data []byte) error
type CitationsSearchResultLocation ¶ added in v1.8.0
type CitationsSearchResultLocation struct {
CitedText string `json:"cited_text" api:"required"`
EndBlockIndex int64 `json:"end_block_index" api:"required"`
SearchResultIndex int64 `json:"search_result_index" api:"required"`
Source string `json:"source" api:"required"`
StartBlockIndex int64 `json:"start_block_index" api:"required"`
Title string `json:"title" api:"required"`
Type constant.SearchResultLocation `json:"type" default:"search_result_location"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
EndBlockIndex respjson.Field
SearchResultIndex respjson.Field
Source respjson.Field
StartBlockIndex respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationsSearchResultLocation) RawJSON ¶ added in v1.8.0
func (r CitationsSearchResultLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationsSearchResultLocation) UnmarshalJSON ¶ added in v1.8.0
func (r *CitationsSearchResultLocation) UnmarshalJSON(data []byte) error
type CitationsWebSearchResultLocation ¶
type CitationsWebSearchResultLocation struct {
CitedText string `json:"cited_text" api:"required"`
EncryptedIndex string `json:"encrypted_index" api:"required"`
Title string `json:"title" api:"required"`
Type constant.WebSearchResultLocation `json:"type" default:"web_search_result_location"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CitedText respjson.Field
EncryptedIndex respjson.Field
Title respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CitationsWebSearchResultLocation) RawJSON ¶
func (r CitationsWebSearchResultLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*CitationsWebSearchResultLocation) UnmarshalJSON ¶
func (r *CitationsWebSearchResultLocation) UnmarshalJSON(data []byte) error
type Client ¶
type Client struct {
Options []option.RequestOption
Completions CompletionService
Messages MessageService
Models ModelService
Beta BetaService
}
Client creates a struct with services and top level methods that help with interacting with the anthropic API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type CodeExecutionOutputBlock ¶ added in v1.23.0
type CodeExecutionOutputBlock struct {
FileID string `json:"file_id" api:"required"`
Type constant.CodeExecutionOutput `json:"type" default:"code_execution_output"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CodeExecutionOutputBlock) RawJSON ¶ added in v1.23.0
func (r CodeExecutionOutputBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (CodeExecutionOutputBlock) ToParam ¶ added in v1.23.0
func (r CodeExecutionOutputBlock) ToParam() CodeExecutionOutputBlockParam
func (*CodeExecutionOutputBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionOutputBlock) UnmarshalJSON(data []byte) error
type CodeExecutionOutputBlockParam ¶ added in v1.23.0
type CodeExecutionOutputBlockParam struct {
FileID string `json:"file_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_output".
Type constant.CodeExecutionOutput `json:"type" default:"code_execution_output"`
// contains filtered or unexported fields
}
The properties FileID, Type are required.
func (CodeExecutionOutputBlockParam) MarshalJSON ¶ added in v1.23.0
func (r CodeExecutionOutputBlockParam) MarshalJSON() (data []byte, err error)
func (*CodeExecutionOutputBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionOutputBlockParam) UnmarshalJSON(data []byte) error
type CodeExecutionResultBlock ¶ added in v1.23.0
type CodeExecutionResultBlock struct {
Content []CodeExecutionOutputBlock `json:"content" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
Type constant.CodeExecutionResult `json:"type" default:"code_execution_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CodeExecutionResultBlock) RawJSON ¶ added in v1.23.0
func (r CodeExecutionResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeExecutionResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionResultBlock) UnmarshalJSON(data []byte) error
type CodeExecutionResultBlockParam ¶ added in v1.23.0
type CodeExecutionResultBlockParam struct {
Content []CodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Stdout string `json:"stdout" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_result".
Type constant.CodeExecutionResult `json:"type" default:"code_execution_result"`
// contains filtered or unexported fields
}
The properties Content, ReturnCode, Stderr, Stdout, Type are required.
func (CodeExecutionResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r CodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error)
func (*CodeExecutionResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error
type CodeExecutionTool20250522Param ¶ added in v1.23.0
type CodeExecutionTool20250522Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "code_execution".
Name constant.CodeExecution `json:"name" default:"code_execution"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20250522".
Type constant.CodeExecution20250522 `json:"type" default:"code_execution_20250522"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (CodeExecutionTool20250522Param) MarshalJSON ¶ added in v1.23.0
func (r CodeExecutionTool20250522Param) MarshalJSON() (data []byte, err error)
func (*CodeExecutionTool20250522Param) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionTool20250522Param) UnmarshalJSON(data []byte) error
type CodeExecutionTool20250825Param ¶ added in v1.23.0
type CodeExecutionTool20250825Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "code_execution".
Name constant.CodeExecution `json:"name" default:"code_execution"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20250825".
Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (CodeExecutionTool20250825Param) MarshalJSON ¶ added in v1.23.0
func (r CodeExecutionTool20250825Param) MarshalJSON() (data []byte, err error)
func (*CodeExecutionTool20250825Param) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionTool20250825Param) UnmarshalJSON(data []byte) error
type CodeExecutionTool20260120Param ¶ added in v1.24.0
type CodeExecutionTool20260120Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "code_execution".
Name constant.CodeExecution `json:"name" default:"code_execution"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20260120".
Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
// contains filtered or unexported fields
}
Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
The properties Name, Type are required.
func (CodeExecutionTool20260120Param) MarshalJSON ¶ added in v1.24.0
func (r CodeExecutionTool20260120Param) MarshalJSON() (data []byte, err error)
func (*CodeExecutionTool20260120Param) UnmarshalJSON ¶ added in v1.24.0
func (r *CodeExecutionTool20260120Param) UnmarshalJSON(data []byte) error
type CodeExecutionToolResultBlock ¶ added in v1.23.0
type CodeExecutionToolResultBlock struct {
// Code execution result with encrypted stdout for PFC + web_search results.
Content CodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.CodeExecutionToolResult `json:"type" default:"code_execution_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CodeExecutionToolResultBlock) RawJSON ¶ added in v1.23.0
func (r CodeExecutionToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (CodeExecutionToolResultBlock) ToParam ¶ added in v1.23.0
func (r CodeExecutionToolResultBlock) ToParam() CodeExecutionToolResultBlockParam
func (*CodeExecutionToolResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error
type CodeExecutionToolResultBlockContentUnion ¶ added in v1.23.0
type CodeExecutionToolResultBlockContentUnion struct {
// This field is from variant [CodeExecutionToolResultError].
ErrorCode CodeExecutionToolResultErrorCode `json:"error_code"`
Type string `json:"type"`
Content []CodeExecutionOutputBlock `json:"content"`
ReturnCode int64 `json:"return_code"`
Stderr string `json:"stderr"`
// This field is from variant [CodeExecutionResultBlock].
Stdout string `json:"stdout"`
// This field is from variant [EncryptedCodeExecutionResultBlock].
EncryptedStdout string `json:"encrypted_stdout"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
EncryptedStdout respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
CodeExecutionToolResultBlockContentUnion contains all possible properties and values from CodeExecutionToolResultError, CodeExecutionResultBlock, EncryptedCodeExecutionResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (CodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionResultBlock() (v CodeExecutionResultBlock)
func (CodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockContentUnion) AsResponseCodeExecutionToolResultError() (v CodeExecutionToolResultError)
func (CodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockContentUnion) AsResponseEncryptedCodeExecutionResultBlock() (v EncryptedCodeExecutionResultBlock)
func (CodeExecutionToolResultBlockContentUnion) RawJSON ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeExecutionToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type CodeExecutionToolResultBlockParam ¶ added in v1.23.0
type CodeExecutionToolResultBlockParam struct {
// Code execution result with encrypted stdout for PFC + web_search results.
Content CodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "code_execution_tool_result".
Type constant.CodeExecutionToolResult `json:"type" default:"code_execution_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (CodeExecutionToolResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r CodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*CodeExecutionToolResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error
type CodeExecutionToolResultBlockParamContentUnion ¶ added in v1.23.0
type CodeExecutionToolResultBlockParamContentUnion struct {
OfRequestCodeExecutionToolResultError *CodeExecutionToolResultErrorParam `json:",omitzero,inline"`
OfRequestCodeExecutionResultBlock *CodeExecutionResultBlockParam `json:",omitzero,inline"`
OfRequestEncryptedCodeExecutionResultBlock *EncryptedCodeExecutionResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func CodeExecutionToolResultBlockParamContentOfRequestCodeExecutionToolResultError ¶ added in v1.23.0
func CodeExecutionToolResultBlockParamContentOfRequestCodeExecutionToolResultError(errorCode CodeExecutionToolResultErrorCode) CodeExecutionToolResultBlockParamContentUnion
func (CodeExecutionToolResultBlockParamContentUnion) GetContent ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetContent() []CodeExecutionOutputBlockParam
Returns a pointer to the underlying variant's Content property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetEncryptedStdout() *string
Returns a pointer to the underlying variant's property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) GetReturnCode ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetReturnCode() *int64
Returns a pointer to the underlying variant's property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) GetStderr ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetStderr() *string
Returns a pointer to the underlying variant's property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) GetStdout ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetStdout() *string
Returns a pointer to the underlying variant's property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) GetType ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (CodeExecutionToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.23.0
func (u CodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*CodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *CodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type CodeExecutionToolResultError ¶ added in v1.23.0
type CodeExecutionToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode CodeExecutionToolResultErrorCode `json:"error_code" api:"required"`
Type constant.CodeExecutionToolResultError `json:"type" default:"code_execution_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CodeExecutionToolResultError) RawJSON ¶ added in v1.23.0
func (r CodeExecutionToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeExecutionToolResultError) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionToolResultError) UnmarshalJSON(data []byte) error
type CodeExecutionToolResultErrorCode ¶ added in v1.23.0
type CodeExecutionToolResultErrorCode string
const ( CodeExecutionToolResultErrorCodeInvalidToolInput CodeExecutionToolResultErrorCode = "invalid_tool_input" CodeExecutionToolResultErrorCodeTooManyRequests CodeExecutionToolResultErrorCode = "too_many_requests" CodeExecutionToolResultErrorCodeExecutionTimeExceeded CodeExecutionToolResultErrorCode = "execution_time_exceeded" )
type CodeExecutionToolResultErrorParam ¶ added in v1.23.0
type CodeExecutionToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode CodeExecutionToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_tool_result_error".
Type constant.CodeExecutionToolResultError `json:"type" default:"code_execution_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (CodeExecutionToolResultErrorParam) MarshalJSON ¶ added in v1.23.0
func (r CodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*CodeExecutionToolResultErrorParam) UnmarshalJSON ¶ added in v1.23.0
func (r *CodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error
type Completion ¶
type Completion struct {
// Unique object identifier.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// The resulting completion up to and excluding the stop sequences.
Completion string `json:"completion" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model" api:"required"`
// The reason that we stopped.
//
// This may be one the following values:
//
// - `"stop_sequence"`: we reached a stop sequence — either provided by you via the
// `stop_sequences` parameter, or a stop sequence built into the model
// - `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
StopReason string `json:"stop_reason" api:"required"`
// Object type.
//
// For Text Completions, this is always `"completion"`.
Type constant.Completion `json:"type" default:"completion"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Completion respjson.Field
Model respjson.Field
StopReason respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (Completion) RawJSON ¶
func (r Completion) RawJSON() string
Returns the unmodified JSON received from the API
func (*Completion) UnmarshalJSON ¶
func (r *Completion) UnmarshalJSON(data []byte) error
type CompletionNewParams ¶
type CompletionNewParams struct {
// The maximum number of tokens to generate before stopping.
//
// Note that our models may stop _before_ reaching this maximum. This parameter
// only specifies the absolute maximum number of tokens to generate.
MaxTokensToSample int64 `json:"max_tokens_to_sample" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// The prompt that you want Claude to complete.
//
// For proper response generation you will need to format your prompt using
// alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example:
//
// “`
// "\n\nHuman: {userQuestion}\n\nAssistant:"
// “`
//
// See [prompt validation](https://docs.claude.com/en/api/prompt-validation) and
// our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting)
// for more details.
Prompt string `json:"prompt" api:"required"`
// Amount of randomness injected into the response.
//
// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
// for analytical / multiple choice, and closer to `1.0` for creative and
// generative tasks.
//
// Note that even with `temperature` of `0.0`, the results will not be fully
// deterministic.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
// Only sample from the top K options for each subsequent token.
//
// Used to remove "long tail" low probability responses.
// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
//
// Recommended for advanced use cases only.
TopK param.Opt[int64] `json:"top_k,omitzero"`
// Use nucleus sampling.
//
// In nucleus sampling, we compute the cumulative distribution over all the options
// for each subsequent token in decreasing probability order and cut it off once it
// reaches a particular probability specified by `top_p`.
//
// Recommended for advanced use cases only.
TopP param.Opt[float64] `json:"top_p,omitzero"`
// An object describing metadata about the request.
Metadata MetadataParam `json:"metadata,omitzero"`
// Sequences that will cause the model to stop generating.
//
// Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
// sequences in the future. By providing the stop_sequences parameter, you may
// include additional strings that will cause the model to stop generating.
StopSequences []string `json:"stop_sequences,omitzero"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (CompletionNewParams) MarshalJSON ¶
func (r CompletionNewParams) MarshalJSON() (data []byte, err error)
func (*CompletionNewParams) UnmarshalJSON ¶
func (r *CompletionNewParams) UnmarshalJSON(data []byte) error
type CompletionService ¶
type CompletionService struct {
Options []option.RequestOption
}
CompletionService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCompletionService method instead.
func NewCompletionService ¶
func NewCompletionService(opts ...option.RequestOption) (r CompletionService)
NewCompletionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*CompletionService) New ¶
func (r *CompletionService) New(ctx context.Context, params CompletionNewParams, opts ...option.RequestOption) (res *Completion, err error)
[Legacy] Create a Text Completion.
The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward.
Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages.
Note: If you choose to set a timeout for this request, we recommend 10 minutes.
func (*CompletionService) NewStreaming ¶
func (r *CompletionService) NewStreaming(ctx context.Context, params CompletionNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[Completion])
[Legacy] Create a Text Completion.
The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward.
Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages.
Note: If you choose to set a timeout for this request, we recommend 10 minutes.
type Container ¶ added in v1.23.0
type Container struct {
// Identifier for the container used in this request
ID string `json:"id" api:"required"`
// The time at which the container will expire.
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ExpiresAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Information about the container used in the request (for the code execution tool)
func (*Container) UnmarshalJSON ¶ added in v1.23.0
type ContainerUploadBlock ¶ added in v1.23.0
type ContainerUploadBlock struct {
FileID string `json:"file_id" api:"required"`
Type constant.ContainerUpload `json:"type" default:"container_upload"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response model for a file uploaded to the container.
func (ContainerUploadBlock) RawJSON ¶ added in v1.23.0
func (r ContainerUploadBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ContainerUploadBlock) ToParam ¶ added in v1.23.0
func (r ContainerUploadBlock) ToParam() ContainerUploadBlockParam
func (*ContainerUploadBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *ContainerUploadBlock) UnmarshalJSON(data []byte) error
type ContainerUploadBlockParam ¶ added in v1.23.0
type ContainerUploadBlockParam struct {
FileID string `json:"file_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "container_upload".
Type constant.ContainerUpload `json:"type" default:"container_upload"`
// contains filtered or unexported fields
}
A content block that represents a file to be uploaded to the container Files uploaded via this block will be available in the container's input directory.
The properties FileID, Type are required.
func (ContainerUploadBlockParam) MarshalJSON ¶ added in v1.23.0
func (r ContainerUploadBlockParam) MarshalJSON() (data []byte, err error)
func (*ContainerUploadBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *ContainerUploadBlockParam) UnmarshalJSON(data []byte) error
type ContentBlockDeltaEvent ¶
type ContentBlockDeltaEvent struct {
Delta RawContentBlockDeltaUnion `json:"delta" api:"required"`
Index int64 `json:"index" api:"required"`
Type constant.ContentBlockDelta `json:"type" default:"content_block_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Delta respjson.Field
Index respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContentBlockDeltaEvent) RawJSON ¶
func (r ContentBlockDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContentBlockDeltaEvent) UnmarshalJSON ¶
func (r *ContentBlockDeltaEvent) UnmarshalJSON(data []byte) error
type ContentBlockParamUnion ¶
type ContentBlockParamUnion struct {
OfText *TextBlockParam `json:",omitzero,inline"`
OfImage *ImageBlockParam `json:",omitzero,inline"`
OfDocument *DocumentBlockParam `json:",omitzero,inline"`
OfSearchResult *SearchResultBlockParam `json:",omitzero,inline"`
OfThinking *ThinkingBlockParam `json:",omitzero,inline"`
OfRedactedThinking *RedactedThinkingBlockParam `json:",omitzero,inline"`
OfToolUse *ToolUseBlockParam `json:",omitzero,inline"`
OfToolResult *ToolResultBlockParam `json:",omitzero,inline"`
OfServerToolUse *ServerToolUseBlockParam `json:",omitzero,inline"`
OfWebSearchToolResult *WebSearchToolResultBlockParam `json:",omitzero,inline"`
OfWebFetchToolResult *WebFetchToolResultBlockParam `json:",omitzero,inline"`
OfCodeExecutionToolResult *CodeExecutionToolResultBlockParam `json:",omitzero,inline"`
OfBashCodeExecutionToolResult *BashCodeExecutionToolResultBlockParam `json:",omitzero,inline"`
OfTextEditorCodeExecutionToolResult *TextEditorCodeExecutionToolResultBlockParam `json:",omitzero,inline"`
OfToolSearchToolResult *ToolSearchToolResultBlockParam `json:",omitzero,inline"`
OfContainerUpload *ContainerUploadBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func NewBashCodeExecutionToolResultBlock ¶ added in v1.23.0
func NewBashCodeExecutionToolResultBlock[ T BashCodeExecutionToolResultErrorParam | BashCodeExecutionResultBlockParam, ](content T, toolUseID string) ContentBlockParamUnion
func NewCodeExecutionToolResultBlock ¶ added in v1.23.0
func NewCodeExecutionToolResultBlock[ T CodeExecutionToolResultErrorParam | CodeExecutionResultBlockParam | EncryptedCodeExecutionResultBlockParam, ](content T, toolUseID string) ContentBlockParamUnion
func NewContainerUploadBlock ¶ added in v1.23.0
func NewContainerUploadBlock(fileID string) ContentBlockParamUnion
func NewDocumentBlock ¶
func NewDocumentBlock[ T Base64PDFSourceParam | PlainTextSourceParam | ContentBlockSourceParam | URLPDFSourceParam, ](source T) ContentBlockParamUnion
func NewImageBlock ¶
func NewImageBlock[T Base64ImageSourceParam | URLImageSourceParam](source T) ContentBlockParamUnion
func NewImageBlockBase64 ¶
func NewImageBlockBase64(mediaType string, encodedData string) ContentBlockParamUnion
func NewRedactedThinkingBlock ¶
func NewRedactedThinkingBlock(data string) ContentBlockParamUnion
func NewSearchResultBlock ¶ added in v1.8.0
func NewSearchResultBlock(content []TextBlockParam, source string, title string) ContentBlockParamUnion
func NewServerToolUseBlock ¶
func NewServerToolUseBlock(id string, input any, name ServerToolUseBlockParamName) ContentBlockParamUnion
func NewTextBlock ¶
func NewTextBlock(text string) ContentBlockParamUnion
func NewTextEditorCodeExecutionToolResultBlock ¶ added in v1.23.0
func NewTextEditorCodeExecutionToolResultBlock[ T TextEditorCodeExecutionToolResultErrorParam | TextEditorCodeExecutionViewResultBlockParam | TextEditorCodeExecutionCreateResultBlockParam | TextEditorCodeExecutionStrReplaceResultBlockParam, ](content T, toolUseID string) ContentBlockParamUnion
func NewThinkingBlock ¶
func NewThinkingBlock(signature string, thinking string) ContentBlockParamUnion
func NewToolResultBlock ¶
func NewToolResultBlock(toolUseID string, content string, isError bool) ContentBlockParamUnion
func NewToolSearchToolResultBlock ¶ added in v1.23.0
func NewToolSearchToolResultBlock[ T ToolSearchToolResultErrorParam | ToolSearchToolSearchResultBlockParam, ](content T, toolUseID string) ContentBlockParamUnion
func NewToolUseBlock ¶
func NewToolUseBlock(id string, input any, name string) ContentBlockParamUnion
func NewWebFetchToolResultBlock ¶ added in v1.23.0
func NewWebFetchToolResultBlock[ T WebFetchToolResultErrorBlockParam | WebFetchBlockParam, ](content T, toolUseID string) ContentBlockParamUnion
func NewWebSearchToolResultBlock ¶
func NewWebSearchToolResultBlock[ T []WebSearchResultBlockParam | WebSearchToolRequestErrorParam, ](content T, toolUseID string) ContentBlockParamUnion
func (ContentBlockParamUnion) GetCacheControl ¶
func (u ContentBlockParamUnion) GetCacheControl() *CacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (ContentBlockParamUnion) GetCaller ¶ added in v1.23.0
func (u ContentBlockParamUnion) GetCaller() (res contentBlockParamUnionCaller)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ContentBlockParamUnion) GetCitations ¶
func (u ContentBlockParamUnion) GetCitations() (res contentBlockParamUnionCitations)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ContentBlockParamUnion) GetContent ¶
func (u ContentBlockParamUnion) GetContent() (res contentBlockParamUnionContent)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ContentBlockParamUnion) GetContext ¶
func (u ContentBlockParamUnion) GetContext() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetData ¶
func (u ContentBlockParamUnion) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetFileID ¶ added in v1.23.0
func (u ContentBlockParamUnion) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetID ¶
func (u ContentBlockParamUnion) GetID() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetInput ¶
func (u ContentBlockParamUnion) GetInput() *any
Returns a pointer to the underlying variant's Input property, if present.
func (ContentBlockParamUnion) GetIsError ¶
func (u ContentBlockParamUnion) GetIsError() *bool
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetName ¶
func (u ContentBlockParamUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetSignature ¶
func (u ContentBlockParamUnion) GetSignature() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetSource ¶
func (u ContentBlockParamUnion) GetSource() (res contentBlockParamUnionSource)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ContentBlockParamUnion) GetText ¶
func (u ContentBlockParamUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetThinking ¶
func (u ContentBlockParamUnion) GetThinking() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetTitle ¶
func (u ContentBlockParamUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetToolUseID ¶
func (u ContentBlockParamUnion) GetToolUseID() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) GetType ¶
func (u ContentBlockParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockParamUnion) MarshalJSON ¶
func (u ContentBlockParamUnion) MarshalJSON() ([]byte, error)
func (*ContentBlockParamUnion) UnmarshalJSON ¶
func (u *ContentBlockParamUnion) UnmarshalJSON(data []byte) error
type ContentBlockSourceContentItemUnionParam ¶ added in v1.11.0
type ContentBlockSourceContentItemUnionParam struct {
OfText *TextBlockParam `json:",omitzero,inline"`
OfImage *ImageBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ContentBlockSourceContentItemParamOfImage ¶ added in v1.11.0
func ContentBlockSourceContentItemParamOfImage[T Base64ImageSourceParam | URLImageSourceParam](source T) ContentBlockSourceContentItemUnionParam
func ContentBlockSourceContentItemParamOfText ¶ added in v1.11.0
func ContentBlockSourceContentItemParamOfText(text string) ContentBlockSourceContentItemUnionParam
func (ContentBlockSourceContentItemUnionParam) GetCacheControl ¶ added in v1.11.0
func (u ContentBlockSourceContentItemUnionParam) GetCacheControl() *CacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (ContentBlockSourceContentItemUnionParam) GetCitations ¶ added in v1.11.0
func (u ContentBlockSourceContentItemUnionParam) GetCitations() []TextCitationParamUnion
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockSourceContentItemUnionParam) GetSource ¶ added in v1.11.0
func (u ContentBlockSourceContentItemUnionParam) GetSource() *ImageBlockParamSourceUnion
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockSourceContentItemUnionParam) GetText ¶ added in v1.11.0
func (u ContentBlockSourceContentItemUnionParam) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockSourceContentItemUnionParam) GetType ¶ added in v1.11.0
func (u ContentBlockSourceContentItemUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ContentBlockSourceContentItemUnionParam) MarshalJSON ¶ added in v1.11.0
func (u ContentBlockSourceContentItemUnionParam) MarshalJSON() ([]byte, error)
func (*ContentBlockSourceContentItemUnionParam) UnmarshalJSON ¶ added in v1.11.0
func (u *ContentBlockSourceContentItemUnionParam) UnmarshalJSON(data []byte) error
type ContentBlockSourceContentUnionParam ¶
type ContentBlockSourceContentUnionParam struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfContentBlockSourceContent []ContentBlockSourceContentItemUnionParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ContentBlockSourceContentUnionParam) MarshalJSON ¶
func (u ContentBlockSourceContentUnionParam) MarshalJSON() ([]byte, error)
func (*ContentBlockSourceContentUnionParam) UnmarshalJSON ¶
func (u *ContentBlockSourceContentUnionParam) UnmarshalJSON(data []byte) error
type ContentBlockSourceParam ¶
type ContentBlockSourceParam struct {
Content ContentBlockSourceContentUnionParam `json:"content,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as "content".
Type constant.Content `json:"type" default:"content"`
// contains filtered or unexported fields
}
The properties Content, Type are required.
func (ContentBlockSourceParam) MarshalJSON ¶
func (r ContentBlockSourceParam) MarshalJSON() (data []byte, err error)
func (*ContentBlockSourceParam) UnmarshalJSON ¶
func (r *ContentBlockSourceParam) UnmarshalJSON(data []byte) error
type ContentBlockStartEvent ¶
type ContentBlockStartEvent struct {
// Response model for a file uploaded to the container.
ContentBlock ContentBlockStartEventContentBlockUnion `json:"content_block" api:"required"`
Index int64 `json:"index" api:"required"`
Type constant.ContentBlockStart `json:"type" default:"content_block_start"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ContentBlock respjson.Field
Index respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContentBlockStartEvent) RawJSON ¶
func (r ContentBlockStartEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContentBlockStartEvent) UnmarshalJSON ¶
func (r *ContentBlockStartEvent) UnmarshalJSON(data []byte) error
type ContentBlockStartEventContentBlockUnion ¶
type ContentBlockStartEventContentBlockUnion struct {
// This field is from variant [TextBlock].
Citations []TextCitationUnion `json:"citations"`
// This field is from variant [TextBlock].
Text string `json:"text"`
// Any of "text", "thinking", "redacted_thinking", "tool_use", "server_tool_use",
// "web_search_tool_result", "web_fetch_tool_result", "code_execution_tool_result",
// "bash_code_execution_tool_result", "text_editor_code_execution_tool_result",
// "tool_search_tool_result", "container_upload".
Type string `json:"type"`
// This field is from variant [ThinkingBlock].
Signature string `json:"signature"`
// This field is from variant [ThinkingBlock].
Thinking string `json:"thinking"`
// This field is from variant [RedactedThinkingBlock].
Data string `json:"data"`
ID string `json:"id"`
// This field is a union of [ToolUseBlockCallerUnion],
// [ServerToolUseBlockCallerUnion], [WebSearchToolResultBlockCallerUnion],
// [WebFetchToolResultBlockCallerUnion]
Caller ContentBlockStartEventContentBlockUnionCaller `json:"caller"`
Input any `json:"input"`
Name string `json:"name"`
// This field is a union of [WebSearchToolResultBlockContentUnion],
// [WebFetchToolResultBlockContentUnion],
// [CodeExecutionToolResultBlockContentUnion],
// [BashCodeExecutionToolResultBlockContentUnion],
// [TextEditorCodeExecutionToolResultBlockContentUnion],
// [ToolSearchToolResultBlockContentUnion]
Content ContentBlockStartEventContentBlockUnionContent `json:"content"`
ToolUseID string `json:"tool_use_id"`
// This field is from variant [ContainerUploadBlock].
FileID string `json:"file_id"`
JSON struct {
Citations respjson.Field
Text respjson.Field
Type respjson.Field
Signature respjson.Field
Thinking respjson.Field
Data respjson.Field
ID respjson.Field
Caller respjson.Field
Input respjson.Field
Name respjson.Field
Content respjson.Field
ToolUseID respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockStartEventContentBlockUnion contains all possible properties and values from TextBlock, ThinkingBlock, RedactedThinkingBlock, ToolUseBlock, ServerToolUseBlock, WebSearchToolResultBlock, WebFetchToolResultBlock, CodeExecutionToolResultBlock, BashCodeExecutionToolResultBlock, TextEditorCodeExecutionToolResultBlock, ToolSearchToolResultBlock, ContainerUploadBlock.
Use the ContentBlockStartEventContentBlockUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ContentBlockStartEventContentBlockUnion) AsAny ¶
func (u ContentBlockStartEventContentBlockUnion) AsAny() anyContentBlockStartEventContentBlock
Use the following switch statement to find the correct variant
switch variant := ContentBlockStartEventContentBlockUnion.AsAny().(type) {
case anthropic.TextBlock:
case anthropic.ThinkingBlock:
case anthropic.RedactedThinkingBlock:
case anthropic.ToolUseBlock:
case anthropic.ServerToolUseBlock:
case anthropic.WebSearchToolResultBlock:
case anthropic.WebFetchToolResultBlock:
case anthropic.CodeExecutionToolResultBlock:
case anthropic.BashCodeExecutionToolResultBlock:
case anthropic.TextEditorCodeExecutionToolResultBlock:
case anthropic.ToolSearchToolResultBlock:
case anthropic.ContainerUploadBlock:
default:
fmt.Errorf("no variant present")
}
func (ContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult ¶ added in v1.23.0
func (u ContentBlockStartEventContentBlockUnion) AsBashCodeExecutionToolResult() (v BashCodeExecutionToolResultBlock)
func (ContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult ¶ added in v1.23.0
func (u ContentBlockStartEventContentBlockUnion) AsCodeExecutionToolResult() (v CodeExecutionToolResultBlock)
func (ContentBlockStartEventContentBlockUnion) AsContainerUpload ¶ added in v1.23.0
func (u ContentBlockStartEventContentBlockUnion) AsContainerUpload() (v ContainerUploadBlock)
func (ContentBlockStartEventContentBlockUnion) AsRedactedThinking ¶
func (u ContentBlockStartEventContentBlockUnion) AsRedactedThinking() (v RedactedThinkingBlock)
func (ContentBlockStartEventContentBlockUnion) AsServerToolUse ¶
func (u ContentBlockStartEventContentBlockUnion) AsServerToolUse() (v ServerToolUseBlock)
func (ContentBlockStartEventContentBlockUnion) AsText ¶
func (u ContentBlockStartEventContentBlockUnion) AsText() (v TextBlock)
func (ContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult ¶ added in v1.23.0
func (u ContentBlockStartEventContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v TextEditorCodeExecutionToolResultBlock)
func (ContentBlockStartEventContentBlockUnion) AsThinking ¶
func (u ContentBlockStartEventContentBlockUnion) AsThinking() (v ThinkingBlock)
func (ContentBlockStartEventContentBlockUnion) AsToolSearchToolResult ¶ added in v1.23.0
func (u ContentBlockStartEventContentBlockUnion) AsToolSearchToolResult() (v ToolSearchToolResultBlock)
func (ContentBlockStartEventContentBlockUnion) AsToolUse ¶
func (u ContentBlockStartEventContentBlockUnion) AsToolUse() (v ToolUseBlock)
func (ContentBlockStartEventContentBlockUnion) AsWebFetchToolResult ¶ added in v1.23.0
func (u ContentBlockStartEventContentBlockUnion) AsWebFetchToolResult() (v WebFetchToolResultBlock)
func (ContentBlockStartEventContentBlockUnion) AsWebSearchToolResult ¶
func (u ContentBlockStartEventContentBlockUnion) AsWebSearchToolResult() (v WebSearchToolResultBlock)
func (ContentBlockStartEventContentBlockUnion) RawJSON ¶
func (u ContentBlockStartEventContentBlockUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContentBlockStartEventContentBlockUnion) UnmarshalJSON ¶
func (r *ContentBlockStartEventContentBlockUnion) UnmarshalJSON(data []byte) error
type ContentBlockStartEventContentBlockUnionCaller ¶ added in v1.23.0
type ContentBlockStartEventContentBlockUnionCaller struct {
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockStartEventContentBlockUnionCaller is an implicit subunion of ContentBlockStartEventContentBlockUnion. ContentBlockStartEventContentBlockUnionCaller provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ContentBlockStartEventContentBlockUnion.
func (*ContentBlockStartEventContentBlockUnionCaller) UnmarshalJSON ¶ added in v1.23.0
func (r *ContentBlockStartEventContentBlockUnionCaller) UnmarshalJSON(data []byte) error
type ContentBlockStartEventContentBlockUnionContent ¶ added in v1.23.0
type ContentBlockStartEventContentBlockUnionContent struct {
// This field will be present if the value is a [[]WebSearchResultBlock] instead of
// an object.
OfWebSearchResultBlockArray []WebSearchResultBlock `json:",inline"`
ErrorCode string `json:"error_code"`
Type string `json:"type"`
// This field is a union of [DocumentBlock], [[]CodeExecutionOutputBlock],
// [[]CodeExecutionOutputBlock], [[]BashCodeExecutionOutputBlock], [string]
Content ContentBlockStartEventContentBlockUnionContentContent `json:"content"`
// This field is from variant [WebFetchToolResultBlockContentUnion].
RetrievedAt string `json:"retrieved_at"`
// This field is from variant [WebFetchToolResultBlockContentUnion].
URL string `json:"url"`
ReturnCode int64 `json:"return_code"`
Stderr string `json:"stderr"`
Stdout string `json:"stdout"`
// This field is from variant [CodeExecutionToolResultBlockContentUnion].
EncryptedStdout string `json:"encrypted_stdout"`
ErrorMessage string `json:"error_message"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
FileType TextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
NumLines int64 `json:"num_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
StartLine int64 `json:"start_line"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
TotalLines int64 `json:"total_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
IsFileUpdate bool `json:"is_file_update"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
Lines []string `json:"lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
NewLines int64 `json:"new_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
NewStart int64 `json:"new_start"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
OldLines int64 `json:"old_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
OldStart int64 `json:"old_start"`
// This field is from variant [ToolSearchToolResultBlockContentUnion].
ToolReferences []ToolReferenceBlock `json:"tool_references"`
JSON struct {
OfWebSearchResultBlockArray respjson.Field
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
RetrievedAt respjson.Field
URL respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
EncryptedStdout respjson.Field
ErrorMessage respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
IsFileUpdate respjson.Field
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
ToolReferences respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockStartEventContentBlockUnionContent is an implicit subunion of ContentBlockStartEventContentBlockUnion. ContentBlockStartEventContentBlockUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ContentBlockStartEventContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfWebSearchResultBlockArray]
func (*ContentBlockStartEventContentBlockUnionContent) UnmarshalJSON ¶ added in v1.23.0
func (r *ContentBlockStartEventContentBlockUnionContent) UnmarshalJSON(data []byte) error
type ContentBlockStartEventContentBlockUnionContentContent ¶ added in v1.23.0
type ContentBlockStartEventContentBlockUnionContentContent struct {
// This field will be present if the value is a [[]CodeExecutionOutputBlock]
// instead of an object.
OfContent []CodeExecutionOutputBlock `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [DocumentBlock].
Citations CitationsConfig `json:"citations"`
// This field is from variant [DocumentBlock].
Source DocumentBlockSourceUnion `json:"source"`
// This field is from variant [DocumentBlock].
Title string `json:"title"`
// This field is from variant [DocumentBlock].
Type constant.Document `json:"type"`
JSON struct {
OfContent respjson.Field
OfString respjson.Field
Citations respjson.Field
Source respjson.Field
Title respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockStartEventContentBlockUnionContentContent is an implicit subunion of ContentBlockStartEventContentBlockUnion. ContentBlockStartEventContentBlockUnionContentContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ContentBlockStartEventContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfContent OfString]
func (*ContentBlockStartEventContentBlockUnionContentContent) UnmarshalJSON ¶ added in v1.23.0
func (r *ContentBlockStartEventContentBlockUnionContentContent) UnmarshalJSON(data []byte) error
type ContentBlockStopEvent ¶
type ContentBlockStopEvent struct {
Index int64 `json:"index" api:"required"`
Type constant.ContentBlockStop `json:"type" default:"content_block_stop"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Index respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ContentBlockStopEvent) RawJSON ¶
func (r ContentBlockStopEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContentBlockStopEvent) UnmarshalJSON ¶
func (r *ContentBlockStopEvent) UnmarshalJSON(data []byte) error
type ContentBlockUnion ¶
type ContentBlockUnion struct {
// This field is from variant [TextBlock].
Citations []TextCitationUnion `json:"citations"`
// This field is from variant [TextBlock].
Text string `json:"text"`
// Any of "text", "thinking", "redacted_thinking", "tool_use", "server_tool_use",
// "web_search_tool_result", "web_fetch_tool_result", "code_execution_tool_result",
// "bash_code_execution_tool_result", "text_editor_code_execution_tool_result",
// "tool_search_tool_result", "container_upload".
Type string `json:"type"`
// This field is from variant [ThinkingBlock].
Signature string `json:"signature"`
// This field is from variant [ThinkingBlock].
Thinking string `json:"thinking"`
// This field is from variant [RedactedThinkingBlock].
Data string `json:"data"`
ID string `json:"id"`
// necessary custom code modification
Input json.RawMessage `json:"input"`
Name string `json:"name"`
// This field is from variant [WebSearchToolResultBlock].
Content WebSearchToolResultBlockContentUnion `json:"content"`
// This field is from variant [WebSearchToolResultBlock].
ToolUseID string `json:"tool_use_id"`
JSON struct {
Citations respjson.Field
Text respjson.Field
Type respjson.Field
Signature respjson.Field
Thinking respjson.Field
Data respjson.Field
ID respjson.Field
Caller respjson.Field
Input respjson.Field
Name respjson.Field
Content respjson.Field
ToolUseID respjson.Field
FileID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockUnion contains all possible properties and values from TextBlock, ThinkingBlock, RedactedThinkingBlock, ToolUseBlock, ServerToolUseBlock, WebSearchToolResultBlock, WebFetchToolResultBlock, CodeExecutionToolResultBlock, BashCodeExecutionToolResultBlock, TextEditorCodeExecutionToolResultBlock, ToolSearchToolResultBlock, ContainerUploadBlock.
Use the ContentBlockUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ContentBlockUnion) AsAny ¶
func (u ContentBlockUnion) AsAny() anyContentBlock
Use the following switch statement to find the correct variant
switch variant := ContentBlockUnion.AsAny().(type) {
case anthropic.TextBlock:
case anthropic.ThinkingBlock:
case anthropic.RedactedThinkingBlock:
case anthropic.ToolUseBlock:
case anthropic.ServerToolUseBlock:
case anthropic.WebSearchToolResultBlock:
case anthropic.WebFetchToolResultBlock:
case anthropic.CodeExecutionToolResultBlock:
case anthropic.BashCodeExecutionToolResultBlock:
case anthropic.TextEditorCodeExecutionToolResultBlock:
case anthropic.ToolSearchToolResultBlock:
case anthropic.ContainerUploadBlock:
default:
fmt.Errorf("no variant present")
}
func (ContentBlockUnion) AsBashCodeExecutionToolResult ¶ added in v1.23.0
func (u ContentBlockUnion) AsBashCodeExecutionToolResult() (v BashCodeExecutionToolResultBlock)
func (ContentBlockUnion) AsCodeExecutionToolResult ¶ added in v1.23.0
func (u ContentBlockUnion) AsCodeExecutionToolResult() (v CodeExecutionToolResultBlock)
func (ContentBlockUnion) AsContainerUpload ¶ added in v1.23.0
func (u ContentBlockUnion) AsContainerUpload() (v ContainerUploadBlock)
func (ContentBlockUnion) AsRedactedThinking ¶
func (u ContentBlockUnion) AsRedactedThinking() (v RedactedThinkingBlock)
func (ContentBlockUnion) AsServerToolUse ¶
func (u ContentBlockUnion) AsServerToolUse() (v ServerToolUseBlock)
func (ContentBlockUnion) AsText ¶
func (u ContentBlockUnion) AsText() (v TextBlock)
func (ContentBlockUnion) AsTextEditorCodeExecutionToolResult ¶ added in v1.23.0
func (u ContentBlockUnion) AsTextEditorCodeExecutionToolResult() (v TextEditorCodeExecutionToolResultBlock)
func (ContentBlockUnion) AsThinking ¶
func (u ContentBlockUnion) AsThinking() (v ThinkingBlock)
func (ContentBlockUnion) AsToolSearchToolResult ¶ added in v1.23.0
func (u ContentBlockUnion) AsToolSearchToolResult() (v ToolSearchToolResultBlock)
func (ContentBlockUnion) AsToolUse ¶
func (u ContentBlockUnion) AsToolUse() (v ToolUseBlock)
func (ContentBlockUnion) AsWebFetchToolResult ¶ added in v1.23.0
func (u ContentBlockUnion) AsWebFetchToolResult() (v WebFetchToolResultBlock)
func (ContentBlockUnion) AsWebSearchToolResult ¶
func (u ContentBlockUnion) AsWebSearchToolResult() (v WebSearchToolResultBlock)
func (ContentBlockUnion) RawJSON ¶
func (u ContentBlockUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (ContentBlockUnion) ToParam ¶
func (r ContentBlockUnion) ToParam() ContentBlockParamUnion
func (*ContentBlockUnion) UnmarshalJSON ¶
func (r *ContentBlockUnion) UnmarshalJSON(data []byte) error
type ContentBlockUnionCaller ¶ added in v1.23.0
type ContentBlockUnionCaller struct {
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockUnionCaller is an implicit subunion of ContentBlockUnion. ContentBlockUnionCaller provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ContentBlockUnion.
func (*ContentBlockUnionCaller) UnmarshalJSON ¶ added in v1.23.0
func (r *ContentBlockUnionCaller) UnmarshalJSON(data []byte) error
type ContentBlockUnionContent ¶ added in v1.23.0
type ContentBlockUnionContent struct {
// This field will be present if the value is a [[]WebSearchResultBlock] instead of
// an object.
OfWebSearchResultBlockArray []WebSearchResultBlock `json:",inline"`
ErrorCode string `json:"error_code"`
Type string `json:"type"`
// This field is a union of [DocumentBlock], [[]CodeExecutionOutputBlock],
// [[]CodeExecutionOutputBlock], [[]BashCodeExecutionOutputBlock], [string]
Content ContentBlockUnionContentContent `json:"content"`
// This field is from variant [WebFetchToolResultBlockContentUnion].
RetrievedAt string `json:"retrieved_at"`
// This field is from variant [WebFetchToolResultBlockContentUnion].
URL string `json:"url"`
ReturnCode int64 `json:"return_code"`
Stderr string `json:"stderr"`
Stdout string `json:"stdout"`
// This field is from variant [CodeExecutionToolResultBlockContentUnion].
EncryptedStdout string `json:"encrypted_stdout"`
ErrorMessage string `json:"error_message"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
FileType TextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
NumLines int64 `json:"num_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
StartLine int64 `json:"start_line"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
TotalLines int64 `json:"total_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
IsFileUpdate bool `json:"is_file_update"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
Lines []string `json:"lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
NewLines int64 `json:"new_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
NewStart int64 `json:"new_start"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
OldLines int64 `json:"old_lines"`
// This field is from variant [TextEditorCodeExecutionToolResultBlockContentUnion].
OldStart int64 `json:"old_start"`
// This field is from variant [ToolSearchToolResultBlockContentUnion].
ToolReferences []ToolReferenceBlock `json:"tool_references"`
JSON struct {
OfWebSearchResultBlockArray respjson.Field
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
RetrievedAt respjson.Field
URL respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Stdout respjson.Field
EncryptedStdout respjson.Field
ErrorMessage respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
IsFileUpdate respjson.Field
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
ToolReferences respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockUnionContent is an implicit subunion of ContentBlockUnion. ContentBlockUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfWebSearchResultBlockArray]
func (*ContentBlockUnionContent) UnmarshalJSON ¶ added in v1.23.0
func (r *ContentBlockUnionContent) UnmarshalJSON(data []byte) error
type ContentBlockUnionContentContent ¶ added in v1.23.0
type ContentBlockUnionContentContent struct {
// This field will be present if the value is a [[]CodeExecutionOutputBlock]
// instead of an object.
OfContent []CodeExecutionOutputBlock `json:",inline"`
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [DocumentBlock].
Citations CitationsConfig `json:"citations"`
// This field is from variant [DocumentBlock].
Source DocumentBlockSourceUnion `json:"source"`
// This field is from variant [DocumentBlock].
Title string `json:"title"`
// This field is from variant [DocumentBlock].
Type constant.Document `json:"type"`
JSON struct {
OfContent respjson.Field
OfString respjson.Field
Citations respjson.Field
Source respjson.Field
Title respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ContentBlockUnionContentContent is an implicit subunion of ContentBlockUnion. ContentBlockUnionContentContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ContentBlockUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfContent OfString]
func (*ContentBlockUnionContentContent) UnmarshalJSON ¶ added in v1.23.0
func (r *ContentBlockUnionContentContent) UnmarshalJSON(data []byte) error
type ContextManagementCapability ¶ added in v1.27.1
type ContextManagementCapability struct {
// Indicates whether a capability is supported.
ClearThinking20251015 CapabilitySupport `json:"clear_thinking_20251015" api:"required"`
// Indicates whether a capability is supported.
ClearToolUses20250919 CapabilitySupport `json:"clear_tool_uses_20250919" api:"required"`
// Indicates whether a capability is supported.
Compact20260112 CapabilitySupport `json:"compact_20260112" api:"required"`
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClearThinking20251015 respjson.Field
ClearToolUses20250919 respjson.Field
Compact20260112 respjson.Field
Supported respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Context management capability details.
func (ContextManagementCapability) RawJSON ¶ added in v1.27.1
func (r ContextManagementCapability) RawJSON() string
Returns the unmodified JSON received from the API
func (*ContextManagementCapability) UnmarshalJSON ¶ added in v1.27.1
func (r *ContextManagementCapability) UnmarshalJSON(data []byte) error
type DeletedFile ¶ added in v1.2.0
type DeletedFile struct {
// ID of the deleted file.
ID string `json:"id" api:"required"`
// Deleted object type.
//
// For file deletion, this is always `"file_deleted"`.
//
// Any of "file_deleted".
Type DeletedFileType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (DeletedFile) RawJSON ¶ added in v1.2.0
func (r DeletedFile) RawJSON() string
Returns the unmodified JSON received from the API
func (*DeletedFile) UnmarshalJSON ¶ added in v1.2.0
func (r *DeletedFile) UnmarshalJSON(data []byte) error
type DeletedFileType ¶ added in v1.2.0
type DeletedFileType string
Deleted object type.
For file deletion, this is always `"file_deleted"`.
const (
DeletedFileTypeFileDeleted DeletedFileType = "file_deleted"
)
type DeletedMessageBatch ¶
type DeletedMessageBatch struct {
// ID of the Message Batch.
ID string `json:"id" api:"required"`
// Deleted object type.
//
// For Message Batches, this is always `"message_batch_deleted"`.
Type constant.MessageBatchDeleted `json:"type" default:"message_batch_deleted"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (DeletedMessageBatch) RawJSON ¶
func (r DeletedMessageBatch) RawJSON() string
Returns the unmodified JSON received from the API
func (*DeletedMessageBatch) UnmarshalJSON ¶
func (r *DeletedMessageBatch) UnmarshalJSON(data []byte) error
type DirectCaller ¶ added in v1.23.0
type DirectCaller struct {
Type constant.Direct `json:"type" default:"direct"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Tool invocation directly from the model.
func (DirectCaller) RawJSON ¶ added in v1.23.0
func (r DirectCaller) RawJSON() string
Returns the unmodified JSON received from the API
func (DirectCaller) ToParam ¶ added in v1.23.0
func (r DirectCaller) ToParam() DirectCallerParam
ToParam converts this DirectCaller to a DirectCallerParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with DirectCallerParam.Overrides()
func (*DirectCaller) UnmarshalJSON ¶ added in v1.23.0
func (r *DirectCaller) UnmarshalJSON(data []byte) error
type DirectCallerParam ¶ added in v1.23.0
type DirectCallerParam struct {
Type constant.Direct `json:"type" default:"direct"`
// contains filtered or unexported fields
}
Tool invocation directly from the model.
This struct has a constant value, construct it with NewDirectCallerParam.
func NewDirectCallerParam ¶ added in v1.23.0
func NewDirectCallerParam() DirectCallerParam
func (DirectCallerParam) MarshalJSON ¶ added in v1.23.0
func (r DirectCallerParam) MarshalJSON() (data []byte, err error)
func (*DirectCallerParam) UnmarshalJSON ¶ added in v1.23.0
func (r *DirectCallerParam) UnmarshalJSON(data []byte) error
type DocumentBlock ¶ added in v1.23.0
type DocumentBlock struct {
// Citation configuration for the document
Citations CitationsConfig `json:"citations" api:"required"`
Source DocumentBlockSourceUnion `json:"source" api:"required"`
// The title of the document
Title string `json:"title" api:"required"`
Type constant.Document `json:"type" default:"document"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Citations respjson.Field
Source respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (DocumentBlock) RawJSON ¶ added in v1.23.0
func (r DocumentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*DocumentBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *DocumentBlock) UnmarshalJSON(data []byte) error
type DocumentBlockParam ¶
type DocumentBlockParam struct {
Source DocumentBlockParamSourceUnion `json:"source,omitzero" api:"required"`
Context param.Opt[string] `json:"context,omitzero"`
Title param.Opt[string] `json:"title,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
Citations CitationsConfigParam `json:"citations,omitzero"`
// This field can be elided, and will marshal its zero value as "document".
Type constant.Document `json:"type" default:"document"`
// contains filtered or unexported fields
}
The properties Source, Type are required.
func (DocumentBlockParam) MarshalJSON ¶
func (r DocumentBlockParam) MarshalJSON() (data []byte, err error)
func (*DocumentBlockParam) UnmarshalJSON ¶
func (r *DocumentBlockParam) UnmarshalJSON(data []byte) error
type DocumentBlockParamSourceUnion ¶
type DocumentBlockParamSourceUnion struct {
OfBase64 *Base64PDFSourceParam `json:",omitzero,inline"`
OfText *PlainTextSourceParam `json:",omitzero,inline"`
OfContent *ContentBlockSourceParam `json:",omitzero,inline"`
OfURL *URLPDFSourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (DocumentBlockParamSourceUnion) GetContent ¶
func (u DocumentBlockParamSourceUnion) GetContent() *ContentBlockSourceContentUnionParam
Returns a pointer to the underlying variant's property, if present.
func (DocumentBlockParamSourceUnion) GetData ¶
func (u DocumentBlockParamSourceUnion) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (DocumentBlockParamSourceUnion) GetMediaType ¶
func (u DocumentBlockParamSourceUnion) GetMediaType() *string
Returns a pointer to the underlying variant's property, if present.
func (DocumentBlockParamSourceUnion) GetType ¶
func (u DocumentBlockParamSourceUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (DocumentBlockParamSourceUnion) GetURL ¶
func (u DocumentBlockParamSourceUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (DocumentBlockParamSourceUnion) MarshalJSON ¶
func (u DocumentBlockParamSourceUnion) MarshalJSON() ([]byte, error)
func (*DocumentBlockParamSourceUnion) UnmarshalJSON ¶
func (u *DocumentBlockParamSourceUnion) UnmarshalJSON(data []byte) error
type DocumentBlockSourceUnion ¶ added in v1.23.0
type DocumentBlockSourceUnion struct {
Data string `json:"data"`
MediaType string `json:"media_type"`
// Any of "base64", "text".
Type string `json:"type"`
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
DocumentBlockSourceUnion contains all possible properties and values from Base64PDFSource, PlainTextSource.
Use the DocumentBlockSourceUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (DocumentBlockSourceUnion) AsAny ¶ added in v1.23.0
func (u DocumentBlockSourceUnion) AsAny() anyDocumentBlockSource
Use the following switch statement to find the correct variant
switch variant := DocumentBlockSourceUnion.AsAny().(type) {
case anthropic.Base64PDFSource:
case anthropic.PlainTextSource:
default:
fmt.Errorf("no variant present")
}
func (DocumentBlockSourceUnion) AsBase64 ¶ added in v1.23.0
func (u DocumentBlockSourceUnion) AsBase64() (v Base64PDFSource)
func (DocumentBlockSourceUnion) AsText ¶ added in v1.23.0
func (u DocumentBlockSourceUnion) AsText() (v PlainTextSource)
func (DocumentBlockSourceUnion) RawJSON ¶ added in v1.23.0
func (u DocumentBlockSourceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*DocumentBlockSourceUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *DocumentBlockSourceUnion) UnmarshalJSON(data []byte) error
type EffortCapability ¶ added in v1.27.1
type EffortCapability struct {
// Whether the model supports high effort level.
High CapabilitySupport `json:"high" api:"required"`
// Whether the model supports low effort level.
Low CapabilitySupport `json:"low" api:"required"`
// Whether the model supports max effort level.
Max CapabilitySupport `json:"max" api:"required"`
// Whether the model supports medium effort level.
Medium CapabilitySupport `json:"medium" api:"required"`
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// Indicates whether a capability is supported.
Xhigh CapabilitySupport `json:"xhigh" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
High respjson.Field
Low respjson.Field
Max respjson.Field
Medium respjson.Field
Supported respjson.Field
Xhigh respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Effort (reasoning_effort) capability details.
func (EffortCapability) RawJSON ¶ added in v1.27.1
func (r EffortCapability) RawJSON() string
Returns the unmodified JSON received from the API
func (*EffortCapability) UnmarshalJSON ¶ added in v1.27.1
func (r *EffortCapability) UnmarshalJSON(data []byte) error
type EncryptedCodeExecutionResultBlock ¶ added in v1.23.0
type EncryptedCodeExecutionResultBlock struct {
Content []CodeExecutionOutputBlock `json:"content" api:"required"`
EncryptedStdout string `json:"encrypted_stdout" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
Type constant.EncryptedCodeExecutionResult `json:"type" default:"encrypted_code_execution_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
EncryptedStdout respjson.Field
ReturnCode respjson.Field
Stderr respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Code execution result with encrypted stdout for PFC + web_search results.
func (EncryptedCodeExecutionResultBlock) RawJSON ¶ added in v1.23.0
func (r EncryptedCodeExecutionResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*EncryptedCodeExecutionResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *EncryptedCodeExecutionResultBlock) UnmarshalJSON(data []byte) error
type EncryptedCodeExecutionResultBlockParam ¶ added in v1.23.0
type EncryptedCodeExecutionResultBlockParam struct {
Content []CodeExecutionOutputBlockParam `json:"content,omitzero" api:"required"`
EncryptedStdout string `json:"encrypted_stdout" api:"required"`
ReturnCode int64 `json:"return_code" api:"required"`
Stderr string `json:"stderr" api:"required"`
// This field can be elided, and will marshal its zero value as
// "encrypted_code_execution_result".
Type constant.EncryptedCodeExecutionResult `json:"type" default:"encrypted_code_execution_result"`
// contains filtered or unexported fields
}
Code execution result with encrypted stdout for PFC + web_search results.
The properties Content, EncryptedStdout, ReturnCode, Stderr, Type are required.
func (EncryptedCodeExecutionResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r EncryptedCodeExecutionResultBlockParam) MarshalJSON() (data []byte, err error)
func (*EncryptedCodeExecutionResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *EncryptedCodeExecutionResultBlockParam) UnmarshalJSON(data []byte) error
type ErrorObjectUnion ¶
type ErrorObjectUnion = shared.ErrorObjectUnion
This is an alias to an internal type.
type ErrorResponse ¶
type ErrorResponse = shared.ErrorResponse
This is an alias to an internal type.
type FileMetadata ¶ added in v1.2.0
type FileMetadata struct {
// Unique object identifier.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// RFC 3339 datetime string representing when the file was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Original filename of the uploaded file.
Filename string `json:"filename" api:"required"`
// MIME type of the file.
MimeType string `json:"mime_type" api:"required"`
// Size of the file in bytes.
SizeBytes int64 `json:"size_bytes" api:"required"`
// Object type.
//
// For files, this is always `"file"`.
Type constant.File `json:"type" default:"file"`
// Whether the file can be downloaded.
Downloadable bool `json:"downloadable"`
// The scope of this file, indicating the context in which it was created (e.g., a
// session).
Scope BetaFileScope `json:"scope" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Filename respjson.Field
MimeType respjson.Field
SizeBytes respjson.Field
Type respjson.Field
Downloadable respjson.Field
Scope respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (FileMetadata) RawJSON ¶ added in v1.2.0
func (r FileMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileMetadata) UnmarshalJSON ¶ added in v1.2.0
func (r *FileMetadata) UnmarshalJSON(data []byte) error
type GatewayTimeoutError ¶
type GatewayTimeoutError = shared.GatewayTimeoutError
This is an alias to an internal type.
type ImageBlockParam ¶
type ImageBlockParam struct {
Source ImageBlockParamSourceUnion `json:"source,omitzero" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "image".
Type constant.Image `json:"type" default:"image"`
// contains filtered or unexported fields
}
The properties Source, Type are required.
func (ImageBlockParam) MarshalJSON ¶
func (r ImageBlockParam) MarshalJSON() (data []byte, err error)
func (*ImageBlockParam) UnmarshalJSON ¶
func (r *ImageBlockParam) UnmarshalJSON(data []byte) error
type ImageBlockParamSourceUnion ¶
type ImageBlockParamSourceUnion struct {
OfBase64 *Base64ImageSourceParam `json:",omitzero,inline"`
OfURL *URLImageSourceParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ImageBlockParamSourceUnion) GetData ¶
func (u ImageBlockParamSourceUnion) GetData() *string
Returns a pointer to the underlying variant's property, if present.
func (ImageBlockParamSourceUnion) GetMediaType ¶
func (u ImageBlockParamSourceUnion) GetMediaType() *string
Returns a pointer to the underlying variant's property, if present.
func (ImageBlockParamSourceUnion) GetType ¶
func (u ImageBlockParamSourceUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ImageBlockParamSourceUnion) GetURL ¶
func (u ImageBlockParamSourceUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (ImageBlockParamSourceUnion) MarshalJSON ¶
func (u ImageBlockParamSourceUnion) MarshalJSON() ([]byte, error)
func (*ImageBlockParamSourceUnion) UnmarshalJSON ¶
func (u *ImageBlockParamSourceUnion) UnmarshalJSON(data []byte) error
type InputJSONDelta ¶
type InputJSONDelta struct {
PartialJSON string `json:"partial_json" api:"required"`
Type constant.InputJSONDelta `json:"type" default:"input_json_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PartialJSON respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (InputJSONDelta) RawJSON ¶
func (r InputJSONDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*InputJSONDelta) UnmarshalJSON ¶
func (r *InputJSONDelta) UnmarshalJSON(data []byte) error
type InvalidRequestError ¶
type InvalidRequestError = shared.InvalidRequestError
This is an alias to an internal type.
type JSONOutputFormatParam ¶ added in v1.20.0
type JSONOutputFormatParam struct {
// The JSON schema of the format
Schema map[string]any `json:"schema,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as "json_schema".
Type constant.JSONSchema `json:"type" default:"json_schema"`
// contains filtered or unexported fields
}
The properties Schema, Type are required.
func (JSONOutputFormatParam) MarshalJSON ¶ added in v1.20.0
func (r JSONOutputFormatParam) MarshalJSON() (data []byte, err error)
func (*JSONOutputFormatParam) UnmarshalJSON ¶ added in v1.20.0
func (r *JSONOutputFormatParam) UnmarshalJSON(data []byte) error
type MemoryTool20250818Param ¶ added in v1.23.0
type MemoryTool20250818Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "memory".
Name constant.Memory `json:"name" default:"memory"`
// This field can be elided, and will marshal its zero value as "memory_20250818".
Type constant.Memory20250818 `json:"type" default:"memory_20250818"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (MemoryTool20250818Param) MarshalJSON ¶ added in v1.23.0
func (r MemoryTool20250818Param) MarshalJSON() (data []byte, err error)
func (*MemoryTool20250818Param) UnmarshalJSON ¶ added in v1.23.0
func (r *MemoryTool20250818Param) UnmarshalJSON(data []byte) error
type Message ¶
type Message struct {
// Unique object identifier.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// Information about the container used in the request (for the code execution
// tool)
Container Container `json:"container" api:"required"`
// Content generated by the model.
//
// This is an array of content blocks, each of which has a `type` that determines
// its shape.
//
// Example:
//
// “`json
// [{ "type": "text", "text": "Hi, I'm Claude." }]
// “`
//
// If the request input `messages` ended with an `assistant` turn, then the
// response `content` will continue directly from that last turn. You can use this
// to constrain the model's output.
//
// For example, if the input `messages` were:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Then the response `content` might be:
//
// “`json
// [{ "type": "text", "text": "B)" }]
// “`
Content []ContentBlockUnion `json:"content" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model" api:"required"`
// Conversational role of the generated message.
//
// This will always be `"assistant"`.
Role constant.Assistant `json:"role" default:"assistant"`
// Structured information about a refusal.
StopDetails RefusalStopDetails `json:"stop_details" api:"required"`
// The reason that we stopped.
//
// This may be one the following values:
//
// - `"end_turn"`: the model reached a natural stopping point
// - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
// - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
// - `"tool_use"`: the model invoked one or more tools
// - `"pause_turn"`: we paused a long-running turn. You may provide the response
// back as-is in a subsequent request to let the model continue.
// - `"refusal"`: when streaming classifiers intervene to handle potential policy
// violations
//
// In non-streaming mode this value is always non-null. In streaming mode, it is
// null in the `message_start` event and non-null otherwise.
//
// Any of "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn",
// "refusal".
StopReason StopReason `json:"stop_reason" api:"required"`
// Which custom stop sequence was generated, if any.
//
// This value will be a non-null string if one of your custom stop sequences was
// generated.
StopSequence string `json:"stop_sequence" api:"required"`
// Object type.
//
// For Messages, this is always `"message"`.
Type constant.Message `json:"type" default:"message"`
// Billing and rate-limit usage.
//
// Anthropic's API bills and rate-limits by token counts, as tokens represent the
// underlying cost to our systems.
//
// Under the hood, the API transforms requests into a format suitable for the
// model. The model's output then goes through a parsing stage before becoming an
// API response. As a result, the token counts in `usage` will not match one-to-one
// with the exact visible content of an API request or response.
//
// For example, `output_tokens` will be non-zero, even for an empty string response
// from Claude.
//
// Total input tokens in a request is the summation of `input_tokens`,
// `cache_creation_input_tokens`, and `cache_read_input_tokens`.
Usage Usage `json:"usage" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Container respjson.Field
Content respjson.Field
Model respjson.Field
Role respjson.Field
StopDetails respjson.Field
StopReason respjson.Field
StopSequence respjson.Field
Type respjson.Field
Usage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Message) Accumulate ¶
func (acc *Message) Accumulate(event MessageStreamEventUnion) error
Accumulate builds up the Message incrementally from a MessageStreamEvent. The Message then can be used as any other Message, except with the caveat that the Message.JSON field which normally can be used to inspect the JSON sent over the network may not be populated fully.
message := anthropic.Message{}
for stream.Next() {
event := stream.Current()
message.Accumulate(event)
}
func (Message) ToParam ¶
func (r Message) ToParam() MessageParam
func (*Message) UnmarshalJSON ¶
type MessageBatch ¶
type MessageBatch struct {
// Unique object identifier.
//
// The format and length of IDs may change over time.
ID string `json:"id" api:"required"`
// RFC 3339 datetime string representing the time at which the Message Batch was
// archived and its results became unavailable.
ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which cancellation was
// initiated for the Message Batch. Specified only if cancellation was initiated.
CancelInitiatedAt time.Time `json:"cancel_initiated_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which the Message Batch was
// created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which processing for the
// Message Batch ended. Specified only once processing ends.
//
// Processing ends when every request in a Message Batch has either succeeded,
// errored, canceled, or expired.
EndedAt time.Time `json:"ended_at" api:"required" format:"date-time"`
// RFC 3339 datetime string representing the time at which the Message Batch will
// expire and end processing, which is 24 hours after creation.
ExpiresAt time.Time `json:"expires_at" api:"required" format:"date-time"`
// Processing status of the Message Batch.
//
// Any of "in_progress", "canceling", "ended".
ProcessingStatus MessageBatchProcessingStatus `json:"processing_status" api:"required"`
// Tallies requests within the Message Batch, categorized by their status.
//
// Requests start as `processing` and move to one of the other statuses only once
// processing of the entire batch ends. The sum of all values always matches the
// total number of requests in the batch.
RequestCounts MessageBatchRequestCounts `json:"request_counts" api:"required"`
// URL to a `.jsonl` file containing the results of the Message Batch requests.
// Specified only once processing ends.
//
// Results in the file are not guaranteed to be in the same order as requests. Use
// the `custom_id` field to match results to requests.
ResultsURL string `json:"results_url" api:"required"`
// Object type.
//
// For Message Batches, this is always `"message_batch"`.
Type constant.MessageBatch `json:"type" default:"message_batch"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ArchivedAt respjson.Field
CancelInitiatedAt respjson.Field
CreatedAt respjson.Field
EndedAt respjson.Field
ExpiresAt respjson.Field
ProcessingStatus respjson.Field
RequestCounts respjson.Field
ResultsURL respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageBatch) RawJSON ¶
func (r MessageBatch) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatch) UnmarshalJSON ¶
func (r *MessageBatch) UnmarshalJSON(data []byte) error
type MessageBatchCanceledResult ¶
type MessageBatchCanceledResult struct {
Type constant.Canceled `json:"type" default:"canceled"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageBatchCanceledResult) RawJSON ¶
func (r MessageBatchCanceledResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchCanceledResult) UnmarshalJSON ¶
func (r *MessageBatchCanceledResult) UnmarshalJSON(data []byte) error
type MessageBatchErroredResult ¶
type MessageBatchErroredResult struct {
Error shared.ErrorResponse `json:"error" api:"required"`
Type constant.Errored `json:"type" default:"errored"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Error respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageBatchErroredResult) RawJSON ¶
func (r MessageBatchErroredResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchErroredResult) UnmarshalJSON ¶
func (r *MessageBatchErroredResult) UnmarshalJSON(data []byte) error
type MessageBatchExpiredResult ¶
type MessageBatchExpiredResult struct {
Type constant.Expired `json:"type" default:"expired"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageBatchExpiredResult) RawJSON ¶
func (r MessageBatchExpiredResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchExpiredResult) UnmarshalJSON ¶
func (r *MessageBatchExpiredResult) UnmarshalJSON(data []byte) error
type MessageBatchIndividualResponse ¶
type MessageBatchIndividualResponse struct {
// Developer-provided ID created for each request in a Message Batch. Useful for
// matching results to requests, as results may be given out of request order.
//
// Must be unique for each request within the Message Batch.
CustomID string `json:"custom_id" api:"required"`
// Processing result for this request.
//
// Contains a Message output if processing was successful, an error response if
// processing failed, or the reason why processing was not attempted, such as
// cancellation or expiration.
Result MessageBatchResultUnion `json:"result" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CustomID respjson.Field
Result respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
This is a single line in the response `.jsonl` file and does not represent the response as a whole.
func (MessageBatchIndividualResponse) RawJSON ¶
func (r MessageBatchIndividualResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchIndividualResponse) UnmarshalJSON ¶
func (r *MessageBatchIndividualResponse) UnmarshalJSON(data []byte) error
type MessageBatchListParams ¶
type MessageBatchListParams struct {
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately after this object.
AfterID param.Opt[string] `query:"after_id,omitzero" json:"-"`
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately before this object.
BeforeID param.Opt[string] `query:"before_id,omitzero" json:"-"`
// Number of items to return per page.
//
// Defaults to `20`. Ranges from `1` to `1000`.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MessageBatchListParams) URLQuery ¶
func (r MessageBatchListParams) URLQuery() (v url.Values, err error)
URLQuery serializes MessageBatchListParams's query parameters as `url.Values`.
type MessageBatchNewParams ¶
type MessageBatchNewParams struct {
// List of requests for prompt completion. Each is an individual request to create
// a Message.
Requests []MessageBatchNewParamsRequest `json:"requests,omitzero" api:"required"`
// contains filtered or unexported fields
}
func (MessageBatchNewParams) MarshalJSON ¶
func (r MessageBatchNewParams) MarshalJSON() (data []byte, err error)
func (*MessageBatchNewParams) UnmarshalJSON ¶
func (r *MessageBatchNewParams) UnmarshalJSON(data []byte) error
type MessageBatchNewParamsRequest ¶
type MessageBatchNewParamsRequest struct {
// Developer-provided ID created for each request in a Message Batch. Useful for
// matching results to requests, as results may be given out of request order.
//
// Must be unique for each request within the Message Batch.
CustomID string `json:"custom_id" api:"required"`
// Messages API creation parameters for the individual request.
//
// See the [Messages API reference](https://docs.claude.com/en/api/messages) for
// full documentation on available parameters.
Params MessageBatchNewParamsRequestParams `json:"params,omitzero" api:"required"`
// contains filtered or unexported fields
}
The properties CustomID, Params are required.
func (MessageBatchNewParamsRequest) MarshalJSON ¶
func (r MessageBatchNewParamsRequest) MarshalJSON() (data []byte, err error)
func (*MessageBatchNewParamsRequest) UnmarshalJSON ¶
func (r *MessageBatchNewParamsRequest) UnmarshalJSON(data []byte) error
type MessageBatchNewParamsRequestParams ¶
type MessageBatchNewParamsRequestParams struct {
// The maximum number of tokens to generate before stopping.
//
// Note that our models may stop _before_ reaching this maximum. This parameter
// only specifies the absolute maximum number of tokens to generate.
//
// Different models have different maximum values for this parameter. See
// [models](https://docs.claude.com/en/docs/models-overview) for details.
MaxTokens int64 `json:"max_tokens" api:"required"`
// Input messages.
//
// Our models are trained to operate on alternating `user` and `assistant`
// conversational turns. When creating a new `Message`, you specify the prior
// conversational turns with the `messages` parameter, and the model then generates
// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
// in your request will be combined into a single turn.
//
// Each input message must be an object with a `role` and `content`. You can
// specify a single `user`-role message, or you can include multiple `user` and
// `assistant` messages.
//
// If the final message uses the `assistant` role, the response content will
// continue immediately from the content in that message. This can be used to
// constrain part of the model's response.
//
// Example with a single `user` message:
//
// “`json
// [{ "role": "user", "content": "Hello, Claude" }]
// “`
//
// Example with multiple conversational turns:
//
// “`json
// [
//
// { "role": "user", "content": "Hello there." },
// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
// { "role": "user", "content": "Can you explain LLMs in plain English?" }
//
// ]
// “`
//
// Example with a partially-filled response from Claude:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Each input message `content` may be either a single `string` or an array of
// content blocks, where each block has a specific `type`. Using a `string` for
// `content` is shorthand for an array of one content block of type `"text"`. The
// following input messages are equivalent:
//
// “`json
// { "role": "user", "content": "Hello, Claude" }
// “`
//
// “`json
// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
// “`
//
// See [input examples](https://docs.claude.com/en/api/messages-examples).
//
// Note that if you want to include a
// [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
// top-level `system` parameter — there is no `"system"` role for input messages in
// the Messages API.
//
// There is a limit of 100,000 messages in a single request.
Messages []MessageParam `json:"messages,omitzero" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// Container identifier for reuse across requests.
Container param.Opt[string] `json:"container,omitzero"`
// Specifies the geographic region for inference processing. If not specified, the
// workspace's `default_inference_geo` is used.
InferenceGeo param.Opt[string] `json:"inference_geo,omitzero"`
// Whether to incrementally stream the response using server-sent events.
//
// See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
Stream param.Opt[bool] `json:"stream,omitzero"`
// Amount of randomness injected into the response.
//
// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
// for analytical / multiple choice, and closer to `1.0` for creative and
// generative tasks.
//
// Note that even with `temperature` of `0.0`, the results will not be fully
// deterministic.
//
// Deprecated: Deprecated. Models released after Claude Opus 4.6 do not support
// setting temperature. A value of 1.0 of will be accepted for backwards
// compatibility, all other values will be rejected with a 400 error.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
// Only sample from the top K options for each subsequent token.
//
// Used to remove "long tail" low probability responses.
// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
//
// Recommended for advanced use cases only.
//
// Deprecated: Deprecated. Models released after Claude Opus 4.6 do not accept
// top_k; any value will be rejected with a 400 error.
TopK param.Opt[int64] `json:"top_k,omitzero"`
// Use nucleus sampling.
//
// In nucleus sampling, we compute the cumulative distribution over all the options
// for each subsequent token in decreasing probability order and cut it off once it
// reaches a particular probability specified by `top_p`.
//
// Recommended for advanced use cases only.
//
// Deprecated: Deprecated. Models released after Claude Opus 4.6 do not support
// setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all
// other values will be rejected with a 400 error.
TopP param.Opt[float64] `json:"top_p,omitzero"`
// Top-level cache control automatically applies a cache_control marker to the last
// cacheable block in the request.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// An object describing metadata about the request.
Metadata MetadataParam `json:"metadata,omitzero"`
// Configuration options for the model's output, such as the output format.
OutputConfig OutputConfigParam `json:"output_config,omitzero"`
// Determines whether to use priority capacity (if available) or standard capacity
// for this request.
//
// Anthropic offers different levels of service for your API requests. See
// [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
//
// Any of "auto", "standard_only".
ServiceTier string `json:"service_tier,omitzero"`
// Custom text sequences that will cause the model to stop generating.
//
// Our models will normally stop when they have naturally completed their turn,
// which will result in a response `stop_reason` of `"end_turn"`.
//
// If you want the model to stop generating when it encounters custom strings of
// text, you can use the `stop_sequences` parameter. If the model encounters one of
// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
// and the response `stop_sequence` value will contain the matched stop sequence.
StopSequences []string `json:"stop_sequences,omitzero"`
// System prompt.
//
// A system prompt is a way of providing context and instructions to Claude, such
// as specifying a particular goal or role. See our
// [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
System []TextBlockParam `json:"system,omitzero"`
// Configuration for enabling Claude's extended thinking.
//
// When enabled, responses include `thinking` content blocks showing Claude's
// thinking process before the final answer. Requires a minimum budget of 1,024
// tokens and counts towards your `max_tokens` limit.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
Thinking ThinkingConfigParamUnion `json:"thinking,omitzero"`
// How the model should use the provided tools. The model can use a specific tool,
// any available tool, decide by itself, or not use tools at all.
ToolChoice ToolChoiceUnionParam `json:"tool_choice,omitzero"`
// Definitions of tools that the model may use.
//
// If you include `tools` in your API request, the model may return `tool_use`
// content blocks that represent the model's use of those tools. You can then run
// those tools using the tool input generated by the model and then optionally
// return results back to the model using `tool_result` content blocks.
//
// There are two types of tools: **client tools** and **server tools**. The
// behavior described below applies to client tools. For
// [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
// see their individual documentation as each has its own behavior (e.g., the
// [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
//
// Each tool definition includes:
//
// - `name`: Name of the tool.
// - `description`: Optional, but strongly-recommended description of the tool.
// - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
// tool `input` shape that the model will produce in `tool_use` output content
// blocks.
//
// For example, if you defined `tools` as:
//
// “`json
// [
//
// {
// "name": "get_stock_price",
// "description": "Get the current stock price for a given ticker symbol.",
// "input_schema": {
// "type": "object",
// "properties": {
// "ticker": {
// "type": "string",
// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
// }
// },
// "required": ["ticker"]
// }
// }
//
// ]
// “`
//
// And then asked the model "What's the S&P 500 at today?", the model might produce
// `tool_use` content blocks in the response like this:
//
// “`json
// [
//
// {
// "type": "tool_use",
// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "name": "get_stock_price",
// "input": { "ticker": "^GSPC" }
// }
//
// ]
// “`
//
// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
// input, and return the following back to the model in a subsequent `user`
// message:
//
// “`json
// [
//
// {
// "type": "tool_result",
// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "content": "259.75 USD"
// }
//
// ]
// “`
//
// Tools can be used for workflows that include running client-side tools and
// functions, or more generally whenever you want the model to produce a particular
// JSON structure of output.
//
// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
Tools []ToolUnionParam `json:"tools,omitzero"`
// contains filtered or unexported fields
}
Messages API creation parameters for the individual request.
See the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters.
The properties MaxTokens, Messages, Model are required.
func (MessageBatchNewParamsRequestParams) MarshalJSON ¶
func (r MessageBatchNewParamsRequestParams) MarshalJSON() (data []byte, err error)
func (*MessageBatchNewParamsRequestParams) UnmarshalJSON ¶
func (r *MessageBatchNewParamsRequestParams) UnmarshalJSON(data []byte) error
type MessageBatchProcessingStatus ¶
type MessageBatchProcessingStatus string
Processing status of the Message Batch.
const ( MessageBatchProcessingStatusInProgress MessageBatchProcessingStatus = "in_progress" MessageBatchProcessingStatusCanceling MessageBatchProcessingStatus = "canceling" MessageBatchProcessingStatusEnded MessageBatchProcessingStatus = "ended" )
type MessageBatchRequestCounts ¶
type MessageBatchRequestCounts struct {
// Number of requests in the Message Batch that have been canceled.
//
// This is zero until processing of the entire Message Batch has ended.
Canceled int64 `json:"canceled" api:"required"`
// Number of requests in the Message Batch that encountered an error.
//
// This is zero until processing of the entire Message Batch has ended.
Errored int64 `json:"errored" api:"required"`
// Number of requests in the Message Batch that have expired.
//
// This is zero until processing of the entire Message Batch has ended.
Expired int64 `json:"expired" api:"required"`
// Number of requests in the Message Batch that are processing.
Processing int64 `json:"processing" api:"required"`
// Number of requests in the Message Batch that have completed successfully.
//
// This is zero until processing of the entire Message Batch has ended.
Succeeded int64 `json:"succeeded" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Canceled respjson.Field
Errored respjson.Field
Expired respjson.Field
Processing respjson.Field
Succeeded respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageBatchRequestCounts) RawJSON ¶
func (r MessageBatchRequestCounts) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchRequestCounts) UnmarshalJSON ¶
func (r *MessageBatchRequestCounts) UnmarshalJSON(data []byte) error
type MessageBatchResultUnion ¶
type MessageBatchResultUnion struct {
// This field is from variant [MessageBatchSucceededResult].
Message Message `json:"message"`
// Any of "succeeded", "errored", "canceled", "expired".
Type string `json:"type"`
// This field is from variant [MessageBatchErroredResult].
Error shared.ErrorResponse `json:"error"`
JSON struct {
Message respjson.Field
Type respjson.Field
Error respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MessageBatchResultUnion contains all possible properties and values from MessageBatchSucceededResult, MessageBatchErroredResult, MessageBatchCanceledResult, MessageBatchExpiredResult.
Use the MessageBatchResultUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessageBatchResultUnion) AsAny ¶
func (u MessageBatchResultUnion) AsAny() anyMessageBatchResult
Use the following switch statement to find the correct variant
switch variant := MessageBatchResultUnion.AsAny().(type) {
case anthropic.MessageBatchSucceededResult:
case anthropic.MessageBatchErroredResult:
case anthropic.MessageBatchCanceledResult:
case anthropic.MessageBatchExpiredResult:
default:
fmt.Errorf("no variant present")
}
func (MessageBatchResultUnion) AsCanceled ¶
func (u MessageBatchResultUnion) AsCanceled() (v MessageBatchCanceledResult)
func (MessageBatchResultUnion) AsErrored ¶
func (u MessageBatchResultUnion) AsErrored() (v MessageBatchErroredResult)
func (MessageBatchResultUnion) AsExpired ¶
func (u MessageBatchResultUnion) AsExpired() (v MessageBatchExpiredResult)
func (MessageBatchResultUnion) AsSucceeded ¶
func (u MessageBatchResultUnion) AsSucceeded() (v MessageBatchSucceededResult)
func (MessageBatchResultUnion) RawJSON ¶
func (u MessageBatchResultUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchResultUnion) UnmarshalJSON ¶
func (r *MessageBatchResultUnion) UnmarshalJSON(data []byte) error
type MessageBatchService ¶
type MessageBatchService struct {
Options []option.RequestOption
}
MessageBatchService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMessageBatchService method instead.
func NewMessageBatchService ¶
func NewMessageBatchService(opts ...option.RequestOption) (r MessageBatchService)
NewMessageBatchService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*MessageBatchService) Cancel ¶
func (r *MessageBatchService) Cancel(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (res *MessageBatch, err error)
Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*MessageBatchService) Delete ¶
func (r *MessageBatchService) Delete(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (res *DeletedMessageBatch, err error)
Delete a Message Batch.
Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*MessageBatchService) Get ¶
func (r *MessageBatchService) Get(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (res *MessageBatch, err error)
This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*MessageBatchService) List ¶
func (r *MessageBatchService) List(ctx context.Context, query MessageBatchListParams, opts ...option.RequestOption) (res *pagination.Page[MessageBatch], err error)
List all Message Batches within a Workspace. Most recently created batches are returned first.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*MessageBatchService) ListAutoPaging ¶
func (r *MessageBatchService) ListAutoPaging(ctx context.Context, query MessageBatchListParams, opts ...option.RequestOption) *pagination.PageAutoPager[MessageBatch]
List all Message Batches within a Workspace. Most recently created batches are returned first.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*MessageBatchService) New ¶
func (r *MessageBatchService) New(ctx context.Context, body MessageBatchNewParams, opts ...option.RequestOption) (res *MessageBatch, err error)
Send a batch of Message creation requests.
The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
func (*MessageBatchService) ResultsStreaming ¶
func (r *MessageBatchService) ResultsStreaming(ctx context.Context, messageBatchID string, opts ...option.RequestOption) (stream *jsonl.Stream[MessageBatchIndividualResponse])
Streams the results of a Message Batch as a `.jsonl` file.
Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
type MessageBatchSucceededResult ¶
type MessageBatchSucceededResult struct {
Message Message `json:"message" api:"required"`
Type constant.Succeeded `json:"type" default:"succeeded"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageBatchSucceededResult) RawJSON ¶
func (r MessageBatchSucceededResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageBatchSucceededResult) UnmarshalJSON ¶
func (r *MessageBatchSucceededResult) UnmarshalJSON(data []byte) error
type MessageCountTokensParams ¶
type MessageCountTokensParams struct {
// Input messages.
//
// Our models are trained to operate on alternating `user` and `assistant`
// conversational turns. When creating a new `Message`, you specify the prior
// conversational turns with the `messages` parameter, and the model then generates
// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
// in your request will be combined into a single turn.
//
// Each input message must be an object with a `role` and `content`. You can
// specify a single `user`-role message, or you can include multiple `user` and
// `assistant` messages.
//
// If the final message uses the `assistant` role, the response content will
// continue immediately from the content in that message. This can be used to
// constrain part of the model's response.
//
// Example with a single `user` message:
//
// “`json
// [{ "role": "user", "content": "Hello, Claude" }]
// “`
//
// Example with multiple conversational turns:
//
// “`json
// [
//
// { "role": "user", "content": "Hello there." },
// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
// { "role": "user", "content": "Can you explain LLMs in plain English?" }
//
// ]
// “`
//
// Example with a partially-filled response from Claude:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Each input message `content` may be either a single `string` or an array of
// content blocks, where each block has a specific `type`. Using a `string` for
// `content` is shorthand for an array of one content block of type `"text"`. The
// following input messages are equivalent:
//
// “`json
// { "role": "user", "content": "Hello, Claude" }
// “`
//
// “`json
// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
// “`
//
// See [input examples](https://docs.claude.com/en/api/messages-examples).
//
// Note that if you want to include a
// [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
// top-level `system` parameter — there is no `"system"` role for input messages in
// the Messages API.
//
// There is a limit of 100,000 messages in a single request.
Messages []MessageParam `json:"messages,omitzero" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// Top-level cache control automatically applies a cache_control marker to the last
// cacheable block in the request.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Configuration options for the model's output, such as the output format.
OutputConfig OutputConfigParam `json:"output_config,omitzero"`
// System prompt.
//
// A system prompt is a way of providing context and instructions to Claude, such
// as specifying a particular goal or role. See our
// [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
System MessageCountTokensParamsSystemUnion `json:"system,omitzero"`
// Configuration for enabling Claude's extended thinking.
//
// When enabled, responses include `thinking` content blocks showing Claude's
// thinking process before the final answer. Requires a minimum budget of 1,024
// tokens and counts towards your `max_tokens` limit.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
Thinking ThinkingConfigParamUnion `json:"thinking,omitzero"`
// How the model should use the provided tools. The model can use a specific tool,
// any available tool, decide by itself, or not use tools at all.
ToolChoice ToolChoiceUnionParam `json:"tool_choice,omitzero"`
// Definitions of tools that the model may use.
//
// If you include `tools` in your API request, the model may return `tool_use`
// content blocks that represent the model's use of those tools. You can then run
// those tools using the tool input generated by the model and then optionally
// return results back to the model using `tool_result` content blocks.
//
// There are two types of tools: **client tools** and **server tools**. The
// behavior described below applies to client tools. For
// [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
// see their individual documentation as each has its own behavior (e.g., the
// [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
//
// Each tool definition includes:
//
// - `name`: Name of the tool.
// - `description`: Optional, but strongly-recommended description of the tool.
// - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
// tool `input` shape that the model will produce in `tool_use` output content
// blocks.
//
// For example, if you defined `tools` as:
//
// “`json
// [
//
// {
// "name": "get_stock_price",
// "description": "Get the current stock price for a given ticker symbol.",
// "input_schema": {
// "type": "object",
// "properties": {
// "ticker": {
// "type": "string",
// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
// }
// },
// "required": ["ticker"]
// }
// }
//
// ]
// “`
//
// And then asked the model "What's the S&P 500 at today?", the model might produce
// `tool_use` content blocks in the response like this:
//
// “`json
// [
//
// {
// "type": "tool_use",
// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "name": "get_stock_price",
// "input": { "ticker": "^GSPC" }
// }
//
// ]
// “`
//
// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
// input, and return the following back to the model in a subsequent `user`
// message:
//
// “`json
// [
//
// {
// "type": "tool_result",
// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "content": "259.75 USD"
// }
//
// ]
// “`
//
// Tools can be used for workflows that include running client-side tools and
// functions, or more generally whenever you want the model to produce a particular
// JSON structure of output.
//
// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
Tools []MessageCountTokensToolUnionParam `json:"tools,omitzero"`
// contains filtered or unexported fields
}
func (MessageCountTokensParams) MarshalJSON ¶
func (r MessageCountTokensParams) MarshalJSON() (data []byte, err error)
func (*MessageCountTokensParams) UnmarshalJSON ¶
func (r *MessageCountTokensParams) UnmarshalJSON(data []byte) error
type MessageCountTokensParamsSystemUnion ¶
type MessageCountTokensParamsSystemUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfTextBlockArray []TextBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (MessageCountTokensParamsSystemUnion) MarshalJSON ¶
func (u MessageCountTokensParamsSystemUnion) MarshalJSON() ([]byte, error)
func (*MessageCountTokensParamsSystemUnion) UnmarshalJSON ¶
func (u *MessageCountTokensParamsSystemUnion) UnmarshalJSON(data []byte) error
type MessageCountTokensToolUnionParam ¶
type MessageCountTokensToolUnionParam struct {
OfTool *ToolParam `json:",omitzero,inline"`
OfBashTool20250124 *ToolBash20250124Param `json:",omitzero,inline"`
OfCodeExecutionTool20250522 *CodeExecutionTool20250522Param `json:",omitzero,inline"`
OfCodeExecutionTool20250825 *CodeExecutionTool20250825Param `json:",omitzero,inline"`
OfCodeExecutionTool20260120 *CodeExecutionTool20260120Param `json:",omitzero,inline"`
OfMemoryTool20250818 *MemoryTool20250818Param `json:",omitzero,inline"`
OfTextEditor20250124 *ToolTextEditor20250124Param `json:",omitzero,inline"`
OfTextEditor20250429 *ToolTextEditor20250429Param `json:",omitzero,inline"`
OfTextEditor20250728 *ToolTextEditor20250728Param `json:",omitzero,inline"`
OfWebSearchTool20250305 *WebSearchTool20250305Param `json:",omitzero,inline"`
OfWebFetchTool20250910 *WebFetchTool20250910Param `json:",omitzero,inline"`
OfWebSearchTool20260209 *WebSearchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260209 *WebFetchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260309 *WebFetchTool20260309Param `json:",omitzero,inline"`
OfToolSearchToolBm25_20251119 *ToolSearchToolBm25_20251119Param `json:",omitzero,inline"`
OfToolSearchToolRegex20251119 *ToolSearchToolRegex20251119Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func MessageCountTokensToolParamOfTool ¶
func MessageCountTokensToolParamOfTool(inputSchema ToolInputSchemaParam, name string) MessageCountTokensToolUnionParam
func MessageCountTokensToolParamOfToolSearchToolBm25_20251119 ¶ added in v1.23.0
func MessageCountTokensToolParamOfToolSearchToolBm25_20251119(type_ ToolSearchToolBm25_20251119Type) MessageCountTokensToolUnionParam
func MessageCountTokensToolParamOfToolSearchToolRegex20251119 ¶ added in v1.23.0
func MessageCountTokensToolParamOfToolSearchToolRegex20251119(type_ ToolSearchToolRegex20251119Type) MessageCountTokensToolUnionParam
func (MessageCountTokensToolUnionParam) GetAllowedCallers ¶ added in v1.23.0
func (u MessageCountTokensToolUnionParam) GetAllowedCallers() []string
Returns a pointer to the underlying variant's AllowedCallers property, if present.
func (MessageCountTokensToolUnionParam) GetAllowedDomains ¶
func (u MessageCountTokensToolUnionParam) GetAllowedDomains() []string
Returns a pointer to the underlying variant's AllowedDomains property, if present.
func (MessageCountTokensToolUnionParam) GetBlockedDomains ¶
func (u MessageCountTokensToolUnionParam) GetBlockedDomains() []string
Returns a pointer to the underlying variant's BlockedDomains property, if present.
func (MessageCountTokensToolUnionParam) GetCacheControl ¶
func (u MessageCountTokensToolUnionParam) GetCacheControl() *CacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (MessageCountTokensToolUnionParam) GetCitations ¶ added in v1.23.0
func (u MessageCountTokensToolUnionParam) GetCitations() *CitationsConfigParam
Returns a pointer to the underlying variant's Citations property, if present.
func (MessageCountTokensToolUnionParam) GetDeferLoading ¶ added in v1.23.0
func (u MessageCountTokensToolUnionParam) GetDeferLoading() *bool
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetDescription ¶
func (u MessageCountTokensToolUnionParam) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetEagerInputStreaming ¶ added in v1.21.0
func (u MessageCountTokensToolUnionParam) GetEagerInputStreaming() *bool
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetInputExamples ¶ added in v1.23.0
func (u MessageCountTokensToolUnionParam) GetInputExamples() []map[string]any
Returns a pointer to the underlying variant's InputExamples property, if present.
func (MessageCountTokensToolUnionParam) GetInputSchema ¶
func (u MessageCountTokensToolUnionParam) GetInputSchema() *ToolInputSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetMaxCharacters ¶ added in v1.7.0
func (u MessageCountTokensToolUnionParam) GetMaxCharacters() *int64
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetMaxContentTokens ¶ added in v1.23.0
func (u MessageCountTokensToolUnionParam) GetMaxContentTokens() *int64
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetMaxUses ¶
func (u MessageCountTokensToolUnionParam) GetMaxUses() *int64
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetName ¶
func (u MessageCountTokensToolUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetStrict ¶ added in v1.20.0
func (u MessageCountTokensToolUnionParam) GetStrict() *bool
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetType ¶
func (u MessageCountTokensToolUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetUseCache ¶ added in v1.27.0
func (u MessageCountTokensToolUnionParam) GetUseCache() *bool
Returns a pointer to the underlying variant's property, if present.
func (MessageCountTokensToolUnionParam) GetUserLocation ¶
func (u MessageCountTokensToolUnionParam) GetUserLocation() *UserLocationParam
Returns a pointer to the underlying variant's UserLocation property, if present.
func (MessageCountTokensToolUnionParam) MarshalJSON ¶
func (u MessageCountTokensToolUnionParam) MarshalJSON() ([]byte, error)
func (*MessageCountTokensToolUnionParam) UnmarshalJSON ¶
func (u *MessageCountTokensToolUnionParam) UnmarshalJSON(data []byte) error
type MessageDeltaEvent ¶
type MessageDeltaEvent struct {
Delta MessageDeltaEventDelta `json:"delta" api:"required"`
Type constant.MessageDelta `json:"type" default:"message_delta"`
// Billing and rate-limit usage.
//
// Anthropic's API bills and rate-limits by token counts, as tokens represent the
// underlying cost to our systems.
//
// Under the hood, the API transforms requests into a format suitable for the
// model. The model's output then goes through a parsing stage before becoming an
// API response. As a result, the token counts in `usage` will not match one-to-one
// with the exact visible content of an API request or response.
//
// For example, `output_tokens` will be non-zero, even for an empty string response
// from Claude.
//
// Total input tokens in a request is the summation of `input_tokens`,
// `cache_creation_input_tokens`, and `cache_read_input_tokens`.
Usage MessageDeltaUsage `json:"usage" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Delta respjson.Field
Type respjson.Field
Usage respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageDeltaEvent) RawJSON ¶
func (r MessageDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDeltaEvent) UnmarshalJSON ¶
func (r *MessageDeltaEvent) UnmarshalJSON(data []byte) error
type MessageDeltaEventDelta ¶
type MessageDeltaEventDelta struct {
// Information about the container used in the request (for the code execution
// tool)
Container Container `json:"container" api:"required"`
// Structured information about a refusal.
StopDetails RefusalStopDetails `json:"stop_details" api:"required"`
// Any of "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn",
// "refusal".
StopReason StopReason `json:"stop_reason" api:"required"`
StopSequence string `json:"stop_sequence" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Container respjson.Field
StopDetails respjson.Field
StopReason respjson.Field
StopSequence respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageDeltaEventDelta) RawJSON ¶
func (r MessageDeltaEventDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDeltaEventDelta) UnmarshalJSON ¶
func (r *MessageDeltaEventDelta) UnmarshalJSON(data []byte) error
type MessageDeltaUsage ¶
type MessageDeltaUsage struct {
// The cumulative number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The cumulative number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The cumulative number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// The cumulative number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// The number of server tool requests.
ServerToolUse ServerToolUsage `json:"server_tool_use" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
ServerToolUse respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageDeltaUsage) RawJSON ¶
func (r MessageDeltaUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDeltaUsage) UnmarshalJSON ¶
func (r *MessageDeltaUsage) UnmarshalJSON(data []byte) error
type MessageNewParams ¶
type MessageNewParams struct {
// The maximum number of tokens to generate before stopping.
//
// Note that our models may stop _before_ reaching this maximum. This parameter
// only specifies the absolute maximum number of tokens to generate.
//
// Different models have different maximum values for this parameter. See
// [models](https://docs.claude.com/en/docs/models-overview) for details.
MaxTokens int64 `json:"max_tokens" api:"required"`
// Input messages.
//
// Our models are trained to operate on alternating `user` and `assistant`
// conversational turns. When creating a new `Message`, you specify the prior
// conversational turns with the `messages` parameter, and the model then generates
// the next `Message` in the conversation. Consecutive `user` or `assistant` turns
// in your request will be combined into a single turn.
//
// Each input message must be an object with a `role` and `content`. You can
// specify a single `user`-role message, or you can include multiple `user` and
// `assistant` messages.
//
// If the final message uses the `assistant` role, the response content will
// continue immediately from the content in that message. This can be used to
// constrain part of the model's response.
//
// Example with a single `user` message:
//
// “`json
// [{ "role": "user", "content": "Hello, Claude" }]
// “`
//
// Example with multiple conversational turns:
//
// “`json
// [
//
// { "role": "user", "content": "Hello there." },
// { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
// { "role": "user", "content": "Can you explain LLMs in plain English?" }
//
// ]
// “`
//
// Example with a partially-filled response from Claude:
//
// “`json
// [
//
// {
// "role": "user",
// "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
// },
// { "role": "assistant", "content": "The best answer is (" }
//
// ]
// “`
//
// Each input message `content` may be either a single `string` or an array of
// content blocks, where each block has a specific `type`. Using a `string` for
// `content` is shorthand for an array of one content block of type `"text"`. The
// following input messages are equivalent:
//
// “`json
// { "role": "user", "content": "Hello, Claude" }
// “`
//
// “`json
// { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
// “`
//
// See [input examples](https://docs.claude.com/en/api/messages-examples).
//
// Note that if you want to include a
// [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
// top-level `system` parameter — there is no `"system"` role for input messages in
// the Messages API.
//
// There is a limit of 100,000 messages in a single request.
Messages []MessageParam `json:"messages,omitzero" api:"required"`
// The model that will complete your prompt.\n\nSee
// [models](https://docs.anthropic.com/en/docs/models-overview) for additional
// details and options.
Model Model `json:"model,omitzero" api:"required"`
// Container identifier for reuse across requests.
Container param.Opt[string] `json:"container,omitzero"`
// Specifies the geographic region for inference processing. If not specified, the
// workspace's `default_inference_geo` is used.
InferenceGeo param.Opt[string] `json:"inference_geo,omitzero"`
// Amount of randomness injected into the response.
//
// Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
// for analytical / multiple choice, and closer to `1.0` for creative and
// generative tasks.
//
// Note that even with `temperature` of `0.0`, the results will not be fully
// deterministic.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
// Only sample from the top K options for each subsequent token.
//
// Used to remove "long tail" low probability responses.
// [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
//
// Recommended for advanced use cases only.
TopK param.Opt[int64] `json:"top_k,omitzero"`
// Use nucleus sampling.
//
// In nucleus sampling, we compute the cumulative distribution over all the options
// for each subsequent token in decreasing probability order and cut it off once it
// reaches a particular probability specified by `top_p`.
//
// Recommended for advanced use cases only.
TopP param.Opt[float64] `json:"top_p,omitzero"`
// Top-level cache control automatically applies a cache_control marker to the last
// cacheable block in the request.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// An object describing metadata about the request.
Metadata MetadataParam `json:"metadata,omitzero"`
// Configuration options for the model's output, such as the output format.
OutputConfig OutputConfigParam `json:"output_config,omitzero"`
// Determines whether to use priority capacity (if available) or standard capacity
// for this request.
//
// Anthropic offers different levels of service for your API requests. See
// [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
//
// Any of "auto", "standard_only".
ServiceTier MessageNewParamsServiceTier `json:"service_tier,omitzero"`
// Custom text sequences that will cause the model to stop generating.
//
// Our models will normally stop when they have naturally completed their turn,
// which will result in a response `stop_reason` of `"end_turn"`.
//
// If you want the model to stop generating when it encounters custom strings of
// text, you can use the `stop_sequences` parameter. If the model encounters one of
// the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
// and the response `stop_sequence` value will contain the matched stop sequence.
StopSequences []string `json:"stop_sequences,omitzero"`
// System prompt.
//
// A system prompt is a way of providing context and instructions to Claude, such
// as specifying a particular goal or role. See our
// [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
System []TextBlockParam `json:"system,omitzero"`
// Configuration for enabling Claude's extended thinking.
//
// When enabled, responses include `thinking` content blocks showing Claude's
// thinking process before the final answer. Requires a minimum budget of 1,024
// tokens and counts towards your `max_tokens` limit.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
Thinking ThinkingConfigParamUnion `json:"thinking,omitzero"`
// How the model should use the provided tools. The model can use a specific tool,
// any available tool, decide by itself, or not use tools at all.
ToolChoice ToolChoiceUnionParam `json:"tool_choice,omitzero"`
// Definitions of tools that the model may use.
//
// If you include `tools` in your API request, the model may return `tool_use`
// content blocks that represent the model's use of those tools. You can then run
// those tools using the tool input generated by the model and then optionally
// return results back to the model using `tool_result` content blocks.
//
// There are two types of tools: **client tools** and **server tools**. The
// behavior described below applies to client tools. For
// [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
// see their individual documentation as each has its own behavior (e.g., the
// [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
//
// Each tool definition includes:
//
// - `name`: Name of the tool.
// - `description`: Optional, but strongly-recommended description of the tool.
// - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
// tool `input` shape that the model will produce in `tool_use` output content
// blocks.
//
// For example, if you defined `tools` as:
//
// “`json
// [
//
// {
// "name": "get_stock_price",
// "description": "Get the current stock price for a given ticker symbol.",
// "input_schema": {
// "type": "object",
// "properties": {
// "ticker": {
// "type": "string",
// "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
// }
// },
// "required": ["ticker"]
// }
// }
//
// ]
// “`
//
// And then asked the model "What's the S&P 500 at today?", the model might produce
// `tool_use` content blocks in the response like this:
//
// “`json
// [
//
// {
// "type": "tool_use",
// "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "name": "get_stock_price",
// "input": { "ticker": "^GSPC" }
// }
//
// ]
// “`
//
// You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
// input, and return the following back to the model in a subsequent `user`
// message:
//
// “`json
// [
//
// {
// "type": "tool_result",
// "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
// "content": "259.75 USD"
// }
//
// ]
// “`
//
// Tools can be used for workflows that include running client-side tools and
// functions, or more generally whenever you want the model to produce a particular
// JSON structure of output.
//
// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
Tools []ToolUnionParam `json:"tools,omitzero"`
// contains filtered or unexported fields
}
func (MessageNewParams) MarshalJSON ¶
func (r MessageNewParams) MarshalJSON() (data []byte, err error)
func (*MessageNewParams) UnmarshalJSON ¶
func (r *MessageNewParams) UnmarshalJSON(data []byte) error
type MessageNewParamsServiceTier ¶ added in v1.2.0
type MessageNewParamsServiceTier string
Determines whether to use priority capacity (if available) or standard capacity for this request.
Anthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
const ( MessageNewParamsServiceTierAuto MessageNewParamsServiceTier = "auto" MessageNewParamsServiceTierStandardOnly MessageNewParamsServiceTier = "standard_only" )
type MessageParam ¶
type MessageParam struct {
Content []ContentBlockParamUnion `json:"content,omitzero" api:"required"`
// Any of "user", "assistant".
Role MessageParamRole `json:"role,omitzero" api:"required"`
// contains filtered or unexported fields
}
The properties Content, Role are required.
func NewAssistantMessage ¶
func NewAssistantMessage(blocks ...ContentBlockParamUnion) MessageParam
func NewUserMessage ¶
func NewUserMessage(blocks ...ContentBlockParamUnion) MessageParam
func (MessageParam) MarshalJSON ¶
func (r MessageParam) MarshalJSON() (data []byte, err error)
func (*MessageParam) UnmarshalJSON ¶
func (r *MessageParam) UnmarshalJSON(data []byte) error
type MessageParamRole ¶
type MessageParamRole string
const ( MessageParamRoleUser MessageParamRole = "user" MessageParamRoleAssistant MessageParamRole = "assistant" )
type MessageService ¶
type MessageService struct {
Options []option.RequestOption
Batches MessageBatchService
}
MessageService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMessageService method instead.
func NewMessageService ¶
func NewMessageService(opts ...option.RequestOption) (r MessageService)
NewMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*MessageService) CountTokens ¶
func (r *MessageService) CountTokens(ctx context.Context, body MessageCountTokensParams, opts ...option.RequestOption) (res *MessageTokensCount, err error)
Count the number of tokens in a Message.
The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.
Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
func (*MessageService) New ¶
func (r *MessageService) New(ctx context.Context, body MessageNewParams, opts ...option.RequestOption) (res *Message, err error)
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)
Note: If you choose to set a timeout for this request, we recommend 10 minutes.
func (*MessageService) NewStreaming ¶
func (r *MessageService) NewStreaming(ctx context.Context, body MessageNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[MessageStreamEventUnion])
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup)
Note: If you choose to set a timeout for this request, we recommend 10 minutes.
type MessageStartEvent ¶
type MessageStartEvent struct {
Message Message `json:"message" api:"required"`
Type constant.MessageStart `json:"type" default:"message_start"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Message respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageStartEvent) RawJSON ¶
func (r MessageStartEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageStartEvent) UnmarshalJSON ¶
func (r *MessageStartEvent) UnmarshalJSON(data []byte) error
type MessageStopEvent ¶
type MessageStopEvent struct {
Type constant.MessageStop `json:"type" default:"message_stop"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageStopEvent) RawJSON ¶
func (r MessageStopEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageStopEvent) UnmarshalJSON ¶
func (r *MessageStopEvent) UnmarshalJSON(data []byte) error
type MessageStreamEventUnion ¶
type MessageStreamEventUnion struct {
// This field is from variant [MessageStartEvent].
Message Message `json:"message"`
// Any of "message_start", "message_delta", "message_stop", "content_block_start",
// "content_block_delta", "content_block_stop".
Type string `json:"type"`
// This field is a union of [MessageDeltaEventDelta], [RawContentBlockDeltaUnion]
Delta MessageStreamEventUnionDelta `json:"delta"`
// This field is from variant [MessageDeltaEvent].
Usage MessageDeltaUsage `json:"usage"`
// This field is from variant [ContentBlockStartEvent].
ContentBlock ContentBlockStartEventContentBlockUnion `json:"content_block"`
Index int64 `json:"index"`
JSON struct {
Message respjson.Field
Type respjson.Field
Delta respjson.Field
Usage respjson.Field
ContentBlock respjson.Field
Index respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MessageStreamEventUnion contains all possible properties and values from MessageStartEvent, MessageDeltaEvent, MessageStopEvent, ContentBlockStartEvent, ContentBlockDeltaEvent, ContentBlockStopEvent.
Use the MessageStreamEventUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessageStreamEventUnion) AsAny ¶
func (u MessageStreamEventUnion) AsAny() anyMessageStreamEvent
Use the following switch statement to find the correct variant
switch variant := MessageStreamEventUnion.AsAny().(type) {
case anthropic.MessageStartEvent:
case anthropic.MessageDeltaEvent:
case anthropic.MessageStopEvent:
case anthropic.ContentBlockStartEvent:
case anthropic.ContentBlockDeltaEvent:
case anthropic.ContentBlockStopEvent:
default:
fmt.Errorf("no variant present")
}
func (MessageStreamEventUnion) AsContentBlockDelta ¶
func (u MessageStreamEventUnion) AsContentBlockDelta() (v ContentBlockDeltaEvent)
func (MessageStreamEventUnion) AsContentBlockStart ¶
func (u MessageStreamEventUnion) AsContentBlockStart() (v ContentBlockStartEvent)
func (MessageStreamEventUnion) AsContentBlockStop ¶
func (u MessageStreamEventUnion) AsContentBlockStop() (v ContentBlockStopEvent)
func (MessageStreamEventUnion) AsMessageDelta ¶
func (u MessageStreamEventUnion) AsMessageDelta() (v MessageDeltaEvent)
func (MessageStreamEventUnion) AsMessageStart ¶
func (u MessageStreamEventUnion) AsMessageStart() (v MessageStartEvent)
func (MessageStreamEventUnion) AsMessageStop ¶
func (u MessageStreamEventUnion) AsMessageStop() (v MessageStopEvent)
func (MessageStreamEventUnion) RawJSON ¶
func (u MessageStreamEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageStreamEventUnion) UnmarshalJSON ¶
func (r *MessageStreamEventUnion) UnmarshalJSON(data []byte) error
type MessageStreamEventUnionDelta ¶
type MessageStreamEventUnionDelta struct {
// This field is from variant [MessageDeltaEventDelta].
Container Container `json:"container"`
// This field is from variant [MessageDeltaEventDelta].
StopDetails RefusalStopDetails `json:"stop_details"`
// This field is from variant [MessageDeltaEventDelta].
StopReason StopReason `json:"stop_reason"`
// This field is from variant [MessageDeltaEventDelta].
StopSequence string `json:"stop_sequence"`
// This field is from variant [RawContentBlockDeltaUnion].
Text string `json:"text"`
Type string `json:"type"`
// This field is from variant [RawContentBlockDeltaUnion].
PartialJSON string `json:"partial_json"`
// This field is from variant [RawContentBlockDeltaUnion].
Citation CitationsDeltaCitationUnion `json:"citation"`
// This field is from variant [RawContentBlockDeltaUnion].
Thinking string `json:"thinking"`
// This field is from variant [RawContentBlockDeltaUnion].
Signature string `json:"signature"`
JSON struct {
Container respjson.Field
StopDetails respjson.Field
StopReason respjson.Field
StopSequence respjson.Field
Text respjson.Field
Type respjson.Field
PartialJSON respjson.Field
Citation respjson.Field
Thinking respjson.Field
Signature respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MessageStreamEventUnionDelta is an implicit subunion of MessageStreamEventUnion. MessageStreamEventUnionDelta provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the MessageStreamEventUnion.
func (*MessageStreamEventUnionDelta) UnmarshalJSON ¶
func (r *MessageStreamEventUnionDelta) UnmarshalJSON(data []byte) error
type MessageTokensCount ¶
type MessageTokensCount struct {
// The total number of tokens across the provided list of messages, system prompt,
// and tools.
InputTokens int64 `json:"input_tokens" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
InputTokens respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MessageTokensCount) RawJSON ¶
func (r MessageTokensCount) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageTokensCount) UnmarshalJSON ¶
func (r *MessageTokensCount) UnmarshalJSON(data []byte) error
type MetadataParam ¶
type MetadataParam struct {
// An external identifier for the user who is associated with the request.
//
// This should be a uuid, hash value, or other opaque identifier. Anthropic may use
// this id to help detect abuse. Do not include any identifying information such as
// name, email address, or phone number.
UserID param.Opt[string] `json:"user_id,omitzero"`
// contains filtered or unexported fields
}
func (MetadataParam) MarshalJSON ¶
func (r MetadataParam) MarshalJSON() (data []byte, err error)
func (*MetadataParam) UnmarshalJSON ¶
func (r *MetadataParam) UnmarshalJSON(data []byte) error
type Model ¶
type Model = string
The model that will complete your prompt.\n\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
const ( ModelClaudeOpus4_7 Model = "claude-opus-4-7" ModelClaudeMythosPreview Model = "claude-mythos-preview" ModelClaudeOpus4_6 Model = "claude-opus-4-6" ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6" ModelClaudeHaiku4_5 Model = "claude-haiku-4-5" ModelClaudeHaiku4_5_20251001 Model = "claude-haiku-4-5-20251001" ModelClaudeOpus4_5 Model = "claude-opus-4-5" ModelClaudeOpus4_5_20251101 Model = "claude-opus-4-5-20251101" ModelClaudeSonnet4_5 Model = "claude-sonnet-4-5" ModelClaudeSonnet4_5_20250929 Model = "claude-sonnet-4-5-20250929" ModelClaudeOpus4_1 Model = "claude-opus-4-1" ModelClaudeOpus4_1_20250805 Model = "claude-opus-4-1-20250805" // Deprecated: Will reach end-of-life on June 15th, 2026. Please migrate to a newer // model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for // more information. ModelClaudeOpus4_0 Model = "claude-opus-4-0" // Deprecated: Will reach end-of-life on June 15th, 2026. Please migrate to a newer // model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for // more information. ModelClaudeOpus4_20250514 Model = "claude-opus-4-20250514" // Deprecated: Will reach end-of-life on June 15th, 2026. Please migrate to a newer // model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for // more information. ModelClaudeSonnet4_0 Model = "claude-sonnet-4-0" // Deprecated: Will reach end-of-life on June 15th, 2026. Please migrate to a newer // model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for // more information. ModelClaudeSonnet4_20250514 Model = "claude-sonnet-4-20250514" // Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to // claude-haiku-4-5. Visit // https://docs.anthropic.com/en/docs/resources/model-deprecations for more // information. ModelClaude_3_Haiku_20240307 Model = "claude-3-haiku-20240307" )
type ModelCapabilities ¶ added in v1.27.1
type ModelCapabilities struct {
// Whether the model supports the Batch API.
Batch CapabilitySupport `json:"batch" api:"required"`
// Whether the model supports citation generation.
Citations CapabilitySupport `json:"citations" api:"required"`
// Whether the model supports code execution tools.
CodeExecution CapabilitySupport `json:"code_execution" api:"required"`
// Context management support and available strategies.
ContextManagement ContextManagementCapability `json:"context_management" api:"required"`
// Effort (reasoning_effort) support and available levels.
Effort EffortCapability `json:"effort" api:"required"`
// Whether the model accepts image content blocks.
ImageInput CapabilitySupport `json:"image_input" api:"required"`
// Whether the model accepts PDF content blocks.
PDFInput CapabilitySupport `json:"pdf_input" api:"required"`
// Whether the model supports structured output / JSON mode / strict tool schemas.
StructuredOutputs CapabilitySupport `json:"structured_outputs" api:"required"`
// Thinking capability and supported type configurations.
Thinking ThinkingCapability `json:"thinking" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Batch respjson.Field
Citations respjson.Field
CodeExecution respjson.Field
ContextManagement respjson.Field
Effort respjson.Field
ImageInput respjson.Field
PDFInput respjson.Field
StructuredOutputs respjson.Field
Thinking respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Model capability information.
func (ModelCapabilities) RawJSON ¶ added in v1.27.1
func (r ModelCapabilities) RawJSON() string
Returns the unmodified JSON received from the API
func (*ModelCapabilities) UnmarshalJSON ¶ added in v1.27.1
func (r *ModelCapabilities) UnmarshalJSON(data []byte) error
type ModelGetParams ¶
type ModelGetParams struct {
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
type ModelInfo ¶
type ModelInfo struct {
// Unique model identifier.
ID string `json:"id" api:"required"`
// Model capability information.
Capabilities ModelCapabilities `json:"capabilities" api:"required"`
// RFC 3339 datetime string representing the time at which the model was released.
// May be set to an epoch value if the release date is unknown.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// A human-readable name for the model.
DisplayName string `json:"display_name" api:"required"`
// Maximum input context window size in tokens for this model.
MaxInputTokens int64 `json:"max_input_tokens" api:"required"`
// Maximum value for the `max_tokens` parameter when using this model.
MaxTokens int64 `json:"max_tokens" api:"required"`
// Object type.
//
// For Models, this is always `"model"`.
Type constant.Model `json:"type" default:"model"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Capabilities respjson.Field
CreatedAt respjson.Field
DisplayName respjson.Field
MaxInputTokens respjson.Field
MaxTokens respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*ModelInfo) UnmarshalJSON ¶
type ModelListParams ¶
type ModelListParams struct {
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately after this object.
AfterID param.Opt[string] `query:"after_id,omitzero" json:"-"`
// ID of the object to use as a cursor for pagination. When provided, returns the
// page of results immediately before this object.
BeforeID param.Opt[string] `query:"before_id,omitzero" json:"-"`
// Number of items to return per page.
//
// Defaults to `20`. Ranges from `1` to `1000`.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Optional header to specify the beta version(s) you want to use.
Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ModelListParams) URLQuery ¶
func (r ModelListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ModelListParams's query parameters as `url.Values`.
type ModelService ¶
type ModelService struct {
Options []option.RequestOption
}
ModelService contains methods and other services that help with interacting with the anthropic API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewModelService method instead.
func NewModelService ¶
func NewModelService(opts ...option.RequestOption) (r ModelService)
NewModelService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ModelService) Get ¶
func (r *ModelService) Get(ctx context.Context, modelID string, query ModelGetParams, opts ...option.RequestOption) (res *ModelInfo, err error)
Get a specific model.
The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.
func (*ModelService) List ¶
func (r *ModelService) List(ctx context.Context, params ModelListParams, opts ...option.RequestOption) (res *pagination.Page[ModelInfo], err error)
List available models.
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
func (*ModelService) ListAutoPaging ¶
func (r *ModelService) ListAutoPaging(ctx context.Context, params ModelListParams, opts ...option.RequestOption) *pagination.PageAutoPager[ModelInfo]
List available models.
The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.
type NotFoundError ¶
type NotFoundError = shared.NotFoundError
This is an alias to an internal type.
type OutputConfigEffort ¶ added in v1.21.0
type OutputConfigEffort string
All possible effort levels.
const ( OutputConfigEffortLow OutputConfigEffort = "low" OutputConfigEffortMedium OutputConfigEffort = "medium" OutputConfigEffortHigh OutputConfigEffort = "high" OutputConfigEffortXhigh OutputConfigEffort = "xhigh" OutputConfigEffortMax OutputConfigEffort = "max" )
type OutputConfigParam ¶ added in v1.20.0
type OutputConfigParam struct {
// All possible effort levels.
//
// Any of "low", "medium", "high", "xhigh", "max".
Effort OutputConfigEffort `json:"effort,omitzero"`
// A schema to specify Claude's output format in responses. See
// [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
Format JSONOutputFormatParam `json:"format,omitzero"`
// contains filtered or unexported fields
}
func (OutputConfigParam) MarshalJSON ¶ added in v1.20.0
func (r OutputConfigParam) MarshalJSON() (data []byte, err error)
func (*OutputConfigParam) UnmarshalJSON ¶ added in v1.20.0
func (r *OutputConfigParam) UnmarshalJSON(data []byte) error
type OverloadedError ¶
type OverloadedError = shared.OverloadedError
This is an alias to an internal type.
type PermissionError ¶
type PermissionError = shared.PermissionError
This is an alias to an internal type.
type PlainTextSource ¶ added in v1.23.0
type PlainTextSource struct {
Data string `json:"data" api:"required"`
MediaType constant.TextPlain `json:"media_type" default:"text/plain"`
Type constant.Text `json:"type" default:"text"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
MediaType respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PlainTextSource) RawJSON ¶ added in v1.23.0
func (r PlainTextSource) RawJSON() string
Returns the unmodified JSON received from the API
func (PlainTextSource) ToParam ¶ added in v1.23.0
func (r PlainTextSource) ToParam() PlainTextSourceParam
ToParam converts this PlainTextSource to a PlainTextSourceParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with PlainTextSourceParam.Overrides()
func (*PlainTextSource) UnmarshalJSON ¶ added in v1.23.0
func (r *PlainTextSource) UnmarshalJSON(data []byte) error
type PlainTextSourceParam ¶
type PlainTextSourceParam struct {
Data string `json:"data" api:"required"`
// This field can be elided, and will marshal its zero value as "text/plain".
MediaType constant.TextPlain `json:"media_type" default:"text/plain"`
// This field can be elided, and will marshal its zero value as "text".
Type constant.Text `json:"type" default:"text"`
// contains filtered or unexported fields
}
The properties Data, MediaType, Type are required.
func (PlainTextSourceParam) MarshalJSON ¶
func (r PlainTextSourceParam) MarshalJSON() (data []byte, err error)
func (*PlainTextSourceParam) UnmarshalJSON ¶
func (r *PlainTextSourceParam) UnmarshalJSON(data []byte) error
type RateLimitError ¶
type RateLimitError = shared.RateLimitError
This is an alias to an internal type.
type RawContentBlockDeltaUnion ¶
type RawContentBlockDeltaUnion struct {
// This field is from variant [TextDelta].
Text string `json:"text"`
// Any of "text_delta", "input_json_delta", "citations_delta", "thinking_delta",
// "signature_delta".
Type string `json:"type"`
// This field is from variant [InputJSONDelta].
PartialJSON string `json:"partial_json"`
// This field is from variant [CitationsDelta].
Citation CitationsDeltaCitationUnion `json:"citation"`
// This field is from variant [ThinkingDelta].
Thinking string `json:"thinking"`
// This field is from variant [SignatureDelta].
Signature string `json:"signature"`
JSON struct {
Text respjson.Field
Type respjson.Field
PartialJSON respjson.Field
Citation respjson.Field
Thinking respjson.Field
Signature respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RawContentBlockDeltaUnion contains all possible properties and values from TextDelta, InputJSONDelta, CitationsDelta, ThinkingDelta, SignatureDelta.
Use the RawContentBlockDeltaUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (RawContentBlockDeltaUnion) AsAny ¶
func (u RawContentBlockDeltaUnion) AsAny() anyRawContentBlockDelta
Use the following switch statement to find the correct variant
switch variant := RawContentBlockDeltaUnion.AsAny().(type) {
case anthropic.TextDelta:
case anthropic.InputJSONDelta:
case anthropic.CitationsDelta:
case anthropic.ThinkingDelta:
case anthropic.SignatureDelta:
default:
fmt.Errorf("no variant present")
}
func (RawContentBlockDeltaUnion) AsCitationsDelta ¶
func (u RawContentBlockDeltaUnion) AsCitationsDelta() (v CitationsDelta)
func (RawContentBlockDeltaUnion) AsInputJSONDelta ¶
func (u RawContentBlockDeltaUnion) AsInputJSONDelta() (v InputJSONDelta)
func (RawContentBlockDeltaUnion) AsSignatureDelta ¶
func (u RawContentBlockDeltaUnion) AsSignatureDelta() (v SignatureDelta)
func (RawContentBlockDeltaUnion) AsTextDelta ¶
func (u RawContentBlockDeltaUnion) AsTextDelta() (v TextDelta)
func (RawContentBlockDeltaUnion) AsThinkingDelta ¶
func (u RawContentBlockDeltaUnion) AsThinkingDelta() (v ThinkingDelta)
func (RawContentBlockDeltaUnion) RawJSON ¶
func (u RawContentBlockDeltaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RawContentBlockDeltaUnion) UnmarshalJSON ¶
func (r *RawContentBlockDeltaUnion) UnmarshalJSON(data []byte) error
type RedactedThinkingBlock ¶
type RedactedThinkingBlock struct {
Data string `json:"data" api:"required"`
Type constant.RedactedThinking `json:"type" default:"redacted_thinking"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (RedactedThinkingBlock) RawJSON ¶
func (r RedactedThinkingBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (RedactedThinkingBlock) ToParam ¶
func (r RedactedThinkingBlock) ToParam() RedactedThinkingBlockParam
func (*RedactedThinkingBlock) UnmarshalJSON ¶
func (r *RedactedThinkingBlock) UnmarshalJSON(data []byte) error
type RedactedThinkingBlockParam ¶
type RedactedThinkingBlockParam struct {
Data string `json:"data" api:"required"`
// This field can be elided, and will marshal its zero value as
// "redacted_thinking".
Type constant.RedactedThinking `json:"type" default:"redacted_thinking"`
// contains filtered or unexported fields
}
The properties Data, Type are required.
func (RedactedThinkingBlockParam) MarshalJSON ¶
func (r RedactedThinkingBlockParam) MarshalJSON() (data []byte, err error)
func (*RedactedThinkingBlockParam) UnmarshalJSON ¶
func (r *RedactedThinkingBlockParam) UnmarshalJSON(data []byte) error
type RefusalStopDetails ¶ added in v1.29.0
type RefusalStopDetails struct {
// The policy category that triggered the refusal.
//
// `null` when the refusal doesn't map to a named category.
//
// Any of "cyber", "bio".
Category RefusalStopDetailsCategory `json:"category" api:"required"`
// Human-readable explanation of the refusal.
//
// This text is not guaranteed to be stable. `null` when no explanation is
// available for the category.
Explanation string `json:"explanation" api:"required"`
Type constant.Refusal `json:"type" default:"refusal"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Category respjson.Field
Explanation respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Structured information about a refusal.
func (RefusalStopDetails) RawJSON ¶ added in v1.29.0
func (r RefusalStopDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*RefusalStopDetails) UnmarshalJSON ¶ added in v1.29.0
func (r *RefusalStopDetails) UnmarshalJSON(data []byte) error
type RefusalStopDetailsCategory ¶ added in v1.29.0
type RefusalStopDetailsCategory string
The policy category that triggered the refusal.
`null` when the refusal doesn't map to a named category.
const ( RefusalStopDetailsCategoryCyber RefusalStopDetailsCategory = "cyber" RefusalStopDetailsCategoryBio RefusalStopDetailsCategory = "bio" )
type SearchResultBlockParam ¶ added in v1.8.0
type SearchResultBlockParam struct {
Content []TextBlockParam `json:"content,omitzero" api:"required"`
Source string `json:"source" api:"required"`
Title string `json:"title" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
Citations CitationsConfigParam `json:"citations,omitzero"`
// This field can be elided, and will marshal its zero value as "search_result".
Type constant.SearchResult `json:"type" default:"search_result"`
// contains filtered or unexported fields
}
The properties Content, Source, Title, Type are required.
func (SearchResultBlockParam) MarshalJSON ¶ added in v1.8.0
func (r SearchResultBlockParam) MarshalJSON() (data []byte, err error)
func (*SearchResultBlockParam) UnmarshalJSON ¶ added in v1.8.0
func (r *SearchResultBlockParam) UnmarshalJSON(data []byte) error
type ServerToolCaller ¶ added in v1.23.0
type ServerToolCaller struct {
ToolID string `json:"tool_id" api:"required"`
Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Tool invocation generated by a server-side tool.
func (ServerToolCaller) RawJSON ¶ added in v1.23.0
func (r ServerToolCaller) RawJSON() string
Returns the unmodified JSON received from the API
func (ServerToolCaller) ToParam ¶ added in v1.23.0
func (r ServerToolCaller) ToParam() ServerToolCallerParam
ToParam converts this ServerToolCaller to a ServerToolCallerParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ServerToolCallerParam.Overrides()
func (*ServerToolCaller) UnmarshalJSON ¶ added in v1.23.0
func (r *ServerToolCaller) UnmarshalJSON(data []byte) error
type ServerToolCaller20260120 ¶ added in v1.24.0
type ServerToolCaller20260120 struct {
ToolID string `json:"tool_id" api:"required"`
Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ServerToolCaller20260120) RawJSON ¶ added in v1.24.0
func (r ServerToolCaller20260120) RawJSON() string
Returns the unmodified JSON received from the API
func (ServerToolCaller20260120) ToParam ¶ added in v1.24.0
func (r ServerToolCaller20260120) ToParam() ServerToolCaller20260120Param
ToParam converts this ServerToolCaller20260120 to a ServerToolCaller20260120Param.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ServerToolCaller20260120Param.Overrides()
func (*ServerToolCaller20260120) UnmarshalJSON ¶ added in v1.24.0
func (r *ServerToolCaller20260120) UnmarshalJSON(data []byte) error
type ServerToolCaller20260120Param ¶ added in v1.24.0
type ServerToolCaller20260120Param struct {
ToolID string `json:"tool_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20260120".
Type constant.CodeExecution20260120 `json:"type" default:"code_execution_20260120"`
// contains filtered or unexported fields
}
The properties ToolID, Type are required.
func (ServerToolCaller20260120Param) MarshalJSON ¶ added in v1.24.0
func (r ServerToolCaller20260120Param) MarshalJSON() (data []byte, err error)
func (*ServerToolCaller20260120Param) UnmarshalJSON ¶ added in v1.24.0
func (r *ServerToolCaller20260120Param) UnmarshalJSON(data []byte) error
type ServerToolCallerParam ¶ added in v1.23.0
type ServerToolCallerParam struct {
ToolID string `json:"tool_id" api:"required"`
// This field can be elided, and will marshal its zero value as
// "code_execution_20250825".
Type constant.CodeExecution20250825 `json:"type" default:"code_execution_20250825"`
// contains filtered or unexported fields
}
Tool invocation generated by a server-side tool.
The properties ToolID, Type are required.
func (ServerToolCallerParam) MarshalJSON ¶ added in v1.23.0
func (r ServerToolCallerParam) MarshalJSON() (data []byte, err error)
func (*ServerToolCallerParam) UnmarshalJSON ¶ added in v1.23.0
func (r *ServerToolCallerParam) UnmarshalJSON(data []byte) error
type ServerToolUsage ¶
type ServerToolUsage struct {
// The number of web fetch tool requests.
WebFetchRequests int64 `json:"web_fetch_requests" api:"required"`
// The number of web search tool requests.
WebSearchRequests int64 `json:"web_search_requests" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
WebFetchRequests respjson.Field
WebSearchRequests respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ServerToolUsage) RawJSON ¶
func (r ServerToolUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*ServerToolUsage) UnmarshalJSON ¶
func (r *ServerToolUsage) UnmarshalJSON(data []byte) error
type ServerToolUseBlock ¶
type ServerToolUseBlock struct {
ID string `json:"id" api:"required"`
// Tool invocation directly from the model.
Caller ServerToolUseBlockCallerUnion `json:"caller" api:"required"`
Input any `json:"input" api:"required"`
// Any of "web_search", "web_fetch", "code_execution", "bash_code_execution",
// "text_editor_code_execution", "tool_search_tool_regex", "tool_search_tool_bm25".
Name ServerToolUseBlockName `json:"name" api:"required"`
Type constant.ServerToolUse `json:"type" default:"server_tool_use"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Caller respjson.Field
Input respjson.Field
Name respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ServerToolUseBlock) RawJSON ¶
func (r ServerToolUseBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ServerToolUseBlock) ToParam ¶ added in v1.20.0
func (r ServerToolUseBlock) ToParam() ServerToolUseBlockParam
func (*ServerToolUseBlock) UnmarshalJSON ¶
func (r *ServerToolUseBlock) UnmarshalJSON(data []byte) error
type ServerToolUseBlockCallerUnion ¶ added in v1.23.0
type ServerToolUseBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ServerToolUseBlockCallerUnion contains all possible properties and values from DirectCaller, ServerToolCaller, ServerToolCaller20260120.
Use the ServerToolUseBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ServerToolUseBlockCallerUnion) AsAny ¶ added in v1.23.0
func (u ServerToolUseBlockCallerUnion) AsAny() anyServerToolUseBlockCaller
Use the following switch statement to find the correct variant
switch variant := ServerToolUseBlockCallerUnion.AsAny().(type) {
case anthropic.DirectCaller:
case anthropic.ServerToolCaller:
case anthropic.ServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (ServerToolUseBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.23.0
func (u ServerToolUseBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
func (ServerToolUseBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u ServerToolUseBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
func (ServerToolUseBlockCallerUnion) AsDirect ¶ added in v1.23.0
func (u ServerToolUseBlockCallerUnion) AsDirect() (v DirectCaller)
func (ServerToolUseBlockCallerUnion) RawJSON ¶ added in v1.23.0
func (u ServerToolUseBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ServerToolUseBlockCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *ServerToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
type ServerToolUseBlockName ¶ added in v1.23.0
type ServerToolUseBlockName string
const ( ServerToolUseBlockNameWebSearch ServerToolUseBlockName = "web_search" ServerToolUseBlockNameWebFetch ServerToolUseBlockName = "web_fetch" ServerToolUseBlockNameCodeExecution ServerToolUseBlockName = "code_execution" ServerToolUseBlockNameBashCodeExecution ServerToolUseBlockName = "bash_code_execution" ServerToolUseBlockNameTextEditorCodeExecution ServerToolUseBlockName = "text_editor_code_execution" ServerToolUseBlockNameToolSearchToolRegex ServerToolUseBlockName = "tool_search_tool_regex" ServerToolUseBlockNameToolSearchToolBm25 ServerToolUseBlockName = "tool_search_tool_bm25" )
type ServerToolUseBlockParam ¶
type ServerToolUseBlockParam struct {
ID string `json:"id" api:"required"`
Input any `json:"input,omitzero" api:"required"`
// Any of "web_search", "web_fetch", "code_execution", "bash_code_execution",
// "text_editor_code_execution", "tool_search_tool_regex", "tool_search_tool_bm25".
Name ServerToolUseBlockParamName `json:"name,omitzero" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller ServerToolUseBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as "server_tool_use".
Type constant.ServerToolUse `json:"type" default:"server_tool_use"`
// contains filtered or unexported fields
}
The properties ID, Input, Name, Type are required.
func (ServerToolUseBlockParam) MarshalJSON ¶
func (r ServerToolUseBlockParam) MarshalJSON() (data []byte, err error)
func (*ServerToolUseBlockParam) UnmarshalJSON ¶
func (r *ServerToolUseBlockParam) UnmarshalJSON(data []byte) error
type ServerToolUseBlockParamCallerUnion ¶ added in v1.23.0
type ServerToolUseBlockParamCallerUnion struct {
OfDirect *DirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *ServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *ServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ServerToolUseBlockParamCallerUnion) GetToolID ¶ added in v1.23.0
func (u ServerToolUseBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (ServerToolUseBlockParamCallerUnion) GetType ¶ added in v1.23.0
func (u ServerToolUseBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ServerToolUseBlockParamCallerUnion) MarshalJSON ¶ added in v1.23.0
func (u ServerToolUseBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*ServerToolUseBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *ServerToolUseBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type ServerToolUseBlockParamName ¶ added in v1.23.0
type ServerToolUseBlockParamName string
const ( ServerToolUseBlockParamNameWebSearch ServerToolUseBlockParamName = "web_search" ServerToolUseBlockParamNameWebFetch ServerToolUseBlockParamName = "web_fetch" ServerToolUseBlockParamNameCodeExecution ServerToolUseBlockParamName = "code_execution" ServerToolUseBlockParamNameBashCodeExecution ServerToolUseBlockParamName = "bash_code_execution" ServerToolUseBlockParamNameTextEditorCodeExecution ServerToolUseBlockParamName = "text_editor_code_execution" ServerToolUseBlockParamNameToolSearchToolRegex ServerToolUseBlockParamName = "tool_search_tool_regex" ServerToolUseBlockParamNameToolSearchToolBm25 ServerToolUseBlockParamName = "tool_search_tool_bm25" )
type SignatureDelta ¶
type SignatureDelta struct {
Signature string `json:"signature" api:"required"`
Type constant.SignatureDelta `json:"type" default:"signature_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Signature respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SignatureDelta) RawJSON ¶
func (r SignatureDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*SignatureDelta) UnmarshalJSON ¶
func (r *SignatureDelta) UnmarshalJSON(data []byte) error
type StopReason ¶
type StopReason string
const ( StopReasonEndTurn StopReason = "end_turn" StopReasonMaxTokens StopReason = "max_tokens" StopReasonStopSequence StopReason = "stop_sequence" StopReasonToolUse StopReason = "tool_use" StopReasonPauseTurn StopReason = "pause_turn" StopReasonRefusal StopReason = "refusal" )
type TextBlock ¶
type TextBlock struct {
// Citations supporting the text block.
//
// The type of citation returned will depend on the type of document being cited.
// Citing a PDF results in `page_location`, plain text results in `char_location`,
// and content document results in `content_block_location`.
Citations []TextCitationUnion `json:"citations" api:"required"`
Text string `json:"text" api:"required"`
Type constant.Text `json:"type" default:"text"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Citations respjson.Field
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TextBlock) ToParam ¶
func (r TextBlock) ToParam() TextBlockParam
func (*TextBlock) UnmarshalJSON ¶
type TextBlockParam ¶
type TextBlockParam struct {
Text string `json:"text" api:"required"`
Citations []TextCitationParamUnion `json:"citations,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "text".
Type constant.Text `json:"type" default:"text"`
// contains filtered or unexported fields
}
The properties Text, Type are required.
func (TextBlockParam) MarshalJSON ¶
func (r TextBlockParam) MarshalJSON() (data []byte, err error)
func (*TextBlockParam) UnmarshalJSON ¶
func (r *TextBlockParam) UnmarshalJSON(data []byte) error
type TextCitationParamUnion ¶
type TextCitationParamUnion struct {
OfCharLocation *CitationCharLocationParam `json:",omitzero,inline"`
OfPageLocation *CitationPageLocationParam `json:",omitzero,inline"`
OfContentBlockLocation *CitationContentBlockLocationParam `json:",omitzero,inline"`
OfWebSearchResultLocation *CitationWebSearchResultLocationParam `json:",omitzero,inline"`
OfSearchResultLocation *CitationSearchResultLocationParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (TextCitationParamUnion) GetCitedText ¶
func (u TextCitationParamUnion) GetCitedText() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetDocumentIndex ¶
func (u TextCitationParamUnion) GetDocumentIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetDocumentTitle ¶
func (u TextCitationParamUnion) GetDocumentTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetEncryptedIndex ¶
func (u TextCitationParamUnion) GetEncryptedIndex() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetEndBlockIndex ¶
func (u TextCitationParamUnion) GetEndBlockIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetEndCharIndex ¶
func (u TextCitationParamUnion) GetEndCharIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetEndPageNumber ¶
func (u TextCitationParamUnion) GetEndPageNumber() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetSearchResultIndex ¶ added in v1.8.0
func (u TextCitationParamUnion) GetSearchResultIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetSource ¶ added in v1.8.0
func (u TextCitationParamUnion) GetSource() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetStartBlockIndex ¶
func (u TextCitationParamUnion) GetStartBlockIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetStartCharIndex ¶
func (u TextCitationParamUnion) GetStartCharIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetStartPageNumber ¶
func (u TextCitationParamUnion) GetStartPageNumber() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetTitle ¶
func (u TextCitationParamUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetType ¶
func (u TextCitationParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) GetURL ¶
func (u TextCitationParamUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (TextCitationParamUnion) MarshalJSON ¶
func (u TextCitationParamUnion) MarshalJSON() ([]byte, error)
func (*TextCitationParamUnion) UnmarshalJSON ¶
func (u *TextCitationParamUnion) UnmarshalJSON(data []byte) error
type TextCitationUnion ¶
type TextCitationUnion struct {
CitedText string `json:"cited_text"`
DocumentIndex int64 `json:"document_index"`
DocumentTitle string `json:"document_title"`
// This field is from variant [CitationCharLocation].
EndCharIndex int64 `json:"end_char_index"`
FileID string `json:"file_id"`
// This field is from variant [CitationCharLocation].
StartCharIndex int64 `json:"start_char_index"`
// Any of "char_location", "page_location", "content_block_location",
// "web_search_result_location", "search_result_location".
Type string `json:"type"`
// This field is from variant [CitationPageLocation].
EndPageNumber int64 `json:"end_page_number"`
// This field is from variant [CitationPageLocation].
StartPageNumber int64 `json:"start_page_number"`
EndBlockIndex int64 `json:"end_block_index"`
StartBlockIndex int64 `json:"start_block_index"`
// This field is from variant [CitationsWebSearchResultLocation].
EncryptedIndex string `json:"encrypted_index"`
Title string `json:"title"`
// This field is from variant [CitationsWebSearchResultLocation].
URL string `json:"url"`
// This field is from variant [CitationsSearchResultLocation].
SearchResultIndex int64 `json:"search_result_index"`
// This field is from variant [CitationsSearchResultLocation].
Source string `json:"source"`
JSON struct {
CitedText respjson.Field
DocumentIndex respjson.Field
DocumentTitle respjson.Field
EndCharIndex respjson.Field
FileID respjson.Field
StartCharIndex respjson.Field
Type respjson.Field
EndPageNumber respjson.Field
StartPageNumber respjson.Field
EndBlockIndex respjson.Field
StartBlockIndex respjson.Field
EncryptedIndex respjson.Field
Title respjson.Field
URL respjson.Field
SearchResultIndex respjson.Field
Source respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
TextCitationUnion contains all possible properties and values from CitationCharLocation, CitationPageLocation, CitationContentBlockLocation, CitationsWebSearchResultLocation, CitationsSearchResultLocation.
Use the TextCitationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (TextCitationUnion) AsAny ¶
func (u TextCitationUnion) AsAny() anyTextCitation
Use the following switch statement to find the correct variant
switch variant := TextCitationUnion.AsAny().(type) {
case anthropic.CitationCharLocation:
case anthropic.CitationPageLocation:
case anthropic.CitationContentBlockLocation:
case anthropic.CitationsWebSearchResultLocation:
case anthropic.CitationsSearchResultLocation:
default:
fmt.Errorf("no variant present")
}
func (TextCitationUnion) AsCharLocation ¶
func (u TextCitationUnion) AsCharLocation() (v CitationCharLocation)
func (TextCitationUnion) AsContentBlockLocation ¶
func (u TextCitationUnion) AsContentBlockLocation() (v CitationContentBlockLocation)
func (TextCitationUnion) AsPageLocation ¶
func (u TextCitationUnion) AsPageLocation() (v CitationPageLocation)
func (TextCitationUnion) AsSearchResultLocation ¶ added in v1.8.0
func (u TextCitationUnion) AsSearchResultLocation() (v CitationsSearchResultLocation)
func (TextCitationUnion) AsWebSearchResultLocation ¶
func (u TextCitationUnion) AsWebSearchResultLocation() (v CitationsWebSearchResultLocation)
func (TextCitationUnion) RawJSON ¶
func (u TextCitationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextCitationUnion) UnmarshalJSON ¶
func (r *TextCitationUnion) UnmarshalJSON(data []byte) error
type TextDelta ¶
type TextDelta struct {
Text string `json:"text" api:"required"`
Type constant.TextDelta `json:"type" default:"text_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*TextDelta) UnmarshalJSON ¶
type TextEditorCodeExecutionCreateResultBlock ¶ added in v1.23.0
type TextEditorCodeExecutionCreateResultBlock struct {
IsFileUpdate bool `json:"is_file_update" api:"required"`
Type constant.TextEditorCodeExecutionCreateResult `json:"type" default:"text_editor_code_execution_create_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
IsFileUpdate respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TextEditorCodeExecutionCreateResultBlock) RawJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionCreateResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextEditorCodeExecutionCreateResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionCreateResultBlock) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionCreateResultBlockParam ¶ added in v1.23.0
type TextEditorCodeExecutionCreateResultBlockParam struct {
IsFileUpdate bool `json:"is_file_update" api:"required"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_create_result".
Type constant.TextEditorCodeExecutionCreateResult `json:"type" default:"text_editor_code_execution_create_result"`
// contains filtered or unexported fields
}
The properties IsFileUpdate, Type are required.
func (TextEditorCodeExecutionCreateResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionCreateResultBlockParam) MarshalJSON() (data []byte, err error)
func (*TextEditorCodeExecutionCreateResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionCreateResultBlockParam) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionStrReplaceResultBlock ¶ added in v1.23.0
type TextEditorCodeExecutionStrReplaceResultBlock struct {
Lines []string `json:"lines" api:"required"`
NewLines int64 `json:"new_lines" api:"required"`
NewStart int64 `json:"new_start" api:"required"`
OldLines int64 `json:"old_lines" api:"required"`
OldStart int64 `json:"old_start" api:"required"`
Type constant.TextEditorCodeExecutionStrReplaceResult `json:"type" default:"text_editor_code_execution_str_replace_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TextEditorCodeExecutionStrReplaceResultBlock) RawJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionStrReplaceResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextEditorCodeExecutionStrReplaceResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionStrReplaceResultBlock) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionStrReplaceResultBlockParam ¶ added in v1.23.0
type TextEditorCodeExecutionStrReplaceResultBlockParam struct {
NewLines param.Opt[int64] `json:"new_lines,omitzero"`
NewStart param.Opt[int64] `json:"new_start,omitzero"`
OldLines param.Opt[int64] `json:"old_lines,omitzero"`
OldStart param.Opt[int64] `json:"old_start,omitzero"`
Lines []string `json:"lines,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_str_replace_result".
Type constant.TextEditorCodeExecutionStrReplaceResult `json:"type" default:"text_editor_code_execution_str_replace_result"`
// contains filtered or unexported fields
}
The property Type is required.
func (TextEditorCodeExecutionStrReplaceResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionStrReplaceResultBlockParam) MarshalJSON() (data []byte, err error)
func (*TextEditorCodeExecutionStrReplaceResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionStrReplaceResultBlockParam) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionToolResultBlock ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultBlock struct {
Content TextEditorCodeExecutionToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.TextEditorCodeExecutionToolResult `json:"type" default:"text_editor_code_execution_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TextEditorCodeExecutionToolResultBlock) RawJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextEditorCodeExecutionToolResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionToolResultBlock) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionToolResultBlockContentUnion ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultBlockContentUnion struct {
// This field is from variant [TextEditorCodeExecutionToolResultError].
ErrorCode TextEditorCodeExecutionToolResultErrorCode `json:"error_code"`
// This field is from variant [TextEditorCodeExecutionToolResultError].
ErrorMessage string `json:"error_message"`
Type string `json:"type"`
// This field is from variant [TextEditorCodeExecutionViewResultBlock].
Content string `json:"content"`
// This field is from variant [TextEditorCodeExecutionViewResultBlock].
FileType TextEditorCodeExecutionViewResultBlockFileType `json:"file_type"`
// This field is from variant [TextEditorCodeExecutionViewResultBlock].
NumLines int64 `json:"num_lines"`
// This field is from variant [TextEditorCodeExecutionViewResultBlock].
StartLine int64 `json:"start_line"`
// This field is from variant [TextEditorCodeExecutionViewResultBlock].
TotalLines int64 `json:"total_lines"`
// This field is from variant [TextEditorCodeExecutionCreateResultBlock].
IsFileUpdate bool `json:"is_file_update"`
// This field is from variant [TextEditorCodeExecutionStrReplaceResultBlock].
Lines []string `json:"lines"`
// This field is from variant [TextEditorCodeExecutionStrReplaceResultBlock].
NewLines int64 `json:"new_lines"`
// This field is from variant [TextEditorCodeExecutionStrReplaceResultBlock].
NewStart int64 `json:"new_start"`
// This field is from variant [TextEditorCodeExecutionStrReplaceResultBlock].
OldLines int64 `json:"old_lines"`
// This field is from variant [TextEditorCodeExecutionStrReplaceResultBlock].
OldStart int64 `json:"old_start"`
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
Content respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
IsFileUpdate respjson.Field
Lines respjson.Field
NewLines respjson.Field
NewStart respjson.Field
OldLines respjson.Field
OldStart respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
TextEditorCodeExecutionToolResultBlockContentUnion contains all possible properties and values from TextEditorCodeExecutionToolResultError, TextEditorCodeExecutionViewResultBlock, TextEditorCodeExecutionCreateResultBlock, TextEditorCodeExecutionStrReplaceResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionCreateResultBlock() (v TextEditorCodeExecutionCreateResultBlock)
func (TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionStrReplaceResultBlock() (v TextEditorCodeExecutionStrReplaceResultBlock)
func (TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionToolResultError() (v TextEditorCodeExecutionToolResultError)
func (TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockContentUnion) AsResponseTextEditorCodeExecutionViewResultBlock() (v TextEditorCodeExecutionViewResultBlock)
func (TextEditorCodeExecutionToolResultBlockContentUnion) RawJSON ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionToolResultBlockParam ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultBlockParam struct {
Content TextEditorCodeExecutionToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_tool_result".
Type constant.TextEditorCodeExecutionToolResult `json:"type" default:"text_editor_code_execution_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (TextEditorCodeExecutionToolResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*TextEditorCodeExecutionToolResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionToolResultBlockParam) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionToolResultBlockParamContentUnion ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultBlockParamContentUnion struct {
OfRequestTextEditorCodeExecutionToolResultError *TextEditorCodeExecutionToolResultErrorParam `json:",omitzero,inline"`
OfRequestTextEditorCodeExecutionViewResultBlock *TextEditorCodeExecutionViewResultBlockParam `json:",omitzero,inline"`
OfRequestTextEditorCodeExecutionCreateResultBlock *TextEditorCodeExecutionCreateResultBlockParam `json:",omitzero,inline"`
OfRequestTextEditorCodeExecutionStrReplaceResultBlock *TextEditorCodeExecutionStrReplaceResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetContent() *string
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetErrorMessage() *string
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetFileType() *string
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetIsFileUpdate() *bool
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetLines() []string
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNewStart() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetNumLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetOldStart() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetStartLine() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetTotalLines() *int64
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) GetType ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (TextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.23.0
func (u TextEditorCodeExecutionToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*TextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *TextEditorCodeExecutionToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionToolResultError ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "file_not_found".
ErrorCode TextEditorCodeExecutionToolResultErrorCode `json:"error_code" api:"required"`
ErrorMessage string `json:"error_message" api:"required"`
Type constant.TextEditorCodeExecutionToolResultError `json:"type" default:"text_editor_code_execution_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TextEditorCodeExecutionToolResultError) RawJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextEditorCodeExecutionToolResultError) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionToolResultError) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionToolResultErrorCode ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultErrorCode string
const ( TextEditorCodeExecutionToolResultErrorCodeInvalidToolInput TextEditorCodeExecutionToolResultErrorCode = "invalid_tool_input" TextEditorCodeExecutionToolResultErrorCodeTooManyRequests TextEditorCodeExecutionToolResultErrorCode = "too_many_requests" TextEditorCodeExecutionToolResultErrorCodeExecutionTimeExceeded TextEditorCodeExecutionToolResultErrorCode = "execution_time_exceeded" TextEditorCodeExecutionToolResultErrorCodeFileNotFound TextEditorCodeExecutionToolResultErrorCode = "file_not_found" )
type TextEditorCodeExecutionToolResultErrorParam ¶ added in v1.23.0
type TextEditorCodeExecutionToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded", "file_not_found".
ErrorCode TextEditorCodeExecutionToolResultErrorCode `json:"error_code,omitzero" api:"required"`
ErrorMessage param.Opt[string] `json:"error_message,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_tool_result_error".
Type constant.TextEditorCodeExecutionToolResultError `json:"type" default:"text_editor_code_execution_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (TextEditorCodeExecutionToolResultErrorParam) MarshalJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*TextEditorCodeExecutionToolResultErrorParam) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionToolResultErrorParam) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionViewResultBlock ¶ added in v1.23.0
type TextEditorCodeExecutionViewResultBlock struct {
Content string `json:"content" api:"required"`
// Any of "text", "image", "pdf".
FileType TextEditorCodeExecutionViewResultBlockFileType `json:"file_type" api:"required"`
NumLines int64 `json:"num_lines" api:"required"`
StartLine int64 `json:"start_line" api:"required"`
TotalLines int64 `json:"total_lines" api:"required"`
Type constant.TextEditorCodeExecutionViewResult `json:"type" default:"text_editor_code_execution_view_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
FileType respjson.Field
NumLines respjson.Field
StartLine respjson.Field
TotalLines respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (TextEditorCodeExecutionViewResultBlock) RawJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionViewResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextEditorCodeExecutionViewResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionViewResultBlock) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionViewResultBlockFileType ¶ added in v1.23.0
type TextEditorCodeExecutionViewResultBlockFileType string
const ( TextEditorCodeExecutionViewResultBlockFileTypeText TextEditorCodeExecutionViewResultBlockFileType = "text" TextEditorCodeExecutionViewResultBlockFileTypeImage TextEditorCodeExecutionViewResultBlockFileType = "image" TextEditorCodeExecutionViewResultBlockFileTypePDF TextEditorCodeExecutionViewResultBlockFileType = "pdf" )
type TextEditorCodeExecutionViewResultBlockParam ¶ added in v1.23.0
type TextEditorCodeExecutionViewResultBlockParam struct {
Content string `json:"content" api:"required"`
// Any of "text", "image", "pdf".
FileType TextEditorCodeExecutionViewResultBlockParamFileType `json:"file_type,omitzero" api:"required"`
NumLines param.Opt[int64] `json:"num_lines,omitzero"`
StartLine param.Opt[int64] `json:"start_line,omitzero"`
TotalLines param.Opt[int64] `json:"total_lines,omitzero"`
// This field can be elided, and will marshal its zero value as
// "text_editor_code_execution_view_result".
Type constant.TextEditorCodeExecutionViewResult `json:"type" default:"text_editor_code_execution_view_result"`
// contains filtered or unexported fields
}
The properties Content, FileType, Type are required.
func (TextEditorCodeExecutionViewResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r TextEditorCodeExecutionViewResultBlockParam) MarshalJSON() (data []byte, err error)
func (*TextEditorCodeExecutionViewResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *TextEditorCodeExecutionViewResultBlockParam) UnmarshalJSON(data []byte) error
type TextEditorCodeExecutionViewResultBlockParamFileType ¶ added in v1.23.0
type TextEditorCodeExecutionViewResultBlockParamFileType string
const ( TextEditorCodeExecutionViewResultBlockParamFileTypeText TextEditorCodeExecutionViewResultBlockParamFileType = "text" TextEditorCodeExecutionViewResultBlockParamFileTypeImage TextEditorCodeExecutionViewResultBlockParamFileType = "image" TextEditorCodeExecutionViewResultBlockParamFileTypePDF TextEditorCodeExecutionViewResultBlockParamFileType = "pdf" )
type ThinkingBlock ¶
type ThinkingBlock struct {
Signature string `json:"signature" api:"required"`
Thinking string `json:"thinking" api:"required"`
Type constant.Thinking `json:"type" default:"thinking"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Signature respjson.Field
Thinking respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ThinkingBlock) RawJSON ¶
func (r ThinkingBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ThinkingBlock) ToParam ¶
func (r ThinkingBlock) ToParam() ThinkingBlockParam
func (*ThinkingBlock) UnmarshalJSON ¶
func (r *ThinkingBlock) UnmarshalJSON(data []byte) error
type ThinkingBlockParam ¶
type ThinkingBlockParam struct {
Signature string `json:"signature" api:"required"`
Thinking string `json:"thinking" api:"required"`
// This field can be elided, and will marshal its zero value as "thinking".
Type constant.Thinking `json:"type" default:"thinking"`
// contains filtered or unexported fields
}
The properties Signature, Thinking, Type are required.
func (ThinkingBlockParam) MarshalJSON ¶
func (r ThinkingBlockParam) MarshalJSON() (data []byte, err error)
func (*ThinkingBlockParam) UnmarshalJSON ¶
func (r *ThinkingBlockParam) UnmarshalJSON(data []byte) error
type ThinkingCapability ¶ added in v1.27.1
type ThinkingCapability struct {
// Whether this capability is supported by the model.
Supported bool `json:"supported" api:"required"`
// Supported thinking type configurations.
Types ThinkingTypes `json:"types" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Supported respjson.Field
Types respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Thinking capability details.
func (ThinkingCapability) RawJSON ¶ added in v1.27.1
func (r ThinkingCapability) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThinkingCapability) UnmarshalJSON ¶ added in v1.27.1
func (r *ThinkingCapability) UnmarshalJSON(data []byte) error
type ThinkingConfigAdaptiveDisplay ¶ added in v1.27.0
type ThinkingConfigAdaptiveDisplay string
Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
const ( ThinkingConfigAdaptiveDisplaySummarized ThinkingConfigAdaptiveDisplay = "summarized" ThinkingConfigAdaptiveDisplayOmitted ThinkingConfigAdaptiveDisplay = "omitted" )
type ThinkingConfigAdaptiveParam ¶ added in v1.21.0
type ThinkingConfigAdaptiveParam struct {
// Controls how thinking content appears in the response. When set to `summarized`,
// thinking is returned normally. When set to `omitted`, thinking content is
// redacted but a signature is returned for multi-turn continuity. Defaults to
// `summarized`.
//
// Any of "summarized", "omitted".
Display ThinkingConfigAdaptiveDisplay `json:"display,omitzero"`
// This field can be elided, and will marshal its zero value as "adaptive".
Type constant.Adaptive `json:"type" default:"adaptive"`
// contains filtered or unexported fields
}
The property Type is required.
func (ThinkingConfigAdaptiveParam) MarshalJSON ¶ added in v1.21.0
func (r ThinkingConfigAdaptiveParam) MarshalJSON() (data []byte, err error)
func (*ThinkingConfigAdaptiveParam) UnmarshalJSON ¶ added in v1.21.0
func (r *ThinkingConfigAdaptiveParam) UnmarshalJSON(data []byte) error
type ThinkingConfigDisabledParam ¶
type ThinkingConfigDisabledParam struct {
Type constant.Disabled `json:"type" default:"disabled"`
// contains filtered or unexported fields
}
This struct has a constant value, construct it with NewThinkingConfigDisabledParam.
func NewThinkingConfigDisabledParam ¶
func NewThinkingConfigDisabledParam() ThinkingConfigDisabledParam
func (ThinkingConfigDisabledParam) MarshalJSON ¶
func (r ThinkingConfigDisabledParam) MarshalJSON() (data []byte, err error)
func (*ThinkingConfigDisabledParam) UnmarshalJSON ¶
func (r *ThinkingConfigDisabledParam) UnmarshalJSON(data []byte) error
type ThinkingConfigEnabledDisplay ¶ added in v1.27.0
type ThinkingConfigEnabledDisplay string
Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
const ( ThinkingConfigEnabledDisplaySummarized ThinkingConfigEnabledDisplay = "summarized" ThinkingConfigEnabledDisplayOmitted ThinkingConfigEnabledDisplay = "omitted" )
type ThinkingConfigEnabledParam ¶
type ThinkingConfigEnabledParam struct {
// Determines how many tokens Claude can use for its internal reasoning process.
// Larger budgets can enable more thorough analysis for complex problems, improving
// response quality.
//
// Must be ≥1024 and less than `max_tokens`.
//
// See
// [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
// for details.
BudgetTokens int64 `json:"budget_tokens" api:"required"`
// Controls how thinking content appears in the response. When set to `summarized`,
// thinking is returned normally. When set to `omitted`, thinking content is
// redacted but a signature is returned for multi-turn continuity. Defaults to
// `summarized`.
//
// Any of "summarized", "omitted".
Display ThinkingConfigEnabledDisplay `json:"display,omitzero"`
// This field can be elided, and will marshal its zero value as "enabled".
Type constant.Enabled `json:"type" default:"enabled"`
// contains filtered or unexported fields
}
The properties BudgetTokens, Type are required.
func (ThinkingConfigEnabledParam) MarshalJSON ¶
func (r ThinkingConfigEnabledParam) MarshalJSON() (data []byte, err error)
func (*ThinkingConfigEnabledParam) UnmarshalJSON ¶
func (r *ThinkingConfigEnabledParam) UnmarshalJSON(data []byte) error
type ThinkingConfigParamUnion ¶
type ThinkingConfigParamUnion struct {
OfEnabled *ThinkingConfigEnabledParam `json:",omitzero,inline"`
OfDisabled *ThinkingConfigDisabledParam `json:",omitzero,inline"`
OfAdaptive *ThinkingConfigAdaptiveParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ThinkingConfigParamOfEnabled ¶
func ThinkingConfigParamOfEnabled(budgetTokens int64) ThinkingConfigParamUnion
func (ThinkingConfigParamUnion) GetBudgetTokens ¶
func (u ThinkingConfigParamUnion) GetBudgetTokens() *int64
Returns a pointer to the underlying variant's property, if present.
func (ThinkingConfigParamUnion) GetDisplay ¶ added in v1.27.0
func (u ThinkingConfigParamUnion) GetDisplay() *string
Returns a pointer to the underlying variant's property, if present.
func (ThinkingConfigParamUnion) GetType ¶
func (u ThinkingConfigParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ThinkingConfigParamUnion) MarshalJSON ¶
func (u ThinkingConfigParamUnion) MarshalJSON() ([]byte, error)
func (*ThinkingConfigParamUnion) UnmarshalJSON ¶
func (u *ThinkingConfigParamUnion) UnmarshalJSON(data []byte) error
type ThinkingDelta ¶
type ThinkingDelta struct {
Thinking string `json:"thinking" api:"required"`
Type constant.ThinkingDelta `json:"type" default:"thinking_delta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Thinking respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ThinkingDelta) RawJSON ¶
func (r ThinkingDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThinkingDelta) UnmarshalJSON ¶
func (r *ThinkingDelta) UnmarshalJSON(data []byte) error
type ThinkingTypes ¶ added in v1.27.1
type ThinkingTypes struct {
// Whether the model supports thinking with type 'adaptive' (auto).
Adaptive CapabilitySupport `json:"adaptive" api:"required"`
// Whether the model supports thinking with type 'enabled'.
Enabled CapabilitySupport `json:"enabled" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Adaptive respjson.Field
Enabled respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Supported thinking type configurations.
func (ThinkingTypes) RawJSON ¶ added in v1.27.1
func (r ThinkingTypes) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThinkingTypes) UnmarshalJSON ¶ added in v1.27.1
func (r *ThinkingTypes) UnmarshalJSON(data []byte) error
type ToolBash20250124Param ¶
type ToolBash20250124Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "bash".
Name constant.Bash `json:"name" default:"bash"`
// This field can be elided, and will marshal its zero value as "bash_20250124".
Type constant.Bash20250124 `json:"type" default:"bash_20250124"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (ToolBash20250124Param) MarshalJSON ¶
func (r ToolBash20250124Param) MarshalJSON() (data []byte, err error)
func (*ToolBash20250124Param) UnmarshalJSON ¶
func (r *ToolBash20250124Param) UnmarshalJSON(data []byte) error
type ToolChoiceAnyParam ¶
type ToolChoiceAnyParam struct {
// Whether to disable parallel tool use.
//
// Defaults to `false`. If set to `true`, the model will output exactly one tool
// use.
DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
// This field can be elided, and will marshal its zero value as "any".
Type constant.Any `json:"type" default:"any"`
// contains filtered or unexported fields
}
The model will use any available tools.
The property Type is required.
func (ToolChoiceAnyParam) MarshalJSON ¶
func (r ToolChoiceAnyParam) MarshalJSON() (data []byte, err error)
func (*ToolChoiceAnyParam) UnmarshalJSON ¶
func (r *ToolChoiceAnyParam) UnmarshalJSON(data []byte) error
type ToolChoiceAutoParam ¶
type ToolChoiceAutoParam struct {
// Whether to disable parallel tool use.
//
// Defaults to `false`. If set to `true`, the model will output at most one tool
// use.
DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
// This field can be elided, and will marshal its zero value as "auto".
Type constant.Auto `json:"type" default:"auto"`
// contains filtered or unexported fields
}
The model will automatically decide whether to use tools.
The property Type is required.
func (ToolChoiceAutoParam) MarshalJSON ¶
func (r ToolChoiceAutoParam) MarshalJSON() (data []byte, err error)
func (*ToolChoiceAutoParam) UnmarshalJSON ¶
func (r *ToolChoiceAutoParam) UnmarshalJSON(data []byte) error
type ToolChoiceNoneParam ¶
type ToolChoiceNoneParam struct {
Type constant.None `json:"type" default:"none"`
// contains filtered or unexported fields
}
The model will not be allowed to use tools.
This struct has a constant value, construct it with NewToolChoiceNoneParam.
func NewToolChoiceNoneParam ¶
func NewToolChoiceNoneParam() ToolChoiceNoneParam
func (ToolChoiceNoneParam) MarshalJSON ¶
func (r ToolChoiceNoneParam) MarshalJSON() (data []byte, err error)
func (*ToolChoiceNoneParam) UnmarshalJSON ¶
func (r *ToolChoiceNoneParam) UnmarshalJSON(data []byte) error
type ToolChoiceToolParam ¶
type ToolChoiceToolParam struct {
// The name of the tool to use.
Name string `json:"name" api:"required"`
// Whether to disable parallel tool use.
//
// Defaults to `false`. If set to `true`, the model will output exactly one tool
// use.
DisableParallelToolUse param.Opt[bool] `json:"disable_parallel_tool_use,omitzero"`
// This field can be elided, and will marshal its zero value as "tool".
Type constant.Tool `json:"type" default:"tool"`
// contains filtered or unexported fields
}
The model will use the specified tool with `tool_choice.name`.
The properties Name, Type are required.
func (ToolChoiceToolParam) MarshalJSON ¶
func (r ToolChoiceToolParam) MarshalJSON() (data []byte, err error)
func (*ToolChoiceToolParam) UnmarshalJSON ¶
func (r *ToolChoiceToolParam) UnmarshalJSON(data []byte) error
type ToolChoiceUnionParam ¶
type ToolChoiceUnionParam struct {
OfAuto *ToolChoiceAutoParam `json:",omitzero,inline"`
OfAny *ToolChoiceAnyParam `json:",omitzero,inline"`
OfTool *ToolChoiceToolParam `json:",omitzero,inline"`
OfNone *ToolChoiceNoneParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ToolChoiceParamOfTool ¶
func ToolChoiceParamOfTool(name string) ToolChoiceUnionParam
func (ToolChoiceUnionParam) GetDisableParallelToolUse ¶
func (u ToolChoiceUnionParam) GetDisableParallelToolUse() *bool
Returns a pointer to the underlying variant's property, if present.
func (ToolChoiceUnionParam) GetName ¶
func (u ToolChoiceUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolChoiceUnionParam) GetType ¶
func (u ToolChoiceUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolChoiceUnionParam) MarshalJSON ¶
func (u ToolChoiceUnionParam) MarshalJSON() ([]byte, error)
func (*ToolChoiceUnionParam) UnmarshalJSON ¶
func (u *ToolChoiceUnionParam) UnmarshalJSON(data []byte) error
type ToolInputSchemaParam ¶
type ToolInputSchemaParam struct {
Properties any `json:"properties,omitzero"`
Required []string `json:"required,omitzero"`
// This field can be elided, and will marshal its zero value as "object".
Type constant.Object `json:"type" default:"object"`
ExtraFields map[string]any `json:"-"`
// contains filtered or unexported fields
}
[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
This defines the shape of the `input` that your tool accepts and that the model will produce.
The property Type is required.
func (ToolInputSchemaParam) MarshalJSON ¶
func (r ToolInputSchemaParam) MarshalJSON() (data []byte, err error)
func (*ToolInputSchemaParam) UnmarshalJSON ¶
func (r *ToolInputSchemaParam) UnmarshalJSON(data []byte) error
type ToolParam ¶
type ToolParam struct {
// [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
//
// This defines the shape of the `input` that your tool accepts and that the model
// will produce.
InputSchema ToolInputSchemaParam `json:"input_schema,omitzero" api:"required"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
Name string `json:"name" api:"required"`
// Enable eager input streaming for this tool. When true, tool input parameters
// will be streamed incrementally as they are generated, and types will be inferred
// on-the-fly rather than buffering the full JSON output. When false, streaming is
// disabled for this tool even if the fine-grained-tool-streaming beta is active.
// When null (default), uses the default behavior based on beta headers.
EagerInputStreaming param.Opt[bool] `json:"eager_input_streaming,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// Description of what this tool does.
//
// Tool descriptions should be as detailed as possible. The more information that
// the model has about what the tool is and how to use it, the better it will
// perform. You can use natural language descriptions to reinforce important
// aspects of the tool input JSON schema.
Description param.Opt[string] `json:"description,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "custom".
Type ToolType `json:"type,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// contains filtered or unexported fields
}
The properties InputSchema, Name are required.
func (ToolParam) MarshalJSON ¶
func (*ToolParam) UnmarshalJSON ¶
type ToolReferenceBlock ¶ added in v1.23.0
type ToolReferenceBlock struct {
ToolName string `json:"tool_name" api:"required"`
Type constant.ToolReference `json:"type" default:"tool_reference"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolName respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ToolReferenceBlock) RawJSON ¶ added in v1.23.0
func (r ToolReferenceBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ToolReferenceBlock) ToParam ¶ added in v1.23.0
func (r ToolReferenceBlock) ToParam() ToolReferenceBlockParam
func (*ToolReferenceBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolReferenceBlock) UnmarshalJSON(data []byte) error
type ToolReferenceBlockParam ¶ added in v1.23.0
type ToolReferenceBlockParam struct {
ToolName string `json:"tool_name" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as "tool_reference".
Type constant.ToolReference `json:"type" default:"tool_reference"`
// contains filtered or unexported fields
}
Tool reference block that can be included in tool_result content.
The properties ToolName, Type are required.
func (ToolReferenceBlockParam) MarshalJSON ¶ added in v1.23.0
func (r ToolReferenceBlockParam) MarshalJSON() (data []byte, err error)
func (*ToolReferenceBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolReferenceBlockParam) UnmarshalJSON(data []byte) error
type ToolResultBlockParam ¶
type ToolResultBlockParam struct {
ToolUseID string `json:"tool_use_id" api:"required"`
IsError param.Opt[bool] `json:"is_error,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
Content []ToolResultBlockParamContentUnion `json:"content,omitzero"`
// This field can be elided, and will marshal its zero value as "tool_result".
Type constant.ToolResult `json:"type" default:"tool_result"`
// contains filtered or unexported fields
}
The properties ToolUseID, Type are required.
func (ToolResultBlockParam) MarshalJSON ¶
func (r ToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*ToolResultBlockParam) UnmarshalJSON ¶
func (r *ToolResultBlockParam) UnmarshalJSON(data []byte) error
type ToolResultBlockParamContentUnion ¶
type ToolResultBlockParamContentUnion struct {
OfText *TextBlockParam `json:",omitzero,inline"`
OfImage *ImageBlockParam `json:",omitzero,inline"`
OfSearchResult *SearchResultBlockParam `json:",omitzero,inline"`
OfDocument *DocumentBlockParam `json:",omitzero,inline"`
OfToolReference *ToolReferenceBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ToolResultBlockParamContentUnion) GetCacheControl ¶
func (u ToolResultBlockParamContentUnion) GetCacheControl() *CacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (ToolResultBlockParamContentUnion) GetCitations ¶
func (u ToolResultBlockParamContentUnion) GetCitations() (res toolResultBlockParamContentUnionCitations)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ToolResultBlockParamContentUnion) GetContent ¶ added in v1.8.0
func (u ToolResultBlockParamContentUnion) GetContent() []TextBlockParam
Returns a pointer to the underlying variant's property, if present.
func (ToolResultBlockParamContentUnion) GetContext ¶ added in v1.11.0
func (u ToolResultBlockParamContentUnion) GetContext() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolResultBlockParamContentUnion) GetSource ¶
func (u ToolResultBlockParamContentUnion) GetSource() (res toolResultBlockParamContentUnionSource)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ToolResultBlockParamContentUnion) GetText ¶
func (u ToolResultBlockParamContentUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolResultBlockParamContentUnion) GetTitle ¶ added in v1.8.0
func (u ToolResultBlockParamContentUnion) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolResultBlockParamContentUnion) GetToolName ¶ added in v1.23.0
func (u ToolResultBlockParamContentUnion) GetToolName() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolResultBlockParamContentUnion) GetType ¶
func (u ToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolResultBlockParamContentUnion) MarshalJSON ¶
func (u ToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*ToolResultBlockParamContentUnion) UnmarshalJSON ¶
func (u *ToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type ToolSearchToolBm25_20251119Param ¶ added in v1.23.0
type ToolSearchToolBm25_20251119Param struct {
// Any of "tool_search_tool_bm25_20251119", "tool_search_tool_bm25".
Type ToolSearchToolBm25_20251119Type `json:"type,omitzero" api:"required"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_bm25".
Name constant.ToolSearchToolBm25 `json:"name" default:"tool_search_tool_bm25"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (ToolSearchToolBm25_20251119Param) MarshalJSON ¶ added in v1.23.0
func (r ToolSearchToolBm25_20251119Param) MarshalJSON() (data []byte, err error)
func (*ToolSearchToolBm25_20251119Param) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolBm25_20251119Param) UnmarshalJSON(data []byte) error
type ToolSearchToolBm25_20251119Type ¶ added in v1.23.0
type ToolSearchToolBm25_20251119Type string
const ( ToolSearchToolBm25_20251119TypeToolSearchToolBm25_20251119 ToolSearchToolBm25_20251119Type = "tool_search_tool_bm25_20251119" ToolSearchToolBm25_20251119TypeToolSearchToolBm25 ToolSearchToolBm25_20251119Type = "tool_search_tool_bm25" )
type ToolSearchToolRegex20251119Param ¶ added in v1.23.0
type ToolSearchToolRegex20251119Param struct {
// Any of "tool_search_tool_regex_20251119", "tool_search_tool_regex".
Type ToolSearchToolRegex20251119Type `json:"type,omitzero" api:"required"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_regex".
Name constant.ToolSearchToolRegex `json:"name" default:"tool_search_tool_regex"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (ToolSearchToolRegex20251119Param) MarshalJSON ¶ added in v1.23.0
func (r ToolSearchToolRegex20251119Param) MarshalJSON() (data []byte, err error)
func (*ToolSearchToolRegex20251119Param) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolRegex20251119Param) UnmarshalJSON(data []byte) error
type ToolSearchToolRegex20251119Type ¶ added in v1.23.0
type ToolSearchToolRegex20251119Type string
const ( ToolSearchToolRegex20251119TypeToolSearchToolRegex20251119 ToolSearchToolRegex20251119Type = "tool_search_tool_regex_20251119" ToolSearchToolRegex20251119TypeToolSearchToolRegex ToolSearchToolRegex20251119Type = "tool_search_tool_regex" )
type ToolSearchToolResultBlock ¶ added in v1.23.0
type ToolSearchToolResultBlock struct {
Content ToolSearchToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.ToolSearchToolResult `json:"type" default:"tool_search_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ToolSearchToolResultBlock) RawJSON ¶ added in v1.23.0
func (r ToolSearchToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ToolSearchToolResultBlock) ToParam ¶ added in v1.23.0
func (r ToolSearchToolResultBlock) ToParam() ToolSearchToolResultBlockParam
func (*ToolSearchToolResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolResultBlock) UnmarshalJSON(data []byte) error
type ToolSearchToolResultBlockContentUnion ¶ added in v1.23.0
type ToolSearchToolResultBlockContentUnion struct {
// This field is from variant [ToolSearchToolResultError].
ErrorCode ToolSearchToolResultErrorCode `json:"error_code"`
// This field is from variant [ToolSearchToolResultError].
ErrorMessage string `json:"error_message"`
Type string `json:"type"`
// This field is from variant [ToolSearchToolSearchResultBlock].
ToolReferences []ToolReferenceBlock `json:"tool_references"`
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
ToolReferences respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ToolSearchToolResultBlockContentUnion contains all possible properties and values from ToolSearchToolResultError, ToolSearchToolSearchResultBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError ¶ added in v1.23.0
func (u ToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolResultError() (v ToolSearchToolResultError)
func (ToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock ¶ added in v1.23.0
func (u ToolSearchToolResultBlockContentUnion) AsResponseToolSearchToolSearchResultBlock() (v ToolSearchToolSearchResultBlock)
func (ToolSearchToolResultBlockContentUnion) RawJSON ¶ added in v1.23.0
func (u ToolSearchToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolSearchToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type ToolSearchToolResultBlockParam ¶ added in v1.23.0
type ToolSearchToolResultBlockParam struct {
Content ToolSearchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_result".
Type constant.ToolSearchToolResult `json:"type" default:"tool_search_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (ToolSearchToolResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r ToolSearchToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*ToolSearchToolResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolResultBlockParam) UnmarshalJSON(data []byte) error
type ToolSearchToolResultBlockParamContentUnion ¶ added in v1.23.0
type ToolSearchToolResultBlockParamContentUnion struct {
OfRequestToolSearchToolResultError *ToolSearchToolResultErrorParam `json:",omitzero,inline"`
OfRequestToolSearchToolSearchResultBlock *ToolSearchToolSearchResultBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ToolSearchToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.23.0
func (u ToolSearchToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolSearchToolResultBlockParamContentUnion) GetToolReferences ¶ added in v1.23.0
func (u ToolSearchToolResultBlockParamContentUnion) GetToolReferences() []ToolReferenceBlockParam
Returns a pointer to the underlying variant's property, if present.
func (ToolSearchToolResultBlockParamContentUnion) GetType ¶ added in v1.23.0
func (u ToolSearchToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolSearchToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.23.0
func (u ToolSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*ToolSearchToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *ToolSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type ToolSearchToolResultError ¶ added in v1.23.0
type ToolSearchToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode ToolSearchToolResultErrorCode `json:"error_code" api:"required"`
ErrorMessage string `json:"error_message" api:"required"`
Type constant.ToolSearchToolResultError `json:"type" default:"tool_search_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
ErrorMessage respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ToolSearchToolResultError) RawJSON ¶ added in v1.23.0
func (r ToolSearchToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolSearchToolResultError) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolResultError) UnmarshalJSON(data []byte) error
type ToolSearchToolResultErrorCode ¶ added in v1.23.0
type ToolSearchToolResultErrorCode string
const ( ToolSearchToolResultErrorCodeInvalidToolInput ToolSearchToolResultErrorCode = "invalid_tool_input" ToolSearchToolResultErrorCodeTooManyRequests ToolSearchToolResultErrorCode = "too_many_requests" ToolSearchToolResultErrorCodeExecutionTimeExceeded ToolSearchToolResultErrorCode = "execution_time_exceeded" )
type ToolSearchToolResultErrorParam ¶ added in v1.23.0
type ToolSearchToolResultErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "too_many_requests",
// "execution_time_exceeded".
ErrorCode ToolSearchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_result_error".
Type constant.ToolSearchToolResultError `json:"type" default:"tool_search_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (ToolSearchToolResultErrorParam) MarshalJSON ¶ added in v1.23.0
func (r ToolSearchToolResultErrorParam) MarshalJSON() (data []byte, err error)
func (*ToolSearchToolResultErrorParam) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolResultErrorParam) UnmarshalJSON(data []byte) error
type ToolSearchToolSearchResultBlock ¶ added in v1.23.0
type ToolSearchToolSearchResultBlock struct {
ToolReferences []ToolReferenceBlock `json:"tool_references" api:"required"`
Type constant.ToolSearchToolSearchResult `json:"type" default:"tool_search_tool_search_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ToolReferences respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ToolSearchToolSearchResultBlock) RawJSON ¶ added in v1.23.0
func (r ToolSearchToolSearchResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolSearchToolSearchResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolSearchResultBlock) UnmarshalJSON(data []byte) error
type ToolSearchToolSearchResultBlockParam ¶ added in v1.23.0
type ToolSearchToolSearchResultBlockParam struct {
ToolReferences []ToolReferenceBlockParam `json:"tool_references,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "tool_search_tool_search_result".
Type constant.ToolSearchToolSearchResult `json:"type" default:"tool_search_tool_search_result"`
// contains filtered or unexported fields
}
The properties ToolReferences, Type are required.
func (ToolSearchToolSearchResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r ToolSearchToolSearchResultBlockParam) MarshalJSON() (data []byte, err error)
func (*ToolSearchToolSearchResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolSearchToolSearchResultBlockParam) UnmarshalJSON(data []byte) error
type ToolTextEditor20250124Param ¶
type ToolTextEditor20250124Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_editor".
Name constant.StrReplaceEditor `json:"name" default:"str_replace_editor"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20250124".
Type constant.TextEditor20250124 `json:"type" default:"text_editor_20250124"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (ToolTextEditor20250124Param) MarshalJSON ¶
func (r ToolTextEditor20250124Param) MarshalJSON() (data []byte, err error)
func (*ToolTextEditor20250124Param) UnmarshalJSON ¶
func (r *ToolTextEditor20250124Param) UnmarshalJSON(data []byte) error
type ToolTextEditor20250429Param ¶ added in v1.3.0
type ToolTextEditor20250429Param struct {
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_based_edit_tool".
Name constant.StrReplaceBasedEditTool `json:"name" default:"str_replace_based_edit_tool"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20250429".
Type constant.TextEditor20250429 `json:"type" default:"text_editor_20250429"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (ToolTextEditor20250429Param) MarshalJSON ¶ added in v1.3.0
func (r ToolTextEditor20250429Param) MarshalJSON() (data []byte, err error)
func (*ToolTextEditor20250429Param) UnmarshalJSON ¶ added in v1.3.0
func (r *ToolTextEditor20250429Param) UnmarshalJSON(data []byte) error
type ToolTextEditor20250728Param ¶ added in v1.7.0
type ToolTextEditor20250728Param struct {
// Maximum number of characters to display when viewing a file. If not specified,
// defaults to displaying the full file.
MaxCharacters param.Opt[int64] `json:"max_characters,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
InputExamples []map[string]any `json:"input_examples,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as
// "str_replace_based_edit_tool".
Name constant.StrReplaceBasedEditTool `json:"name" default:"str_replace_based_edit_tool"`
// This field can be elided, and will marshal its zero value as
// "text_editor_20250728".
Type constant.TextEditor20250728 `json:"type" default:"text_editor_20250728"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (ToolTextEditor20250728Param) MarshalJSON ¶ added in v1.7.0
func (r ToolTextEditor20250728Param) MarshalJSON() (data []byte, err error)
func (*ToolTextEditor20250728Param) UnmarshalJSON ¶ added in v1.7.0
func (r *ToolTextEditor20250728Param) UnmarshalJSON(data []byte) error
type ToolUnionParam ¶
type ToolUnionParam struct {
OfTool *ToolParam `json:",omitzero,inline"`
OfBashTool20250124 *ToolBash20250124Param `json:",omitzero,inline"`
OfCodeExecutionTool20250522 *CodeExecutionTool20250522Param `json:",omitzero,inline"`
OfCodeExecutionTool20250825 *CodeExecutionTool20250825Param `json:",omitzero,inline"`
OfCodeExecutionTool20260120 *CodeExecutionTool20260120Param `json:",omitzero,inline"`
OfMemoryTool20250818 *MemoryTool20250818Param `json:",omitzero,inline"`
OfTextEditor20250124 *ToolTextEditor20250124Param `json:",omitzero,inline"`
OfTextEditor20250429 *ToolTextEditor20250429Param `json:",omitzero,inline"`
OfTextEditor20250728 *ToolTextEditor20250728Param `json:",omitzero,inline"`
OfWebSearchTool20250305 *WebSearchTool20250305Param `json:",omitzero,inline"`
OfWebFetchTool20250910 *WebFetchTool20250910Param `json:",omitzero,inline"`
OfWebSearchTool20260209 *WebSearchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260209 *WebFetchTool20260209Param `json:",omitzero,inline"`
OfWebFetchTool20260309 *WebFetchTool20260309Param `json:",omitzero,inline"`
OfToolSearchToolBm25_20251119 *ToolSearchToolBm25_20251119Param `json:",omitzero,inline"`
OfToolSearchToolRegex20251119 *ToolSearchToolRegex20251119Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ToolUnionParamOfTool ¶
func ToolUnionParamOfTool(inputSchema ToolInputSchemaParam, name string) ToolUnionParam
func ToolUnionParamOfToolSearchToolBm25_20251119 ¶ added in v1.23.0
func ToolUnionParamOfToolSearchToolBm25_20251119(type_ ToolSearchToolBm25_20251119Type) ToolUnionParam
func ToolUnionParamOfToolSearchToolRegex20251119 ¶ added in v1.23.0
func ToolUnionParamOfToolSearchToolRegex20251119(type_ ToolSearchToolRegex20251119Type) ToolUnionParam
func (ToolUnionParam) GetAllowedCallers ¶ added in v1.23.0
func (u ToolUnionParam) GetAllowedCallers() []string
Returns a pointer to the underlying variant's AllowedCallers property, if present.
func (ToolUnionParam) GetAllowedDomains ¶
func (u ToolUnionParam) GetAllowedDomains() []string
Returns a pointer to the underlying variant's AllowedDomains property, if present.
func (ToolUnionParam) GetBlockedDomains ¶
func (u ToolUnionParam) GetBlockedDomains() []string
Returns a pointer to the underlying variant's BlockedDomains property, if present.
func (ToolUnionParam) GetCacheControl ¶
func (u ToolUnionParam) GetCacheControl() *CacheControlEphemeralParam
Returns a pointer to the underlying variant's CacheControl property, if present.
func (ToolUnionParam) GetCitations ¶ added in v1.23.0
func (u ToolUnionParam) GetCitations() *CitationsConfigParam
Returns a pointer to the underlying variant's Citations property, if present.
func (ToolUnionParam) GetDeferLoading ¶ added in v1.23.0
func (u ToolUnionParam) GetDeferLoading() *bool
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetDescription ¶
func (u ToolUnionParam) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetEagerInputStreaming ¶ added in v1.21.0
func (u ToolUnionParam) GetEagerInputStreaming() *bool
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetInputExamples ¶ added in v1.23.0
func (u ToolUnionParam) GetInputExamples() []map[string]any
Returns a pointer to the underlying variant's InputExamples property, if present.
func (ToolUnionParam) GetInputSchema ¶
func (u ToolUnionParam) GetInputSchema() *ToolInputSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetMaxCharacters ¶ added in v1.7.0
func (u ToolUnionParam) GetMaxCharacters() *int64
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetMaxContentTokens ¶ added in v1.23.0
func (u ToolUnionParam) GetMaxContentTokens() *int64
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetMaxUses ¶
func (u ToolUnionParam) GetMaxUses() *int64
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetName ¶
func (u ToolUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetStrict ¶ added in v1.20.0
func (u ToolUnionParam) GetStrict() *bool
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetType ¶
func (u ToolUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetUseCache ¶ added in v1.27.0
func (u ToolUnionParam) GetUseCache() *bool
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetUserLocation ¶
func (u ToolUnionParam) GetUserLocation() *UserLocationParam
Returns a pointer to the underlying variant's UserLocation property, if present.
func (ToolUnionParam) MarshalJSON ¶
func (u ToolUnionParam) MarshalJSON() ([]byte, error)
func (*ToolUnionParam) UnmarshalJSON ¶
func (u *ToolUnionParam) UnmarshalJSON(data []byte) error
type ToolUseBlock ¶
type ToolUseBlock struct {
ID string `json:"id" api:"required"`
// Tool invocation directly from the model.
Caller ToolUseBlockCallerUnion `json:"caller" api:"required"`
// necessary custom code modification
Input json.RawMessage `json:"input,required"`
Name string `json:"name" api:"required"`
Type constant.ToolUse `json:"type" default:"tool_use"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Caller respjson.Field
Input respjson.Field
Name respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ToolUseBlock) RawJSON ¶
func (r ToolUseBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ToolUseBlock) ToParam ¶
func (r ToolUseBlock) ToParam() ToolUseBlockParam
func (*ToolUseBlock) UnmarshalJSON ¶
func (r *ToolUseBlock) UnmarshalJSON(data []byte) error
type ToolUseBlockCallerUnion ¶ added in v1.23.0
type ToolUseBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ToolUseBlockCallerUnion contains all possible properties and values from DirectCaller, ServerToolCaller, ServerToolCaller20260120.
Use the ToolUseBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ToolUseBlockCallerUnion) AsAny ¶ added in v1.23.0
func (u ToolUseBlockCallerUnion) AsAny() anyToolUseBlockCaller
Use the following switch statement to find the correct variant
switch variant := ToolUseBlockCallerUnion.AsAny().(type) {
case anthropic.DirectCaller:
case anthropic.ServerToolCaller:
case anthropic.ServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (ToolUseBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.23.0
func (u ToolUseBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
func (ToolUseBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u ToolUseBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
func (ToolUseBlockCallerUnion) AsDirect ¶ added in v1.23.0
func (u ToolUseBlockCallerUnion) AsDirect() (v DirectCaller)
func (ToolUseBlockCallerUnion) RawJSON ¶ added in v1.23.0
func (u ToolUseBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolUseBlockCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *ToolUseBlockCallerUnion) UnmarshalJSON(data []byte) error
type ToolUseBlockParam ¶
type ToolUseBlockParam struct {
ID string `json:"id" api:"required"`
Input any `json:"input,omitzero" api:"required"`
Name string `json:"name" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller ToolUseBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as "tool_use".
Type constant.ToolUse `json:"type" default:"tool_use"`
// contains filtered or unexported fields
}
The properties ID, Input, Name, Type are required.
func (ToolUseBlockParam) MarshalJSON ¶
func (r ToolUseBlockParam) MarshalJSON() (data []byte, err error)
func (*ToolUseBlockParam) UnmarshalJSON ¶
func (r *ToolUseBlockParam) UnmarshalJSON(data []byte) error
type ToolUseBlockParamCallerUnion ¶ added in v1.23.0
type ToolUseBlockParamCallerUnion struct {
OfDirect *DirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *ServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *ServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ToolUseBlockParamCallerUnion) GetToolID ¶ added in v1.23.0
func (u ToolUseBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUseBlockParamCallerUnion) GetType ¶ added in v1.23.0
func (u ToolUseBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUseBlockParamCallerUnion) MarshalJSON ¶ added in v1.23.0
func (u ToolUseBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*ToolUseBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *ToolUseBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type URLImageSourceParam ¶
type URLImageSourceParam struct {
URL string `json:"url" api:"required"`
// This field can be elided, and will marshal its zero value as "url".
Type constant.URL `json:"type" default:"url"`
// contains filtered or unexported fields
}
The properties Type, URL are required.
func (URLImageSourceParam) MarshalJSON ¶
func (r URLImageSourceParam) MarshalJSON() (data []byte, err error)
func (*URLImageSourceParam) UnmarshalJSON ¶
func (r *URLImageSourceParam) UnmarshalJSON(data []byte) error
type URLPDFSourceParam ¶
type URLPDFSourceParam struct {
URL string `json:"url" api:"required"`
// This field can be elided, and will marshal its zero value as "url".
Type constant.URL `json:"type" default:"url"`
// contains filtered or unexported fields
}
The properties Type, URL are required.
func (URLPDFSourceParam) MarshalJSON ¶
func (r URLPDFSourceParam) MarshalJSON() (data []byte, err error)
func (*URLPDFSourceParam) UnmarshalJSON ¶
func (r *URLPDFSourceParam) UnmarshalJSON(data []byte) error
type Usage ¶
type Usage struct {
// Breakdown of cached tokens by TTL
CacheCreation CacheCreation `json:"cache_creation" api:"required"`
// The number of input tokens used to create the cache entry.
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens" api:"required"`
// The number of input tokens read from the cache.
CacheReadInputTokens int64 `json:"cache_read_input_tokens" api:"required"`
// The geographic region where inference was performed for this request.
InferenceGeo string `json:"inference_geo" api:"required"`
// The number of input tokens which were used.
InputTokens int64 `json:"input_tokens" api:"required"`
// The number of output tokens which were used.
OutputTokens int64 `json:"output_tokens" api:"required"`
// The number of server tool requests.
ServerToolUse ServerToolUsage `json:"server_tool_use" api:"required"`
// If the request used the priority, standard, or batch tier.
//
// Any of "standard", "priority", "batch".
ServiceTier UsageServiceTier `json:"service_tier" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CacheCreation respjson.Field
CacheCreationInputTokens respjson.Field
CacheReadInputTokens respjson.Field
InferenceGeo respjson.Field
InputTokens respjson.Field
OutputTokens respjson.Field
ServerToolUse respjson.Field
ServiceTier respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Usage) UnmarshalJSON ¶
type UsageServiceTier ¶ added in v1.2.0
type UsageServiceTier string
If the request used the priority, standard, or batch tier.
const ( UsageServiceTierStandard UsageServiceTier = "standard" UsageServiceTierPriority UsageServiceTier = "priority" UsageServiceTierBatch UsageServiceTier = "batch" )
type UserLocationParam ¶ added in v1.25.0
type UserLocationParam struct {
// The city of the user.
City param.Opt[string] `json:"city,omitzero"`
// The two letter
// [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
// user.
Country param.Opt[string] `json:"country,omitzero"`
// The region of the user.
Region param.Opt[string] `json:"region,omitzero"`
// The [IANA timezone](https://nodatime.org/TimeZones) of the user.
Timezone param.Opt[string] `json:"timezone,omitzero"`
// This field can be elided, and will marshal its zero value as "approximate".
Type constant.Approximate `json:"type" default:"approximate"`
// contains filtered or unexported fields
}
The property Type is required.
func (UserLocationParam) MarshalJSON ¶ added in v1.25.0
func (r UserLocationParam) MarshalJSON() (data []byte, err error)
func (*UserLocationParam) UnmarshalJSON ¶ added in v1.25.0
func (r *UserLocationParam) UnmarshalJSON(data []byte) error
type WebFetchBlock ¶ added in v1.23.0
type WebFetchBlock struct {
Content DocumentBlock `json:"content" api:"required"`
// ISO 8601 timestamp when the content was retrieved
RetrievedAt string `json:"retrieved_at" api:"required"`
Type constant.WebFetchResult `json:"type" default:"web_fetch_result"`
// Fetched content URL
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
RetrievedAt respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebFetchBlock) RawJSON ¶ added in v1.23.0
func (r WebFetchBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebFetchBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchBlock) UnmarshalJSON(data []byte) error
type WebFetchBlockParam ¶ added in v1.23.0
type WebFetchBlockParam struct {
Content DocumentBlockParam `json:"content,omitzero" api:"required"`
// Fetched content URL
URL string `json:"url" api:"required"`
// ISO 8601 timestamp when the content was retrieved
RetrievedAt param.Opt[string] `json:"retrieved_at,omitzero"`
// This field can be elided, and will marshal its zero value as "web_fetch_result".
Type constant.WebFetchResult `json:"type" default:"web_fetch_result"`
// contains filtered or unexported fields
}
The properties Content, Type, URL are required.
func (WebFetchBlockParam) MarshalJSON ¶ added in v1.23.0
func (r WebFetchBlockParam) MarshalJSON() (data []byte, err error)
func (*WebFetchBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchBlockParam) UnmarshalJSON(data []byte) error
type WebFetchTool20250910Param ¶ added in v1.23.0
type WebFetchTool20250910Param struct {
// Maximum number of tokens used by including web page text content in the context.
// The limit is approximate and does not apply to binary content such as PDFs.
MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// List of domains to allow fetching from
AllowedDomains []string `json:"allowed_domains,omitzero"`
// List of domains to block fetching from
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Citations configuration for fetched documents. Citations are disabled by
// default.
Citations CitationsConfigParam `json:"citations,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_fetch".
Name constant.WebFetch `json:"name" default:"web_fetch"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_20250910".
Type constant.WebFetch20250910 `json:"type" default:"web_fetch_20250910"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (WebFetchTool20250910Param) MarshalJSON ¶ added in v1.23.0
func (r WebFetchTool20250910Param) MarshalJSON() (data []byte, err error)
func (*WebFetchTool20250910Param) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchTool20250910Param) UnmarshalJSON(data []byte) error
type WebFetchTool20260209Param ¶ added in v1.24.0
type WebFetchTool20260209Param struct {
// Maximum number of tokens used by including web page text content in the context.
// The limit is approximate and does not apply to binary content such as PDFs.
MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// List of domains to allow fetching from
AllowedDomains []string `json:"allowed_domains,omitzero"`
// List of domains to block fetching from
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Citations configuration for fetched documents. Citations are disabled by
// default.
Citations CitationsConfigParam `json:"citations,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_fetch".
Name constant.WebFetch `json:"name" default:"web_fetch"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_20260209".
Type constant.WebFetch20260209 `json:"type" default:"web_fetch_20260209"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (WebFetchTool20260209Param) MarshalJSON ¶ added in v1.24.0
func (r WebFetchTool20260209Param) MarshalJSON() (data []byte, err error)
func (*WebFetchTool20260209Param) UnmarshalJSON ¶ added in v1.24.0
func (r *WebFetchTool20260209Param) UnmarshalJSON(data []byte) error
type WebFetchTool20260309Param ¶ added in v1.27.0
type WebFetchTool20260309Param struct {
// Maximum number of tokens used by including web page text content in the context.
// The limit is approximate and does not apply to binary content such as PDFs.
MaxContentTokens param.Opt[int64] `json:"max_content_tokens,omitzero"`
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// Whether to use cached content. Set to false to bypass the cache and fetch fresh
// content. Only set to false when the user explicitly requests fresh content or
// when fetching rapidly-changing sources.
UseCache param.Opt[bool] `json:"use_cache,omitzero"`
// List of domains to allow fetching from
AllowedDomains []string `json:"allowed_domains,omitzero"`
// List of domains to block fetching from
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Citations configuration for fetched documents. Citations are disabled by
// default.
Citations CitationsConfigParam `json:"citations,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_fetch".
Name constant.WebFetch `json:"name" default:"web_fetch"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_20260309".
Type constant.WebFetch20260309 `json:"type" default:"web_fetch_20260309"`
// contains filtered or unexported fields
}
Web fetch tool with use_cache parameter for bypassing cached content.
The properties Name, Type are required.
func (WebFetchTool20260309Param) MarshalJSON ¶ added in v1.27.0
func (r WebFetchTool20260309Param) MarshalJSON() (data []byte, err error)
func (*WebFetchTool20260309Param) UnmarshalJSON ¶ added in v1.27.0
func (r *WebFetchTool20260309Param) UnmarshalJSON(data []byte) error
type WebFetchToolResultBlock ¶ added in v1.23.0
type WebFetchToolResultBlock struct {
// Tool invocation directly from the model.
Caller WebFetchToolResultBlockCallerUnion `json:"caller" api:"required"`
Content WebFetchToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.WebFetchToolResult `json:"type" default:"web_fetch_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Caller respjson.Field
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebFetchToolResultBlock) RawJSON ¶ added in v1.23.0
func (r WebFetchToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (WebFetchToolResultBlock) ToParam ¶ added in v1.23.0
func (r WebFetchToolResultBlock) ToParam() WebFetchToolResultBlockParam
func (*WebFetchToolResultBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchToolResultBlock) UnmarshalJSON(data []byte) error
type WebFetchToolResultBlockCallerUnion ¶ added in v1.23.0
type WebFetchToolResultBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebFetchToolResultBlockCallerUnion contains all possible properties and values from DirectCaller, ServerToolCaller, ServerToolCaller20260120.
Use the WebFetchToolResultBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (WebFetchToolResultBlockCallerUnion) AsAny ¶ added in v1.23.0
func (u WebFetchToolResultBlockCallerUnion) AsAny() anyWebFetchToolResultBlockCaller
Use the following switch statement to find the correct variant
switch variant := WebFetchToolResultBlockCallerUnion.AsAny().(type) {
case anthropic.DirectCaller:
case anthropic.ServerToolCaller:
case anthropic.ServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (WebFetchToolResultBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.23.0
func (u WebFetchToolResultBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
func (WebFetchToolResultBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u WebFetchToolResultBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
func (WebFetchToolResultBlockCallerUnion) AsDirect ¶ added in v1.23.0
func (u WebFetchToolResultBlockCallerUnion) AsDirect() (v DirectCaller)
func (WebFetchToolResultBlockCallerUnion) RawJSON ¶ added in v1.23.0
func (u WebFetchToolResultBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebFetchToolResultBlockCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
type WebFetchToolResultBlockContentUnion ¶ added in v1.23.0
type WebFetchToolResultBlockContentUnion struct {
// This field is from variant [WebFetchToolResultErrorBlock].
ErrorCode WebFetchToolResultErrorCode `json:"error_code"`
Type string `json:"type"`
// This field is from variant [WebFetchBlock].
Content DocumentBlock `json:"content"`
// This field is from variant [WebFetchBlock].
RetrievedAt string `json:"retrieved_at"`
// This field is from variant [WebFetchBlock].
URL string `json:"url"`
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
Content respjson.Field
RetrievedAt respjson.Field
URL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebFetchToolResultBlockContentUnion contains all possible properties and values from WebFetchToolResultErrorBlock, WebFetchBlock.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (WebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock ¶ added in v1.23.0
func (u WebFetchToolResultBlockContentUnion) AsResponseWebFetchResultBlock() (v WebFetchBlock)
func (WebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError ¶ added in v1.23.0
func (u WebFetchToolResultBlockContentUnion) AsResponseWebFetchToolResultError() (v WebFetchToolResultErrorBlock)
func (WebFetchToolResultBlockContentUnion) RawJSON ¶ added in v1.23.0
func (u WebFetchToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebFetchToolResultBlockContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type WebFetchToolResultBlockParam ¶ added in v1.23.0
type WebFetchToolResultBlockParam struct {
Content WebFetchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller WebFetchToolResultBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_tool_result".
Type constant.WebFetchToolResult `json:"type" default:"web_fetch_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (WebFetchToolResultBlockParam) MarshalJSON ¶ added in v1.23.0
func (r WebFetchToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*WebFetchToolResultBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchToolResultBlockParam) UnmarshalJSON(data []byte) error
type WebFetchToolResultBlockParamCallerUnion ¶ added in v1.23.0
type WebFetchToolResultBlockParamCallerUnion struct {
OfDirect *DirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *ServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *ServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (WebFetchToolResultBlockParamCallerUnion) GetToolID ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamCallerUnion) GetType ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamCallerUnion) MarshalJSON ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*WebFetchToolResultBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *WebFetchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type WebFetchToolResultBlockParamContentUnion ¶ added in v1.23.0
type WebFetchToolResultBlockParamContentUnion struct {
OfRequestWebFetchToolResultError *WebFetchToolResultErrorBlockParam `json:",omitzero,inline"`
OfRequestWebFetchResultBlock *WebFetchBlockParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (WebFetchToolResultBlockParamContentUnion) GetContent ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamContentUnion) GetContent() *DocumentBlockParam
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamContentUnion) GetErrorCode ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamContentUnion) GetErrorCode() *string
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamContentUnion) GetRetrievedAt ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamContentUnion) GetRetrievedAt() *string
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamContentUnion) GetType ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamContentUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamContentUnion) GetURL ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamContentUnion) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (WebFetchToolResultBlockParamContentUnion) MarshalJSON ¶ added in v1.23.0
func (u WebFetchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*WebFetchToolResultBlockParamContentUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *WebFetchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type WebFetchToolResultErrorBlock ¶ added in v1.23.0
type WebFetchToolResultErrorBlock struct {
// Any of "invalid_tool_input", "url_too_long", "url_not_allowed",
// "url_not_accessible", "unsupported_content_type", "too_many_requests",
// "max_uses_exceeded", "unavailable".
ErrorCode WebFetchToolResultErrorCode `json:"error_code" api:"required"`
Type constant.WebFetchToolResultError `json:"type" default:"web_fetch_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebFetchToolResultErrorBlock) RawJSON ¶ added in v1.23.0
func (r WebFetchToolResultErrorBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebFetchToolResultErrorBlock) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchToolResultErrorBlock) UnmarshalJSON(data []byte) error
type WebFetchToolResultErrorBlockParam ¶ added in v1.23.0
type WebFetchToolResultErrorBlockParam struct {
// Any of "invalid_tool_input", "url_too_long", "url_not_allowed",
// "url_not_accessible", "unsupported_content_type", "too_many_requests",
// "max_uses_exceeded", "unavailable".
ErrorCode WebFetchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "web_fetch_tool_result_error".
Type constant.WebFetchToolResultError `json:"type" default:"web_fetch_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (WebFetchToolResultErrorBlockParam) MarshalJSON ¶ added in v1.23.0
func (r WebFetchToolResultErrorBlockParam) MarshalJSON() (data []byte, err error)
func (*WebFetchToolResultErrorBlockParam) UnmarshalJSON ¶ added in v1.23.0
func (r *WebFetchToolResultErrorBlockParam) UnmarshalJSON(data []byte) error
type WebFetchToolResultErrorCode ¶ added in v1.23.0
type WebFetchToolResultErrorCode string
const ( WebFetchToolResultErrorCodeInvalidToolInput WebFetchToolResultErrorCode = "invalid_tool_input" WebFetchToolResultErrorCodeURLTooLong WebFetchToolResultErrorCode = "url_too_long" WebFetchToolResultErrorCodeURLNotAllowed WebFetchToolResultErrorCode = "url_not_allowed" WebFetchToolResultErrorCodeURLNotAccessible WebFetchToolResultErrorCode = "url_not_accessible" WebFetchToolResultErrorCodeUnsupportedContentType WebFetchToolResultErrorCode = "unsupported_content_type" WebFetchToolResultErrorCodeTooManyRequests WebFetchToolResultErrorCode = "too_many_requests" WebFetchToolResultErrorCodeMaxUsesExceeded WebFetchToolResultErrorCode = "max_uses_exceeded" )
type WebSearchResultBlock ¶
type WebSearchResultBlock struct {
EncryptedContent string `json:"encrypted_content" api:"required"`
PageAge string `json:"page_age" api:"required"`
Title string `json:"title" api:"required"`
Type constant.WebSearchResult `json:"type" default:"web_search_result"`
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EncryptedContent respjson.Field
PageAge respjson.Field
Title respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebSearchResultBlock) RawJSON ¶
func (r WebSearchResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (WebSearchResultBlock) ToParam ¶ added in v1.20.0
func (r WebSearchResultBlock) ToParam() WebSearchResultBlockParam
func (*WebSearchResultBlock) UnmarshalJSON ¶
func (r *WebSearchResultBlock) UnmarshalJSON(data []byte) error
type WebSearchResultBlockParam ¶
type WebSearchResultBlockParam struct {
EncryptedContent string `json:"encrypted_content" api:"required"`
Title string `json:"title" api:"required"`
URL string `json:"url" api:"required"`
PageAge param.Opt[string] `json:"page_age,omitzero"`
// This field can be elided, and will marshal its zero value as
// "web_search_result".
Type constant.WebSearchResult `json:"type" default:"web_search_result"`
// contains filtered or unexported fields
}
The properties EncryptedContent, Title, Type, URL are required.
func (WebSearchResultBlockParam) MarshalJSON ¶
func (r WebSearchResultBlockParam) MarshalJSON() (data []byte, err error)
func (*WebSearchResultBlockParam) UnmarshalJSON ¶
func (r *WebSearchResultBlockParam) UnmarshalJSON(data []byte) error
type WebSearchTool20250305Param ¶
type WebSearchTool20250305Param struct {
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// If provided, only these domains will be included in results. Cannot be used
// alongside `blocked_domains`.
AllowedDomains []string `json:"allowed_domains,omitzero"`
// If provided, these domains will never appear in results. Cannot be used
// alongside `allowed_domains`.
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Parameters for the user's location. Used to provide more relevant search
// results.
UserLocation UserLocationParam `json:"user_location,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_search".
Name constant.WebSearch `json:"name" default:"web_search"`
// This field can be elided, and will marshal its zero value as
// "web_search_20250305".
Type constant.WebSearch20250305 `json:"type" default:"web_search_20250305"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (WebSearchTool20250305Param) MarshalJSON ¶
func (r WebSearchTool20250305Param) MarshalJSON() (data []byte, err error)
func (*WebSearchTool20250305Param) UnmarshalJSON ¶
func (r *WebSearchTool20250305Param) UnmarshalJSON(data []byte) error
type WebSearchTool20250305UserLocationParam ¶
type WebSearchTool20250305UserLocationParam = UserLocationParam
type WebSearchTool20260209Param ¶ added in v1.24.0
type WebSearchTool20260209Param struct {
// Maximum number of times the tool can be used in the API request.
MaxUses param.Opt[int64] `json:"max_uses,omitzero"`
// If true, tool will not be included in initial system prompt. Only loaded when
// returned via tool_reference from tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// When true, guarantees schema validation on tool names and inputs
Strict param.Opt[bool] `json:"strict,omitzero"`
// If provided, only these domains will be included in results. Cannot be used
// alongside `blocked_domains`.
AllowedDomains []string `json:"allowed_domains,omitzero"`
// If provided, these domains will never appear in results. Cannot be used
// alongside `allowed_domains`.
BlockedDomains []string `json:"blocked_domains,omitzero"`
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
AllowedCallers []string `json:"allowed_callers,omitzero"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Parameters for the user's location. Used to provide more relevant search
// results.
UserLocation UserLocationParam `json:"user_location,omitzero"`
// Name of the tool.
//
// This is how the tool will be called by the model and in `tool_use` blocks.
//
// This field can be elided, and will marshal its zero value as "web_search".
Name constant.WebSearch `json:"name" default:"web_search"`
// This field can be elided, and will marshal its zero value as
// "web_search_20260209".
Type constant.WebSearch20260209 `json:"type" default:"web_search_20260209"`
// contains filtered or unexported fields
}
The properties Name, Type are required.
func (WebSearchTool20260209Param) MarshalJSON ¶ added in v1.24.0
func (r WebSearchTool20260209Param) MarshalJSON() (data []byte, err error)
func (*WebSearchTool20260209Param) UnmarshalJSON ¶ added in v1.24.0
func (r *WebSearchTool20260209Param) UnmarshalJSON(data []byte) error
type WebSearchTool20260209UserLocationParam ¶ added in v1.24.0
type WebSearchTool20260209UserLocationParam = UserLocationParam
type WebSearchToolRequestErrorErrorCode ¶
type WebSearchToolRequestErrorErrorCode = WebSearchToolResultErrorCode
type WebSearchToolRequestErrorParam ¶
type WebSearchToolRequestErrorParam struct {
// Any of "invalid_tool_input", "unavailable", "max_uses_exceeded",
// "too_many_requests", "query_too_long", "request_too_large".
ErrorCode WebSearchToolResultErrorCode `json:"error_code,omitzero" api:"required"`
// This field can be elided, and will marshal its zero value as
// "web_search_tool_result_error".
Type constant.WebSearchToolResultError `json:"type" default:"web_search_tool_result_error"`
// contains filtered or unexported fields
}
The properties ErrorCode, Type are required.
func (WebSearchToolRequestErrorParam) MarshalJSON ¶
func (r WebSearchToolRequestErrorParam) MarshalJSON() (data []byte, err error)
func (*WebSearchToolRequestErrorParam) UnmarshalJSON ¶
func (r *WebSearchToolRequestErrorParam) UnmarshalJSON(data []byte) error
type WebSearchToolResultBlock ¶
type WebSearchToolResultBlock struct {
// Tool invocation directly from the model.
Caller WebSearchToolResultBlockCallerUnion `json:"caller" api:"required"`
Content WebSearchToolResultBlockContentUnion `json:"content" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
Type constant.WebSearchToolResult `json:"type" default:"web_search_tool_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Caller respjson.Field
Content respjson.Field
ToolUseID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebSearchToolResultBlock) RawJSON ¶
func (r WebSearchToolResultBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (WebSearchToolResultBlock) ToParam ¶ added in v1.20.0
func (r WebSearchToolResultBlock) ToParam() WebSearchToolResultBlockParam
func (*WebSearchToolResultBlock) UnmarshalJSON ¶
func (r *WebSearchToolResultBlock) UnmarshalJSON(data []byte) error
type WebSearchToolResultBlockCallerUnion ¶ added in v1.23.0
type WebSearchToolResultBlockCallerUnion struct {
// Any of "direct", "code_execution_20250825", "code_execution_20260120".
Type string `json:"type"`
ToolID string `json:"tool_id"`
JSON struct {
Type respjson.Field
ToolID respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebSearchToolResultBlockCallerUnion contains all possible properties and values from DirectCaller, ServerToolCaller, ServerToolCaller20260120.
Use the WebSearchToolResultBlockCallerUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (WebSearchToolResultBlockCallerUnion) AsAny ¶ added in v1.23.0
func (u WebSearchToolResultBlockCallerUnion) AsAny() anyWebSearchToolResultBlockCaller
Use the following switch statement to find the correct variant
switch variant := WebSearchToolResultBlockCallerUnion.AsAny().(type) {
case anthropic.DirectCaller:
case anthropic.ServerToolCaller:
case anthropic.ServerToolCaller20260120:
default:
fmt.Errorf("no variant present")
}
func (WebSearchToolResultBlockCallerUnion) AsCodeExecution20250825 ¶ added in v1.23.0
func (u WebSearchToolResultBlockCallerUnion) AsCodeExecution20250825() (v ServerToolCaller)
func (WebSearchToolResultBlockCallerUnion) AsCodeExecution20260120 ¶ added in v1.23.0
func (u WebSearchToolResultBlockCallerUnion) AsCodeExecution20260120() (v ServerToolCaller20260120)
func (WebSearchToolResultBlockCallerUnion) AsDirect ¶ added in v1.23.0
func (u WebSearchToolResultBlockCallerUnion) AsDirect() (v DirectCaller)
func (WebSearchToolResultBlockCallerUnion) RawJSON ¶ added in v1.23.0
func (u WebSearchToolResultBlockCallerUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchToolResultBlockCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (r *WebSearchToolResultBlockCallerUnion) UnmarshalJSON(data []byte) error
type WebSearchToolResultBlockContentUnion ¶
type WebSearchToolResultBlockContentUnion struct {
// This field will be present if the value is a [[]WebSearchResultBlock] instead of
// an object.
OfWebSearchResultBlockArray []WebSearchResultBlock `json:",inline"`
// This field is from variant [WebSearchToolResultError].
ErrorCode WebSearchToolResultErrorCode `json:"error_code"`
// This field is from variant [WebSearchToolResultError].
Type constant.WebSearchToolResultError `json:"type"`
JSON struct {
OfWebSearchResultBlockArray respjson.Field
ErrorCode respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebSearchToolResultBlockContentUnion contains all possible properties and values from WebSearchToolResultError, [[]WebSearchResultBlock].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfWebSearchResultBlockArray]
func (WebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError ¶
func (u WebSearchToolResultBlockContentUnion) AsResponseWebSearchToolResultError() (v WebSearchToolResultError)
func (WebSearchToolResultBlockContentUnion) AsWebSearchResultBlockArray ¶
func (u WebSearchToolResultBlockContentUnion) AsWebSearchResultBlockArray() (v []WebSearchResultBlock)
func (WebSearchToolResultBlockContentUnion) RawJSON ¶
func (u WebSearchToolResultBlockContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (WebSearchToolResultBlockContentUnion) ToParam ¶ added in v1.20.0
func (r WebSearchToolResultBlockContentUnion) ToParam() WebSearchToolResultBlockParamContentUnion
func (*WebSearchToolResultBlockContentUnion) UnmarshalJSON ¶
func (r *WebSearchToolResultBlockContentUnion) UnmarshalJSON(data []byte) error
type WebSearchToolResultBlockParam ¶
type WebSearchToolResultBlockParam struct {
Content WebSearchToolResultBlockParamContentUnion `json:"content,omitzero" api:"required"`
ToolUseID string `json:"tool_use_id" api:"required"`
// Create a cache control breakpoint at this content block.
CacheControl CacheControlEphemeralParam `json:"cache_control,omitzero"`
// Tool invocation directly from the model.
Caller WebSearchToolResultBlockParamCallerUnion `json:"caller,omitzero"`
// This field can be elided, and will marshal its zero value as
// "web_search_tool_result".
Type constant.WebSearchToolResult `json:"type" default:"web_search_tool_result"`
// contains filtered or unexported fields
}
The properties Content, ToolUseID, Type are required.
func (WebSearchToolResultBlockParam) MarshalJSON ¶
func (r WebSearchToolResultBlockParam) MarshalJSON() (data []byte, err error)
func (*WebSearchToolResultBlockParam) UnmarshalJSON ¶
func (r *WebSearchToolResultBlockParam) UnmarshalJSON(data []byte) error
type WebSearchToolResultBlockParamCallerUnion ¶ added in v1.23.0
type WebSearchToolResultBlockParamCallerUnion struct {
OfDirect *DirectCallerParam `json:",omitzero,inline"`
OfCodeExecution20250825 *ServerToolCallerParam `json:",omitzero,inline"`
OfCodeExecution20260120 *ServerToolCaller20260120Param `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (WebSearchToolResultBlockParamCallerUnion) GetToolID ¶ added in v1.23.0
func (u WebSearchToolResultBlockParamCallerUnion) GetToolID() *string
Returns a pointer to the underlying variant's property, if present.
func (WebSearchToolResultBlockParamCallerUnion) GetType ¶ added in v1.23.0
func (u WebSearchToolResultBlockParamCallerUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (WebSearchToolResultBlockParamCallerUnion) MarshalJSON ¶ added in v1.23.0
func (u WebSearchToolResultBlockParamCallerUnion) MarshalJSON() ([]byte, error)
func (*WebSearchToolResultBlockParamCallerUnion) UnmarshalJSON ¶ added in v1.23.0
func (u *WebSearchToolResultBlockParamCallerUnion) UnmarshalJSON(data []byte) error
type WebSearchToolResultBlockParamContentUnion ¶
type WebSearchToolResultBlockParamContentUnion struct {
OfWebSearchToolResultBlockItem []WebSearchResultBlockParam `json:",omitzero,inline"`
OfRequestWebSearchToolResultError *WebSearchToolRequestErrorParam `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func NewWebSearchToolRequestError ¶
func NewWebSearchToolRequestError(errorCode WebSearchToolResultErrorCode) WebSearchToolResultBlockParamContentUnion
func (WebSearchToolResultBlockParamContentUnion) MarshalJSON ¶
func (u WebSearchToolResultBlockParamContentUnion) MarshalJSON() ([]byte, error)
func (*WebSearchToolResultBlockParamContentUnion) UnmarshalJSON ¶
func (u *WebSearchToolResultBlockParamContentUnion) UnmarshalJSON(data []byte) error
type WebSearchToolResultError ¶
type WebSearchToolResultError struct {
// Any of "invalid_tool_input", "unavailable", "max_uses_exceeded",
// "too_many_requests", "query_too_long", "request_too_large".
ErrorCode WebSearchToolResultErrorCode `json:"error_code" api:"required"`
Type constant.WebSearchToolResultError `json:"type" default:"web_search_tool_result_error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebSearchToolResultError) RawJSON ¶
func (r WebSearchToolResultError) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchToolResultError) UnmarshalJSON ¶
func (r *WebSearchToolResultError) UnmarshalJSON(data []byte) error
type WebSearchToolResultErrorCode ¶ added in v1.25.0
type WebSearchToolResultErrorCode string
const ( WebSearchToolResultErrorCodeInvalidToolInput WebSearchToolResultErrorCode = "invalid_tool_input" WebSearchToolResultErrorCodeMaxUsesExceeded WebSearchToolResultErrorCode = "max_uses_exceeded" WebSearchToolResultErrorCodeTooManyRequests WebSearchToolResultErrorCode = "too_many_requests" WebSearchToolResultErrorCodeQueryTooLong WebSearchToolResultErrorCode = "query_too_long" WebSearchToolResultErrorCodeRequestTooLarge WebSearchToolResultErrorCode = "request_too_large" )
type WebSearchToolResultErrorErrorCode ¶
type WebSearchToolResultErrorErrorCode = WebSearchToolResultErrorCode
Source Files
¶
- aliases.go
- beta.go
- betaagent.go
- betaagentversion.go
- betaenvironment.go
- betafile.go
- betamemorystore.go
- betamemorystorememory.go
- betamemorystorememoryversion.go
- betamessage.go
- betamessagebatch.go
- betamessageutil.go
- betamodel.go
- betaparse.go
- betasession.go
- betasessionevent.go
- betasessionresource.go
- betaskill.go
- betaskillversion.go
- betatoolrunner.go
- betauserprofile.go
- betavault.go
- betavaultcredential.go
- client.go
- completion.go
- field.go
- message.go
- messagebatch.go
- messageutil.go
- model.go
- schemautil.go
- thinking_warn.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aws provides client configuration for the Anthropic AWS gateway.
|
Package aws provides client configuration for the Anthropic AWS gateway. |
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|