使用 AzureFoundry 和 Bing Grounding Search 工具进行网络搜索基础,适用于需要通过 Azure AI Agent 从网络获取最新信息的场景。
Use the bundled Python script to perform grounded searches using Azure Foundry's Agent Service and the Bing Grounding Search Tool.
Required Python packages: bash
pip install azure-identity azure-ai-agents
Authentication:
az login), ORDefaultAzureCredential or ClientSecretCredential.Environment Variables:
Add the following to your ~/.openclaw/.env file or export them in your shell:
bash
# Your Azure AI Foundry project endpoint
FOUNDRY_PROJECT_ENDPOINT="https://<your-resource>.ai.azure.com/api/projects/<your-project>"
# The ID of the Bing Grounding connection in your Azure AI Foundry Project
BING_PROJECT_CONNECTION_ID="<your-connection-id>"
# Default model deployment name (optional, defaults to gpt-4o)
FOUNDRY_MODEL_DEPLOYMENT_NAME="gpt-4o"
# (Optional) Service Principal Credentials if not using DefaultAzureCredential
AZURE_TENANT_ID="<tenant-id>"
AZURE_CLIENT_ID="<client-id>"
AZURE_CLIENT_SECRET="<client-secret>"
Run from the OpenClaw workspace:
bash
# Raw JSON output (default)
python3 {baseDir}/scripts/bing_grounding.py --query "What is the latest AI news today?"
# Markdown human-readable output
python3 {baseDir}/scripts/bing_grounding.py --query "What is the latest AI news today?" --format md
# Use a specific model deployment (default is gpt-4o)
python3 {baseDir}/scripts/bing_grounding.py --query "Weather in Seattle?" --model "gpt-4o-mini"
Returns a generated response synthesized by the Azure AI Agent based on Bing Search results, along with the source URL citations.