Fix Azure OpenAI web_search_preview tool incompatibility

Azure OpenAI doesn't support the web_search_preview tool, which was causing
"Hosted tool 'web_search_preview' is not supported" errors with GPT-5 models.

## Changes:
- Pass dialect information to aixToOpenAIResponses function
- Skip web_search_preview tool addition when dialect is 'azure'
- Add logging when web search is skipped for Azure
- Document known Azure limitations in implementation guide

## Impact:
- Fixes web browsing errors with Azure GPT-5 models
- Maintains web search functionality for regular OpenAI models
- Provides clear logging for debugging

This is a critical fix for Azure OpenAI compatibility as web search is not
currently supported on Azure's Responses API implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
paulhshort
2025-08-11 20:07:19 -04:00
parent 9fe5697fd4
commit 3d93c856ba
3 changed files with 36 additions and 8 deletions
+24 -5
View File
@@ -113,14 +113,33 @@ Tested with Azure OpenAI endpoint `https://grid4openai.openai.azure.com`:
3. Add console logging is included to debug which API paradigm is being used
4. Environment variables provide full control over API versions and paradigms
## Known Limitations
### Azure OpenAI Specific Limitations
1. **Web Search Tool**: Azure OpenAI doesn't currently support the `web_search_preview` tool
- The fix automatically disables web search for Azure deployments
- Logs when web search is skipped: `[Azure] Skipping web_search_preview tool - not supported on Azure OpenAI`
- This affects all Azure models using the Responses API (GPT-5, o-series)
2. **GPT-5 Model Constraints**:
- No temperature control (only default value of 1.0 supported)
- Must use `max_completion_tokens` instead of `max_tokens`
- These constraints are already handled in the existing code
3. **Image Generation**: Multi-turn editing and streaming not yet supported on Azure
4. **File Upload**: Images can't be uploaded as files and referenced as input (coming soon)
## Benefits
1. **Fixes Issue #828**: Resolves "Resource Not Found" errors for GPT-5 and o3 Pro models
2. **Future-Proof**: Supports Azure's next-generation v1 API
3. **Backward Compatible**: Maintains support for existing deployments
4. **Robust**: Prevents malformed URLs from client misconfigurations
5. **Configurable**: Full control over API paradigms and versions
6. **Debuggable**: Includes logging for troubleshooting
2. **Handles Azure Limitations**: Automatically disables unsupported features like web search
3. **Future-Proof**: Supports Azure's next-generation v1 API
4. **Backward Compatible**: Maintains support for existing deployments
5. **Robust**: Prevents malformed URLs from client misconfigurations
6. **Configurable**: Full control over API paradigms and versions
7. **Debuggable**: Includes logging for troubleshooting
## Technical Details