SessionTarget type
Target for a Voice Live session, specifying either a model or an agent.
Use { model: string } for model-centric sessions where the LLM is the main actor.
Use { agent: AgentSessionConfig } for agent-centric sessions where the agent is the main actor.
Example
Model-centric session
import { DefaultAzureCredential } from "@azure/identity";
import { VoiceLiveClient } from "@azure/ai-voicelive";
const credential = new DefaultAzureCredential();
const endpoint = "https://your-resource.cognitiveservices.azure.com";
const client = new VoiceLiveClient(endpoint, credential);
const session = client.createSession({ model: "gpt-4o-realtime-preview" });
Example
Agent-centric session
import { DefaultAzureCredential } from "@azure/identity";
import { VoiceLiveClient } from "@azure/ai-voicelive";
const credential = new DefaultAzureCredential();
const endpoint = "https://your-resource.cognitiveservices.azure.com";
const client = new VoiceLiveClient(endpoint, credential);
const session = client.createSession({
agent: { agentName: "my-agent", projectName: "my-project" },
});
type SessionTarget =
| { agent?: never; model: string }
| { agent: AgentSessionConfig; model?: never }