Fix: Observability API signature update and Azure AI Foundry endpoint compatibility#262
Open
Yogeshp-MSFT wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix: Observability API signature update and Azure AI Foundry endpoint compatibility#262Yogeshp-MSFT wants to merge 1 commit intomicrosoft:mainfrom
Yogeshp-MSFT wants to merge 1 commit intomicrosoft:mainfrom
Conversation
… inference request structure
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the sample agent to align with a breaking observability API signature change and to support Azure AI Foundry OpenAI-compatible endpoints that reject api-version query parameters.
Changes:
- Updated
InferenceScope.start()usage to the new(request, inferenceDetails, agentDetails)signature and movedconversationIdinto a newRequestobject. - Added detection/handling for Azure AI Foundry
/v1endpoints by routing throughChatOpenAIwith a normalizedbaseURLand Azure-requiredapi-keyheader. - Ignored generated Agent 365 config files that may contain secrets.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| nodejs/langchain/sample-agent/src/client.ts | Updates observability scope invocation and adds Azure AI Foundry endpoint compatibility handling. |
| .gitignore | Prevents committing generated Agent 365 config files that may contain secrets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes in src/client.ts to address a TypeScript compilation error and a runtime 400 error when using Azure AI Foundry endpoints.
Change 1 —
InferenceScopeAPI signature updateThe
@microsoft/agents-a365-observabilitypackage changed theInferenceScope.start()signature in a breaking way.Before:
InferenceScope.start(inferenceDetails, agentDetails, tenantDetails)After:
InferenceScope.start(request, inferenceDetails, agentDetails)TenantDetailsimport withRequestRequestobject to carryconversationId(previously incorrectly placed onAgentDetails)conversationIdfromAgentDetailstenantIdintoAgentDetails.tenantId, removing the separatetenantDetailsvariableInferenceScope.start()call to the new parameter orderFixes TS errors
TS2353(conversationIdnot inAgentDetails) andTS2559(InferenceDetailsincompatible withRequest).Change 2 — Azure AI Foundry endpoint support (Lines 59–86)
Azure AI Foundry endpoints (
*.services.ai.azure.com/.../openai/v1/...) are OpenAI-compatible and do not accept the?api-version=query parameter thatAzureChatOpenAIunconditionally appends, causing HTTP 400 errors./v1, useChatOpenAIwith a normalisedbaseURL(trimmed to.../v1),apiKeyset inconfiguration(required when using a custombaseURL), and anapi-keyheader as required by Azure*.openai.azure.comendpoints continue to useAzureChatOpenAIunchanged