# Issue Description

> Bing Web Search service has been deprecated by Microsoft and is no longer available for use.

- Skill: `tools-only/issue-description-5` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/issue-description-5`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/issue-description-5/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-29
- Page: https://skillmd.com/skills/tools-only/issue-description-5

---

# BING_WEB_SEARCH_REMOVAL_FIX.md

**Version Implemented:** 0.229.001

## Issue Description

Bing Web Search service has been deprecated by Microsoft and is no longer available for use. The application needed to be updated to remove all Bing Web Search functionality to prevent errors and maintain a clean codebase.

## Root Cause Analysis

The application had integrated Bing Web Search functionality across multiple components:
- Backend search functions (`functions_bing_search.py`)
- Configuration settings for Bing API endpoints
- User interface elements for web search
- Chat processing logic that included Bing search results
- Admin settings for configuring Bing search

With the deprecation of the service, these components were causing potential issues and needed complete removal.

## Technical Details

### Files Modified

1. **Removed Files:**
   - `functions_bing_search.py` - Complete file removal

2. **Modified Files:**
   - `config.py` - Removed `bing_search_endpoint` configuration
   - `functions_settings.py` - Removed all Bing-related settings
   - `route_backend_chats.py` - Removed Bing imports, processing, and metadata
   - `templates/admin_settings.html` - Removed Bing Web Search configuration section
   - `templates/chats.html` - Removed web search button from chat interface

### Code Changes Summary

**Configuration Removal:**
- Removed `bing_search_endpoint = "https://api.bing.microsoft.com/"` from config.py
- Removed Bing-related settings from default settings dictionary

**Backend Processing Removal:**
- Removed `from functions_bing_search import *` import
- Removed `bing_search_enabled` variable extraction from request data
- Removed entire Bing search processing section including:
  - `process_query_with_bing_and_llm()` function calls
  - Bing citation collection and formatting
  - Web search results integration into system messages
- Removed Bing citations from message metadata
- Updated comments to remove Bing references

**Frontend Removal:**
- Removed entire Bing Web Search configuration card from admin settings
- Removed web search toggle button from chat interface
- Updated page descriptions to remove Bing references

**Settings Cleanup:**
- Removed `enable_web_search`, `bing_search_key`, `enable_web_search_apim`
- Removed `azure_apim_web_search_endpoint`, `azure_apim_web_search_subscription_key`

## Testing Approach

Created comprehensive functional test (`test_bing_web_search_removal.py`) that validates:
1. **File Removal:** Confirms `functions_bing_search.py` no longer exists
2. **Configuration Cleanup:** Verifies no Bing endpoints remain in config
3. **Settings Cleanup:** Confirms all Bing settings removed
4. **Backend Cleanup:** Validates no Bing imports or processing remain
5. **Frontend Cleanup:** Confirms UI elements completely removed
6. **Version Update:** Verifies version incremented correctly

## Test Results

All 6 validation tests pass:
- ✅ Bing functions file removal test passed
- ✅ Bing configuration removal test passed  
- ✅ Bing settings removal test passed
- ✅ Bing backend code removal test passed
- ✅ Bing template removal test passed
- ✅ Version update test passed

## Impact Analysis

**Positive Impacts:**
- Eliminates deprecated service dependencies
- Prevents potential API errors from dead endpoints
- Reduces codebase complexity
- Improves maintainability
- Removes unused UI elements

**User Experience:**
- Web search button no longer appears in chat interface
- Admin settings no longer include Bing configuration options
- No impact on core chat functionality
- Document search and other features remain fully functional

**No Breaking Changes:**
- Core application functionality unaffected
- Existing conversations and data preserved
- Other search capabilities (document search, AI search) remain intact

## Validation

The removal has been thoroughly tested and validated through:
1. Automated functional testing covering all modified components
2. File system verification of removed files
3. Code analysis confirming clean removal of all references
4. UI validation confirming clean admin and chat interfaces

## Future Considerations

- Alternative web search solutions could be integrated if needed
- The modular design allows for easy addition of new search providers
- Current Azure AI Search functionality provides document-based search capabilities
- No immediate replacement planned as core chat functionality is preserved

