Add extra_headers support to OpenAIModelConfiguration#45687
Draft
jingjingjia-ms wants to merge 2 commits intoAzure:mainfrom
Draft
Add extra_headers support to OpenAIModelConfiguration#45687jingjingjia-ms wants to merge 2 commits intoAzure:mainfrom
jingjingjia-ms wants to merge 2 commits intoAzure:mainfrom
Conversation
…I integration Add extra_headers field to OpenAIModelConfiguration TypedDict and merge it into per-call extra_headers in construct_prompty_model_config. This enables prompty-based evaluators to send custom HTTP headers (e.g., X-ModelType) required by the M365 LLM API. Includes an E2E test script and investigation doc for calling M365 LLM API from the Azure AI Evaluation SDK. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thank you for your contribution @jingjingjia-ms! We will review the pull request and get back to you soon. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Adds an
extra_headersfield toOpenAIModelConfigurationTypedDict, enabling prompty-based evaluators to send custom HTTP headers on every LLM call. This unblocks integration with LLM endpoints that require custom headers (e.g., M365 LLM API requiresX-ModelType).Changes
SDK (2 lines):
_model_configurations.py: Addextra_headers: NotRequired[Dict[str, str]]toOpenAIModelConfiguration_common/utils.py: Mergeextra_headersfrom model config into per-callextra_headersinconstruct_prompty_model_config()Samples:
test_m365_llmapi_e2e.py: E2E test demonstrating RelevanceEvaluator calling M365 LLM APIm365-llm-api-investigation.md: Investigation doc for M365 LLM API integration (M365-Copilot-Agent-Evals#138)How it works
Customer headers flow through the OpenAI SDK's
extra_headersparameter onchat.completions.create(), which merges after default headers - allowing override of any header includingAuthorization.Validated
E2E test confirmed: RelevanceEvaluator -> M365 LLM API -> score 4.0/5