Citation - Go SDK

Citation type definition

The Go SDK and docs are currently in beta. Report issues on GitHub.

Supported Types

AnthropicCitationCharLocationParam

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

AnthropicCitationContentBlockLocationParam

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

AnthropicCitationPageLocationParam

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

AnthropicCitationSearchResultLocation

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

AnthropicCitationWebSearchResultLocation

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

Union Discrimination

Use the Type field to determine which variant is active, then access the corresponding field:

1switch citation.Type {
2 case components.CitationTypeCharLocation:
3 // citation.AnthropicCitationCharLocationParam is populated
4 case components.CitationTypeContentBlockLocation:
5 // citation.AnthropicCitationContentBlockLocationParam is populated
6 case components.CitationTypePageLocation:
7 // citation.AnthropicCitationPageLocationParam is populated
8 case components.CitationTypeSearchResultLocation:
9 // citation.AnthropicCitationSearchResultLocation is populated
10 case components.CitationTypeWebSearchResultLocation:
11 // citation.AnthropicCitationWebSearchResultLocation is populated
12}