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

Supported Types

FormatTextConfig

formats := components.CreateFormatsText(components.FormatTextConfig{/* values here */})

FormatJSONObjectConfig

formats := components.CreateFormatsJSONObject(components.FormatJSONObjectConfig{/* values here */})

FormatJSONSchemaConfig

formats := components.CreateFormatsJSONSchema(components.FormatJSONSchemaConfig{/* values here */})

Union Discrimination

Use the Type field to determine which variant is active, then access the corresponding field:
switch formats.Type {
	case components.FormatsTypeText:
		// formats.FormatTextConfig is populated
	case components.FormatsTypeJSONObject:
		// formats.FormatJSONObjectConfig is populated
	case components.FormatsTypeJSONSchema:
		// formats.FormatJSONSchemaConfig is populated
	default:
		// Unknown type - use formats.GetUnknownRaw() for raw JSON
}