Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Chat with your PDFs using AI! This Streamlit app uses RAG, LangChain, FAISS, and OpenAI to let you ask questions and get answers with page and file references.

License

NotificationsYou must be signed in to change notification settings

co-dev0909/chatbot-using-rag-and-langchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Streamlit-based chatbot powered by Retrieval-Augmented Generation (RAG) and OpenAI. Upload your PDFs and chat with them! This app leverages LangChain, FAISS, and OpenAI’s GPT models to extract and query document content with metadata-aware answers.

App Screenshot


🔧 Features

  • 🔍Upload multiple PDFs and query across all of them
  • 📄Metadata-rich answers with filename and page references
  • 🧠 UsesLangChain + FAISS for semantic search
  • 🤖Streamlit Chat UI for natural conversation
  • 💾OpenAI API support with streaming responses

📁 Project Structure

.├── .gitignore├── LICENSE├── README.md             # ← You're reading it├── app.py                # Main Streamlit app├── brain.py              # PDF parsing and vector index logic├── compare medium.gif    # Optional UI illustration├── requirements.txt      # Python dependencies└── thumbnail.webp        # Preview image

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/co-dev0909/chatbot-using-rag-and-langchain.gitcd chatbot-using-rag-and-langchain

2. Install Dependencies

pip install -r requirements.txt

3. Set OpenAI API Key

Create a.streamlit/secrets.toml file with:

OPENAI_API_KEY ="your-openai-key"

Or export it via environment variable:

export OPENAI_API_KEY="your-openai-key"

4. Run the App

streamlit run app.py

📚 How It Works

  1. Upload PDFs via the UI
  2. Each PDF is parsed usingPyPDF2 and chunked via LangChain’sRecursiveCharacterTextSplitter
  3. Chunks are embedded using OpenAI Embeddings
  4. Stored in a FAISS vector store for semantic similarity search
  5. Queries are matched to top PDF chunks and passed to ChatGPT with context
  6. Answers includefile name andpage number metadata for citation

🛠️ Tech Stack


✅ Example Prompt

"What are the main points from the introduction?"

Answer: The introduction highlights...(example.pdf, page 1)


📄 License

This project is licensed under theMIT License.


📬 Contact

Made with ❤️ byco-dev0909. Contributions welcome!


About

Chat with your PDFs using AI! This Streamlit app uses RAG, LangChain, FAISS, and OpenAI to let you ask questions and get answers with page and file references.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp