Skip to main content
The Go SDK and docs are currently in beta. Report issues on GitHub.

Supported Types

AnthropicBase64PdfSource

anthropicDocumentBlockParamSourceUnion := components.CreateAnthropicDocumentBlockParamSourceUnionBase64(components.AnthropicBase64PdfSource{/* values here */})

AnthropicPlainTextSource

anthropicDocumentBlockParamSourceUnion := components.CreateAnthropicDocumentBlockParamSourceUnionText(components.AnthropicPlainTextSource{/* values here */})

SourceContent

anthropicDocumentBlockParamSourceUnion := components.CreateAnthropicDocumentBlockParamSourceUnionContent(components.SourceContent{/* values here */})

AnthropicURLPdfSource

anthropicDocumentBlockParamSourceUnion := components.CreateAnthropicDocumentBlockParamSourceUnionURLObj(components.AnthropicURLPdfSource{/* values here */})

Union Discrimination

Use the Type field to determine which variant is active, then access the corresponding field:
switch anthropicDocumentBlockParamSourceUnion.Type {
	case components.AnthropicDocumentBlockParamSourceUnionTypeBase64:
		// anthropicDocumentBlockParamSourceUnion.AnthropicBase64PdfSource is populated
	case components.AnthropicDocumentBlockParamSourceUnionTypeText:
		// anthropicDocumentBlockParamSourceUnion.AnthropicPlainTextSource is populated
	case components.AnthropicDocumentBlockParamSourceUnionTypeContent:
		// anthropicDocumentBlockParamSourceUnion.SourceContent is populated
	case components.AnthropicDocumentBlockParamSourceUnionTypeURLObj:
		// anthropicDocumentBlockParamSourceUnion.AnthropicURLPdfSource is populated
}