For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
    • Overview
    • Usage for Agents
  • TypeScript SDK
    • Overview
  • Python SDK
    • Overview
  • Go SDK
      • Analytics
      • APIKeys
      • Byok
      • Chat
      • Credits
      • Embeddings
      • Endpoints
      • Generations
      • Guardrails
      • OAuth
      • Observability
        • InputUnion
      • Organization
      • Presets
      • Providers
      • Rerank
      • Beta.Responses
      • Transcriptions
      • Speech
      • VideoGeneration
      • Workspaces
  • DevTools
    • Overview
    • Migrating to @openrouter/agent
LogoLogo
ModelsChatRankingsDocs
On this page
  • Supported Types
  • Union Discrimination
Go SDKAPI ReferenceOperations

InputUnion - Go SDK

InputUnion type definition
Was this page helpful?
Previous

Organization - Go SDK

Organization method reference
Next
Built with

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

Text, token, or multimodal input(s) to embed

Supported Types

1inputUnion := operations.CreateInputUnionStr(string{/* values here */})

1inputUnion := operations.CreateInputUnionArrayOfStr([]string{/* values here */})

1inputUnion := operations.CreateInputUnionArrayOfNumber([]float64{/* values here */})

1inputUnion := operations.CreateInputUnionArrayOfArrayOfNumber([][]float64{/* values here */})

1inputUnion := operations.CreateInputUnionArrayOfInput([]operations.Input{/* values here */})

Union Discrimination

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

1switch inputUnion.Type {
2 case operations.InputUnionTypeStr:
3 // inputUnion.Str is populated
4 case operations.InputUnionTypeArrayOfStr:
5 // inputUnion.ArrayOfStr is populated
6 case operations.InputUnionTypeArrayOfNumber:
7 // inputUnion.ArrayOfNumber is populated
8 case operations.InputUnionTypeArrayOfArrayOfNumber:
9 // inputUnion.ArrayOfArrayOfNumber is populated
10 case operations.InputUnionTypeArrayOfInput:
11 // inputUnion.ArrayOfInput is populated
12}