SessionTarget type

Target لجلسة Voice Live، مع تحديد نموذج أو وكيل.

استخدامه { model: string } في جلسات تركز على النماذج حيث يكون الماجستير هو الممثل الرئيسي. يستخدم { agent: AgentSessionConfig } في الجلسات التي تركز على الوكيل حيث يكون الوكيل هو الفاعل الرئيسي.

Example

جلسة تركز على النماذج

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-realtime" });

Example

جلسة تركز على الوكيل

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 }