-
Notifications
You must be signed in to change notification settings - Fork 864
fix(ai-proxy): Fix Azure OpenAI Response API handling and service URL type detection #2948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
修复 Azure OpenAI 响应 API 处理及服务 URL 类型检测变更概述
变更文件
时序图sequenceDiagram
participant PC as ProviderConfig
participant AP as AzureProvider
participant SE as StreamingEvents
PC->>AP: CreateProvider(config)
Note over AP: 检测服务 URL 类型<br/>处理响应 API 路径
AP-->>PC: 返回 AzureProvider 实例
SE->>SE: ExtractStreamingEvents(chunk)
Note over SE: 增加 valueStartIndex 空值检查
💡 小贴士与 lingma-agents 交流的方式📜 直接回复评论
📜 在代码行处标记
📜 在讨论中提问
Change OverviewProblem fix
Change file
Sequence chartsequenceDiagram
participant PC as ProviderConfig
participant AP as AzureProvider
participant SE as StreamingEvents
PC->>AP: CreateProvider(config)
Note over AP: Detect service URL type<br/> Process response API path
AP-->>PC: Return to AzureProvider instance
SE->>SE: ExtractStreamingEvents(chunk)
Note over SE: Increase valueStartIndex null value check
💡 TipsHow to communicate with lingma-agents📜 Reply to comments directly
**📜 Mark ** at line of code
📜 Ask a question during discussion
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2948 +/- ##
==========================================
+ Coverage 35.91% 44.95% +9.03%
==========================================
Files 69 82 +13
Lines 11576 13377 +1801
==========================================
+ Hits 4157 6013 +1856
+ Misses 7104 7016 -88
- Partials 315 348 +33 🚀 New features to boost your workflow:
|
What Changed
/openai/deploymentspatternExtractStreamingEventswherevalueStartIndexcould be -1Key Improvements
1. Enhanced service URL type detection
azureServiceUrlTypeFullinstead of incorrectly categorizing them asazureServiceUrlTypeDomainOnly2. Azure Response API support
ApiNameResponsesto model-irrelevant APIs list3. Bug fix for streaming
valueStartIndexin streaming event extraction to prevent potential issuesTesting
Summary
This fix ensures that Azure OpenAI integrations work correctly with both standard chat completion APIs and the new response API, while properly handling various service URL configurations.
Files Changed
provider/azure.go- Main logic fixes and enhancementsprovider/provider.go- Streaming event parsing fixtest/azure.go- Added comprehensive test coverage