Add API version to enable Azure OpenAI for Analysis Support
This MR adds Azure support to Analysis Support by using the Azure OpenAI LangChain integration for draft analysis and analysis endpoints when the base URL contains "azure.com" and adds DRAFT_ANALYSIS_API_VERSION
to configure the Azure API version.
Steps to test
- In
.env
, update this block to:
# Draft Analysis Model
DRAFT_ANALYSIS_MODEL=o4-mini
DRAFT_ANALYSIS_TEMPERATURE=0.7 # temperature apparently not allowed with Azure OpenAI, does nothing
DRAFT_ANALYSIS_API_BASE=https://lfc-azure-openai-test.openai.azure.com/
DRAFT_ANALYSIS_API_KEY="<redacted>"
DRAFT_ANALYSIS_API_VERSION="2024-12-01-preview"
FASTAPI_DEBUG=false uv run --env-file .env -m api.server
curl -X 'POST' \
'http://localhost:8889/draft-analyses?mock=false' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <redacted>' \
-H 'Content-Type: application/json' \
-d '{
"considerations": "Respond in limerick.",
"list": [
{
"considerations": "Answer the joke.",
"text": "Why the did the chicken cross the road?"
}
]
}'
Expected Result
Something like:
{
"result": {
"analysis_0": {
"id": "run--cd2fbb77-ada1-481f-8ad0-bfb0e8a5b4c4-0",
"content": "To get to the other side."
},
"summary": {
"id": "run--14180d87-f547-4f55-8cbb-91345bc510d0-0",
"content": "There once was a chicken in stride \nWho ventured across roads so wide \nDespite honks from the past, \nAnd engines roaring fast, \nTo get to the other side."
}
}
}
Deployment Checklist
-
Update environment variables -
Test with Analysis Support script
Edited by Chris Zubak-Skees