This project implements a Python-based LangChain agent that utilizes various tools to provide information based on natural language queries. The agent is exposed over a single FastAPI endpoint and can be interacted with using Postman.
- Query Database: Queries the Northwind database.
- Search Internet: Performs general internet searches.
- Get Weather: Retrieves weather information.
- Get IP Info: Obtains IP-related information.
- Get Pokémon Info: Fetches details about Pokémon.
- Get Movie Info: Retrieves movie information.
- query_db: Queries the Northwind database.
- search_internet: Performs general internet searches.
- get_weather: Retrieves weather information.
- get_ip_info: Obtains IP-related information.
- get_pokemon_info: Fetches details about Pokémon.
- get_movie_info: Retrieves movie information.
The agent is exposed over a single FastAPI endpoint where you can input a natural language query using Postman. The agent automatically selects the appropriate tool based on the query and responds with accurate information.
POST /query
Body:
{
"query": "Your natural language query here"
}
Body:
{
"response": "The agent's response based on your query"
}
-
Clone the repository:
git clone https://github.com/Theedon/AfriChain.git cd AfriChain
-
Install dependencies: Ensure you have Poetry installed.
poetry install
-
Set environment variables: Create a
.env
file in the root of your project and add the necessary environment variables:OPENAI_API_KEY=your_openai_api_key GOOGLE_API_KEY=your_google_api_key HUGGINGFACEHUB_API_TOKEN=your_huggingfacehub_api_token HF_TOKEN=your_hf_token LANGCHAIN_API_KEY=your_langchain_api_key MISTRAL_API_KEY=your_mistral_api_key TOGETHER_API_KEY=your_together_api_key ANTHROPIC_API_KEY=your_anthropic_api_key OPENWEATHERMAP_API_KEY=your_openweathermap_api_key OMDB_API_KEY=your_omdb_api_key TMDB_API_KEY=your_tmdb_api_key TAVILY_API_KEY=your_tavily_api_key
-
Run the application: Use Poetry to run the FastAPI application with Uvicorn, enabling hot reloading.
poetry run africhain
You can interact with the agent using Postman. Send a POST request to http://0.0.0.0:8000/query
with a JSON body containing your query.
The project is deployed on render as a service at this url