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

Supported Types

AnthropicCitationCharLocationParam

citation := components.CreateCitationCharLocation(components.AnthropicCitationCharLocationParam{/* values here */})

AnthropicCitationContentBlockLocationParam

citation := components.CreateCitationContentBlockLocation(components.AnthropicCitationContentBlockLocationParam{/* values here */})

AnthropicCitationPageLocationParam

citation := components.CreateCitationPageLocation(components.AnthropicCitationPageLocationParam{/* values here */})

AnthropicCitationSearchResultLocation

citation := components.CreateCitationSearchResultLocation(components.AnthropicCitationSearchResultLocation{/* values here */})

AnthropicCitationWebSearchResultLocation

citation := components.CreateCitationWebSearchResultLocation(components.AnthropicCitationWebSearchResultLocation{/* values here */})

Union Discrimination

Use the Type field to determine which variant is active, then access the corresponding field:
switch citation.Type {
	case components.CitationTypeCharLocation:
		// citation.AnthropicCitationCharLocationParam is populated
	case components.CitationTypeContentBlockLocation:
		// citation.AnthropicCitationContentBlockLocationParam is populated
	case components.CitationTypePageLocation:
		// citation.AnthropicCitationPageLocationParam is populated
	case components.CitationTypeSearchResultLocation:
		// citation.AnthropicCitationSearchResultLocation is populated
	case components.CitationTypeWebSearchResultLocation:
		// citation.AnthropicCitationWebSearchResultLocation is populated
}