A Streamlit web application that uses LangChain and the Google Places API to help users find restaurants that are currently open within a specified distance from their location.
- Find restaurants that are currently open near a specified location
- Filter results by distance, cuisine type, and other criteria
- Get detailed information about specific restaurants
- User-friendly chat interface powered by LangChain
LangChain-FindMyDinner/
├── README.md # Project documentation
├── .env.example # Template for environment variables
├── requirements.txt # Project dependencies
├── app.py # Main Streamlit application
├── agent/ # LangChain agent implementation
│ ├── __init__.py
│ ├── agent.py # Agent definition
│ └── tools.py # Custom LangChain tools
├── services/ # External service integrations
│ ├── __init__.py
│ └── places_api.py # Google Places API wrapper
└── utils/ # Utility functions
├── __init__.py
└── helpers.py # Helper functions
- OpenAI API key
- Google Places API key
-
Clone the repository:
git clone https://github.com/tses89214/LangChain-FindMyDinner.git cd LangChain-FindMyDinner -
Create a
.envfile based on the.env.exampletemplate:cp .env.example .env -
Edit the
.envfile and add your API keys:OPENAI_API_KEY=your_openai_api_key_here GOOGLE_PLACES_API_KEY=your_google_places_api_key_here -
Build and run the Docker container:
docker-compose up -
Open your web browser and go to http://localhost:8501
-
Clone the repository:
git clone https://github.com/tses89214/LangChain-FindMyDinner.git cd LangChain-FindMyDinner -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install the required packages:
pip install -r requirements.txt -
Create a
.envfile based on the.env.exampletemplate:cp .env.example .env -
Edit the
.envfile and add your API keys:OPENAI_API_KEY=your_openai_api_key_here GOOGLE_PLACES_API_KEY=your_google_places_api_key_here
- Go to OpenAI's website
- Sign up or log in
- Navigate to the API section
- Create a new API key
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Places API
- Create an API key in the Credentials section
If you're using Docker, the application will be available at http://localhost:8501 after running docker-compose up.
-
Run the Streamlit application:
streamlit run app.py -
Open your web browser and go to http://localhost:8501
-
If you haven't set the API keys in the
.envfile, enter them in the sidebar -
Start chatting with the agent by asking questions like:
- "Find restaurants near New York City"
- "What Italian restaurants are open within 2 km of my location?"
- "Show me details about the first restaurant"
- The user enters a query in the chat interface
- The LangChain agent processes the query and determines which tool to use
- The agent uses the appropriate tool to interact with the Google Places API
- The results are formatted and displayed to the user
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
