Add images, audio, and model thinking You declare images, files, audio, and other media in the program contract. Provider support determines which media and thinking controls are available. go academy academy/topics/media-audio-thinking website/content-src/academy/course.mjs academy Add images, audio, and model thinking
Unit 11 · Ship AI systems you can operate

Add images, audio, and model thinking

You declare images, files, audio, and other media in the program contract. Provider support determines which media and thinking controls are available.

10 focused minutesNot started
Worked example

See the idea in context

// Realtime audio over WebSocket — needs Go 1.23+
client := ax.NewOpenAIResponsesClient(map[string]ax.Value{"model": "gpt-realtime-2", "api_key": os.Getenv("OPENAI_APIKEY")})
request := map[string]ax.Value{"model": "gpt-realtime-2", "chat_prompt": ax.Array(ax.Object("role", "user", "content", "Say hello.")), "audio": ax.Object("output", ax.Object("voice", "alloy"))}
final, _ := client.RealtimeChat(context.Background(), request, nil, nil)  // one merged turn: transcript + base64 PCM audio
// Realtime models also route transparently through Chat(); Chat() accepts input_audio parts; Transcribe()/Speak() do batch STT/TTS.
Run itIn your own project
go get github.com/ax-llm/ax/packages/go

import axllm "github.com/ax-llm/ax/packages/go"

client := axllm.NewAI("openai", map[string]axllm.Value{"apiKey": os.Getenv("OPENAI_API_KEY")})
classify := axllm.NewAx("review:string -> sentiment:class \"positive, negative, neutral\"", nil)

Set OPENAI_APIKEY in your environment before running provider-backed code.

In the ax repo

From a clone of the ax repo:

npm run example -- go src/examples/go/long-agents/smart_defaults_agent.go
Active practice

Show that you can use it

Answer 2 in a row to learn this · attempt 1
Keep exploring

Source-backed follow-up