Repository navigation
[azure-ai-projects] Emit GPT Live APIs from TypeSpec - #49629
xitzhang (xitzhang) wants to merge 14 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
…g checks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Apply scoped optional-selector typing corrections through PostEmitter while preserving public Literal types and runtime behavior. Add constructor and annotation regression coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the latest Azure/azure-rest-api-specs PR 47196 commit, including effective Foundry delegation ownership in Live lifecycle and delegation events. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve generated API markdown formatting and its matching metadata hash; restore the existing SDK post-emitter corrections without changing their behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add offline coverage for all lifecycle snapshots, delegation ownership targets, native/null delegation preservation, pinned versions and public exports. Document the new unreleased metadata models without adding SDK-local model conversion patches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate feature/azure-ai-projects/vnext at ba6c352. Preserve upstream Cloud Computer Use models and existing GPT Live ownership models, retain the GPT Live source pin, and regenerate paired API reports from the combined model surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve generation metadata conflicts in the emitted branch first. Preserve the vnext profanity-filter option and deprecated Cloud Computer Use removals alongside GPT Live metadata, and regenerate matching API reports from the merged surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the non-emitted deserialization hook, its six behavior tests and its bug-fix entry from this emitted-only branch. The WebSocket/custom-code branch retains the same implementation and coverage; generated models and post-emitter typing corrections remain unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate feature/azure-ai-projects/vnext at a85414b. Retain the GPT Live source pin and matching cross-language/API metadata; the base OpenAI TypeSpec update is already represented in this emitted SDK. Keep the handwritten readback hook out of this PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The GPT Live samples now define agents with the azure-ai-projects VoiceAgentLiveDefinition and PromptAgentDefinition models and create, read back, and delete them through AIProjectClient.agents instead of raw httpx REST calls. Audio still uses the OpenAI Live SDK because the preview build has no Live WebSocket client. The GPT Live models are not on PyPI yet, so bundle the unmodified azure_ai_projects-2.10.0 wheel from azure-sdk build 6995855 (Azure/azure-sdk-for-python#49629) in dist/ and install it from the gpt_live requirements. dist/README.md records its source and SHA-256. Offline lifecycle tests now drive the real SDK client against an in-memory transport and also cover response_delegation.py. Co-Authored-By: Claude <noreply@anthropic.com>
The GPT Live samples now define agents with the azure-ai-projects VoiceAgentLiveDefinition and PromptAgentDefinition models and create, read back, and delete them through AIProjectClient.agents instead of raw httpx REST calls. Audio still uses the OpenAI Live SDK because the preview build has no Live WebSocket client. The GPT Live models are not on PyPI yet, so bundle the unmodified azure_ai_projects-2.10.0 wheel from azure-sdk build 6995855 (Azure/azure-sdk-for-python#49629) in dist/ and install it from the gpt_live requirements. dist/README.md records its source and SHA-256. Offline lifecycle tests now drive the real SDK client against an in-memory transport and also cover response_delegation.py. Co-Authored-By: Claude <noreply@anthropic.com>
The GPT Live samples now define agents with the azure-ai-projects VoiceAgentLiveDefinition and PromptAgentDefinition models and create, read back, and delete them through AIProjectClient.agents instead of raw httpx REST calls. Audio still uses the OpenAI Live SDK because the preview build has no Live WebSocket client. The GPT Live models are not on PyPI yet, so bundle the unmodified azure_ai_projects-2.10.0 wheel from azure-sdk build 6995855 (Azure/azure-sdk-for-python#49629) in dist/ and install it from the gpt_live requirements. dist/README.md records its source and SHA-256. Offline lifecycle tests now drive the real SDK client against an in-memory transport and also cover response_delegation.py.
…S sample (#72) * Use the preview Projects SDK for GPT Live agent lifecycle The GPT Live samples now define agents with the azure-ai-projects VoiceAgentLiveDefinition and PromptAgentDefinition models and create, read back, and delete them through AIProjectClient.agents instead of raw httpx REST calls. Audio still uses the OpenAI Live SDK because the preview build has no Live WebSocket client. The GPT Live models are not on PyPI yet, so bundle the unmodified azure_ai_projects-2.10.0 wheel from azure-sdk build 6995855 (Azure/azure-sdk-for-python#49629) in dist/ and install it from the gpt_live requirements. dist/README.md records its source and SHA-256. Offline lifecycle tests now drive the real SDK client against an in-memory transport and also cover response_delegation.py. * Stream GPT Live audio with the Projects SDK Live client Rebuild the bundled azure-ai-projects 2.10.0 wheel from source on xitzhang/gpt-live-websocket (c69c028, Azure/azure-sdk-for-python#49631), which adds beta.voice_agents.live on top of the GPT Live models. The samples now open audio sessions with project.beta.voice_agents.live instead of the OpenAI Live SDK, so openai[realtime] is no longer a requirement; the wheel's [voice] extra brings aiohttp for the client. The SDK yields generated models for known Live events and dicts for the unmodeled session.managed_delegation.* events, so event handling uses mapping access for the type. Offline tests now route the SDK's wss:// Live handshake to a local WebSocket server. * Drop session.managed_delegation.* handling from GPT Live samples The service no longer emits session.managed_delegation.* events. For foundry_managed_agent delegation it sends session.delegation.created, the prompt agent's Responses stream as response.event with that delegation ID, and session.commentary/thinking.appended when Foundry forwards an accepted section to GPT Live. The Delegation pane now shows managed backend status and raw tagged-text output from response.event, and marks the latest delegation when Foundry acknowledges forwarding. Managed backend failures stay visible without ending the session. ManagedToolHandler no longer waits for the removed completion events. * Add JavaScript GPT Live samples with the preview Projects SDK Add samples/gpt_live_js: Node.js versions of the GPT Live Responses and managed prompt-agent delegation samples. Agents are created, read back, and deleted with AIProjectClient.agents, and audio streams through project.beta.voiceAgents.live. Node has no built-in audio devices, so the samples stream a recorded PCM16/24 kHz WAV question in real time and can save the spoken reply. The JS SDK's GPT Live client is not released and its pull request has no CI build, so bundle a local Node ESM build of @azure/ai-projects 2.10.0 from Azure/azure-sdk-for-js#40419 (4201af1) in dist/, recorded in dist/README.md. Managed delegation follows the current service: session.delegation.created, response.event lifecycle, and session.commentary.appended, with no session.managed_delegation.*. Offline node:test tests drive the real SDK client with an in-memory HTTP client and a scripted Live WebSocket transport. * Split GPT Live samples into python/ and a browser js/ sample Move the Python GPT Live samples into samples/gpt_live/python and keep a shared samples/gpt_live/.env for both languages; update the downloader path, the realtime_stt audio import, and the READMEs. Replace the WAV-based JavaScript CLI samples with samples/gpt_live/js, a simple browser sample with microphone input. A Node.js server creates or reuses the agents with the preview @azure/ai-projects package (Responses delegation by default, --managed for a pinned prompt agent), serves the page, and relays each page's microphone audio to a GPT Live session through project.beta.voiceAgents.live. The page captures 24 kHz PCM16 with an AudioWorklet, plays the teacher's audio, and shows GPT Live, Delegation, and You panes. The credential stays on the server, which listens on 127.0.0.1 and accepts Live connections only from its page. Offline node:test tests cover agent setup, the relay, and the HTTP surface with the real SDK client. * Add a Voice Agent structured-input sample Add samples/voice_agent_with_structured_input.py with its guide and an example input file: declare structured inputs with StructuredInputDefinition, reference them in the saved instructions with Handlebars placeholders, and pass per-session values through the Projects SDK's structured_inputs argument (or the x-ms-voice-structured-inputs header for deployments that reject the query parameter). Offline tests in tests/test_structured_input.py use the real SDK client. * Add MCP and local function tools to the browser sample's managed mode npm run managed now mirrors prompt_agent_delegation_tools.py: the prompt agent gets the public MCP calculator (add only) and a local get_current_datetime function, and the GPT Live agent is told to delegate addition and date/time questions. The server collects completed function calls from response.event, waits for response.completed, sends each function_call_output with response.item.create, then one response.create to resume the managed delegation. This preview JS SDK refuses response.item.create and response.create unless the session uses Responses delegation, and doesn't export its Node transport. live_transport.mjs therefore opens each session with VoiceAgentLiveClient over a small ws transport passed through the public webSocketFactory option, and sends those two commands on it directly; everything else still goes through the SDK. Verified live on voice-live-tip: the MCP calculator answered 17 + 25, and the local function's time (with its IANA timezone) was spoken back. * Connect the browser sample to GPT Live directly instead of relaying The page now opens the agent's Live WebSocket itself with the SDK's VoiceAgentLiveClient, bundled for the browser with esbuild. The local server no longer relays audio or Live events: it creates the agents, serves the page, and returns an access token from az login on POST /token, only to its own page (Host and Origin checks). Browsers cannot set handshake headers, so the page's transport offers the "live" and "authorization.bearer.<token>" subprotocols, which Foundry promotes to an Authorization header and answers with "live", and uses api-version=2025-11-15-preview in place of the Foundry-Features header. The managed tools' local date/time function now runs in the page and still returns its results with response.item.create and response.create on the same socket. --------- Co-authored-by: Zheng Niu <zhn@microsoft.com>
Align OpenAI TypeSpec and its lockfile to 1.32.0. Regenerate SDK models and paired API artifacts, retaining existing post-emitter fixes. VoiceAgents validation passes: wheel/sdist, 112 offline model/transport tests, SDK Mypy/Pylint/Black and SDK/VoiceAgents Pyright. Full-sample Pyright retains 30 shared-tool naming errors outside VoiceAgents, left unchanged per review scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate feature/azure-ai-projects/vnext at 64c21d9. Preserve the canonical GPT Live emission and required OpenAI TypeSpec 1.32 dependency, with all incoming VoiceAgents model/enum additions already represented. Retain the upstream tracing fix and saved generation configuration, and regenerate paired API artifacts. Validated wheel build, 114 related tests, VoiceAgents Pyright and repository formatting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Update existing sync and async tool and telemetry test consumers to the emitted Tool-prefixed models, including ToolMcpTool where a Tool subtype is required. Preserve assertions, request payloads, recordings and test enablement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
[Pilot] PR Pipeline Failure AnalysisWhat failedAzure Pipeline build 7017865 failed for 1. Test failures (15 unique sample tests × 12 artifact files, same root cause everywhere): 2. Pyright check (30 errors) — same root cause as above: 3. CSpell check failure (unrelated to the above): Relevant pipeline outputRecommended next steps
Automated fix: Requested
|
Update existing agent, tool, workflow, and evaluation samples to the generated Tool-prefixed models. Keep request payloads and sample behavior unchanged. Scope valid voice names and SDK terminology to azure-ai-projects in the spelling dictionary without editing generated SDK code or disabling checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
First PR in a two-part GPT Live stack, targeting
feature/azure-ai-projects/vnext.This PR contains TypeSpec-emitted SDK APIs and only the supporting changes needed to generate and consume them. It does not add a handwritten Live WebSocket client or new Live samples.
Generation
e30cf6f0dcfbca167edf731d4e48874a63639e8b.tsp-client update --debug, followed by the repository'sPostEmitter.ps1.0.63.10, compiler1.17.0, OpenAI TypeSpec1.29.0.Necessary supporting changes
@azure-tools/openai-typespecfrom1.28.0to1.29.0, as required by the service specification.sub_protocolreadback hook and its behavior tests belong to dependent custom-code PR [azure-ai-projects] Add GPT Live WebSocket clients and samples #49631.No emitted Python source was hand-edited; only the established automated post-emitter corrections are included.
Original implementation validation (before metadata regeneration)
beta.voice_agents.liveis intentionally absent.--noconftestto avoid the unrelated recorded-test proxy bootstrap in the sparse validation checkout.npm ci --dry-run --ignore-scripts --no-audit --no-fundpassed. Existing Node 22.17 / Babel 22.18 engine warnings remain non-blocking.Scope / follow-up
Metadata regeneration update - 2026-10-23
Regenerated this existing emitted-only PR from the latest head of
Azure/azure-rest-api-specs#47196:
e30cf6f0dcfbca167edf731d4e48874a63639e8b.API changes
VoiceAgentLiveSessionResourceinsession.started,session.updated, andsession.closed.VoiceAgentLiveDelegationItem.foundry_managed_agentownership and the resolved agent version,rather than presenting the native client's internal delegation owner.
No released 2.9.0 model/export is removed.
Regeneration and validation
tsp-client update --debug: passed, pinned to the full commit above.PostEmitter.ps1: passed, including paired API export and the public-method inventory.api.md/api.metadata.yml: regenerated together; exact metadata hash verified.APIView's canonical generated Markdown formatting is retained.
pinned versions, wire roundtrips, native/null delegation modes, and public exports.
The automated optional-selector post-emitter typing corrections remain here. The handwritten
sub_protocolruntime readback hook is owned by custom-code PR #49631, not this emitted PR.This PR remains draft. The handwritten client consumer updates remain in #49631.
SDK base update - 2026-10-23
Merged the current
feature/azure-ai-projects/vnextbase atba6c352b044d5705c3d654a1d35c5b8522aebeb2into this emitted branch in commitede03b49d28fdb682cd199946d83825c55e4f956.tsp-location.yamland the APIView source-version conflict in favor of this PR's GPT Live source pin, while retaining the incoming Cloud Computer Use cross-language mappings.api.mdandapi.metadata.ymltogether from the combined model surface and verified their exact hash.Source provenance / next emission
This was an SDK-base integration, not a fresh TypeSpec re-emission. The GPT Live source remains
e30cf6f0dcfbca167edf731d4e48874a63639e8b; the base's Cloud Computer Use models originated fromb2cf9e36ed967aae8c43ed56973e1d1ac99255b3. Azure/azure-rest-api-specs#47196 currently has independent conflicts with its own base. Before another full emission, the upstream TypeSpec source must include both feature sets so regeneration does not remove the inherited Cloud Computer Use models. No upstream specification branch was changed here.The local WebSocket branch and #49631 remain at
c69c028870ca5ad18cec77373dbba30e2a4be82d; no WebSocket files, commits, or pushes were made for this update.Emitted-first base integration - 2026-10-26
Merged current
feature/azure-ai-projects/vnextat12fdcce0b41fb1689c6bae09fd13060ac720f38einto this emitted branch first; published commit99c7cdce70854f21b54847040ce6e9fa2ac1f1d0.VoiceAgentProfanityFilterModeand optionalVoiceAgentInputTranscription.profanity_filterproperty from the base.b9dab8e10c9c0ea2ede30861977bf9d23332477f69e250c79e4a32de8b0531f8.main; all such inherited changes were preserved. Only six package files differ from this PR's prior head as part of this integration.e30cf6f0dcfbca167edf731d4e48874a63639e8b; the base additions originate from843aff73c2ace0d34082b485d72e0752e7849640. This was an SDK base merge, not a fresh single-source TypeSpec emission. A future full emission must first combine both upstream source feature sets.The published emitted branch was then synchronized into the local WebSocket checkout using a non-committing merge. No WebSocket commit or push was made; that local sync is pending explicit user approval. CI completion is separate from source mergeability and is not claimed as all-green here.
Handwritten customization relocation - 2026-10-26
Addressed the scope of Howie's review comment in commit
e8fdf78f48e082d235585999daa305407e4ba53d:_deserialize_voice, itspatch_sdk()registration, and its exclusive_modelsimport from this emitted branch.models/_patch.pynow matches the current feature-branch base exactly.The raw generated-only readback uses
VoiceAgentBaseDefinitionand preserves payloads/omission. Concrete Live/Realtime subtype preservation remains supplied by the dependent handwritten branch. The latest parent has been synced locally into that branch with the original hook and six tests retained; that WebSocket sync remains uncommitted/unpushed pending explicit approval. The review thread has not been resolved or replied to automatically.Current base conflict fix - 2026-10-26
The feature base advanced again to
a85414bb8a99d8e84b6737621639797152bb0fe1, creating new conflicts after the earlier integration. Merged that exact base and resolved all three generation-metadata conflicts in emitted commitd0f96d113e27ccbab63eba5f264c93395f8b0e2d.e8fdf78f48e; this new emitted integration was not automatically merged there.Source mergeability is separate from CI status; all-green CI is not claimed.