Skip to content

DashScope Adapter

DashScope Adapter adapts a DashScope realtime multimodal session to genx.Transformer through dashscoperealtime.Transformer.

The public constructor is dashscoperealtime.New(dashscoperealtime.Config{Client: client}). It stores immutable provider options without opening a WebSocket; each concurrent Transform call creates its own session.

Core structure and main function

SymbolFunction
dashscoperealtime.ConfigStores the client, realtime model, audio format, voice, instructions, and turn detection configuration.
dashscoperealtime.NewCreates a Transformer from typed Config without opening a connection.
dashscoperealtime.Transformer.TransformEstablishes an independent realtime session for each call, writes the input Stream to the provider, and returns the unified output Stream.
dashscoperealtime.StreamWraps the realtime output Stream that supports session updates.

Provider session update and event name remain inside the Adapter; the caller only relies on GenX Stream and an explicit update contract.