Powered by Exa
This project combines IBM WatsonX AI with Exa's web search to create a smart AI assistant that can search the internet and answer questions with up-to-date information.
- You ask a question
- The AI (using IBM WatsonX) decides if it needs to search the web
- If needed, it uses Exa to search the internet
- The AI then gives you an answer using both the search results and its own knowledge
- It includes sources and links in its answers
- Uses IBM WatsonX's Mistral model for smart decision making
- Searches the web using Exa for current information
- Automatically cites sources in answers
- Handles both simple questions and complex topics
-
You need two API keys:
- IBM WatsonX API key
- Exa API key
-
Create a
.env
file with your keys:
IBM_WATSONX_API_KEY=your_ibm_key_here
IBM_WATSONX_URL=https://us-south.ml.cloud.ibm.com
IBM_WATSONX_PROJECT_ID=your_project_id_here
EXA_API_KEY=your_exa_key_here
- Install Python requirements:
python -m venv venv
source venv/bin/activate # On Unix/macOS
pip install -r requirements.txt
There are several ways to try out this integration:
-
Using Jupyter Notebook: Run the
ibm_exa_integration.ipynb
notebook to interactively try out the integration in a notebook environment. -
Running the Example Script:
python -m src.example
- Using in Your Code:
from src.model import WatsonXModel
# Initialize the model
model = WatsonXModel(exa_api_key="your_exa_key")
# Ask a question
answer = model.ask("What are the latest developments in AI regulation?")
print(answer)
ibm-exa/
├── src/
│ ├── client.py # IBM WatsonX setup
│ ├── exa_client.py # Web search client
│ ├── model.py # Main AI model
│ ├── tools.py # Search tool definition
│ └── example.py # Usage example
├── .env # Your API keys
└── requirements.txt # Python packages needed
- Tool Calling: The AI can decide when it needs to search the web for information
- Web Search: Uses Exa's API to find relevant and current information
- Smart Answers: Combines search results with the AI's knowledge
- Python 3.8 or higher
- IBM WatsonX account and API key
- Exa API key