Skip to content

vinodnextcoder/langchain-tutorials

Repository files navigation

# 🤖 Simple AI Chatbot using LangChain + OpenRouter (Python)

This is a basic Python project that shows how to use **LangChain** with **OpenRouter** to create a simple AI assistant.  
The AI answers questions in **easy, simple words**, making it perfect for beginners learning AI integration

---

## ✅ Features

- Uses **LangChain** for AI interaction  
- Uses **OpenRouter API** (free model supported)  
- Takes a question and prints the AI reply in the terminal  
- Beginner-friendly and easy to understand  

---

## 🧑‍💻 Requirements

Make sure you have:

- Python **3.9+** installed  
- An **OpenRouter API Key**

---

## 📦 Install Required Libraries

Run this command in your terminal:

```bash
pip install langchain langchain-openai python-dotenv

🔐 Setup Environment Variable

  1. Create a file named .env in your project folder
  2. Add your OpenRouter API key inside it:
OPENROUTER_API_KEY=your_api_key_here

⚠️ Never share your API key publicly.


▶️ How to Run the Project

Run the following command in your terminal:

python createagent.py

You will see the AI response printed in the terminal.


🧠 Example Question Used

user_question = "What is artificial intelligence in simple terms?"

✅ Example Output

Artificial intelligence is when computers are taught to think and learn like humans to do tasks such as answering questions, recognizing images, or making decisions.

📁 Project Structure

langchain-tutorials/
│
└──.env
└── python_langchian_example/
    │
    ├── createagent.py
    └── README.md


🎯 Who Is This For?

  • Beginners learning LangChain
  • Students exploring AI integration
  • Developers testing OpenRouter with Python

📜 License

This project is free to use for learning and educational purposes.


About

Beginner-friendly LangChain tutorial with Python,Golang examples for building AI agents, chatbots, and LLM-powered apps.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors