Follow these steps to set up the project:
git clone https://github.com/klinucsd/wenoknDownload and unzip the Data Commons vector database:
# Download from: https://hubbub.sdsc.edu/.test/data_commons.zip
# Extract the downloaded file to your project directoryDownload and extract the WENOKN vector database:
# Download from: https://hubbub.sdsc.edu/.test/wenokn.zip
# Extract the downloaded file to your project directoryInstall the required Python libraries:
pip install -r requirements.txtEdit the .env file to configure your environment settings. Make sure to include:
OPENAI_KEY=your_openai_api_key_hereRun the test to verify everything is working correctly:
python -m smart_query.test.data_system_test.pyYou can optionally run the system as a web API using FastAPI:
Ensure you have completed all the installation steps above, particularly:
- Vector databases are downloaded and extracted
- Dependencies are installed
- Environment variables are configured
python main.pyuvicorn main:app --host 0.0.0.0 --port 8000 --reloadOnce the server is running, you can:
- Interactive API Documentation: Visit
http://localhost:8000/docsfor Swagger UI - Query Endpoint:
http://localhost:8000/api/v1/query?query=your_question_here
# Example query
curl "http://localhost:8000/api/v1/query?query=What is the population of California?"import requests
# Make a query
response = requests.get(
"http://localhost:8000/api/v1/query",
params={"query": "What is the population of California?"}
)
print(response.json())The API returns JSON responses in the following format:
{
"query": "Your original query",
"result": "JSON formatted data result",
"status": "success"
}For production deployment, consider:
- Using a production ASGI server like Gunicorn with Uvicorn workers
- Setting up proper logging and monitoring
- Configuring SSL/TLS certificates
- Setting up load balancing if needed
- Make sure you have Python and pip installed on your system
- Ensure you have sufficient storage space for the vector databases
- Check that all file paths are correctly configured in your
.envfile - For FastAPI deployment, ensure your OpenAI API key is properly configured in the environment