Apify iconApifySep 29, 2026 ~6 min source read

How to build a documentation chatbot with LangChain, OpenAI, Pinecone, and Apify

A practical walkthrough that collects web docs, indexes them for semantic search, and wraps search plus live lookups into a Streamlit chat UI using LangChain, OpenAI, Pinecone, Apify, and LangGraph.

Build a documentation chatbot with LangChain, OpenAI, Pinecone, and Apify

Share this story

Send the public story page.

Useful takeaways from this story.

Collect documentation with Apify, split it into searchable passages, and store embeddings in Pinecone to enable retrieval-augmented generation (RAG).

Use OpenAI to create embeddings and LangChain to connect the LLM, Pinecone search, Apify live lookups, and LangGraph for conversation history.

Prerequisites include Python 3.12, accounts and billing-enabled API keys for OpenAI, Pinecone, and Apify, plus GitHub and Streamlit accounts to publish.

# Overview This tutorial shows how to build a documentation-focused chatbot that finds relevant instructions inside preindexed docs and answers follow-up questions with context. The example uses UpCloud docs, but the same pipeline applies to other documentation collections.

# How it works The app uses retrieval-augmented generation (RAG). Apify crawls and collects documentation pages and returns text plus source URLs. The text is split into passages. OpenAI turns passages into embeddings. Pinecone stores those embeddings and supports semantic search. LangChain wires these pieces together: it lets the LLM query Pinecone, call Apify for live lookups when needed, and use LangGraph to keep conversation history for follow-ups. Streamlit hosts the chat interface.

# What you need before you start

  • Python 3.12 and a code editor (PyCharm suggested).
  • Accounts and API credentials for OpenAI, Pinecone, and Apify. OpenAI API billing must be enabled. An Apify account needs credits if you run their crawlers.
  • GitHub and Streamlit Community Cloud accounts if you want to publish the app.

# Project layout and dependencies Create a project folder (example: upcloud-docs-bot) and these files: ingest.py (collects and indexes docs), app.py (runs the chatbot UI), requirements.txt,.env (local API keys),.gitignore. The tutorial uses these pip packages (versions shown in the source): langchain and related langchain-* packages, apify-client, streamlit, python-dotenv. Install dependencies inside the project virtualenv.

# Core components and steps

  1. Split text: Divide pages into passages suitable for embedding and retrieval.
  2. Create embeddings: Use the OpenAI API to convert passages to embeddings.
  3. Index embeddings: Create a Pinecone index and store passage embeddings together with source URLs.
  1. Generate answers: Pass retrieved passages and conversation history to the LLM via LangChain to produce an answer that cites sources.
  1. Conversation state: LangGraph (installed as part of the LangChain packages) manages earlier messages so follow-up questions stay coherent.
  2. UI: Streamlit hosts the chat interface that you can run locally or publish on Community Cloud.

# Practical notes

  • Store API keys in.env and add.env to.gitignore. A ChatGPT subscription does not replace OpenAI API usage. Pinecone gives a default API key on sign-in. Apify supplies an API token in integrations settings.
  • The tutorial includes a downloadable GitHub repo with complete code you can clone and run with your own keys.
  • Streamlit Community Cloud offers free hosting, but OpenAI, Pinecone, and Apify each have separate usage limits and charges to monitor.

# Where this is useful A documentation chatbot reduces time spent hunting for instructions, helps users get guidance that fits their setup, and supports follow-ups that depend on conversation context. It is suitable when your docs are stable enough to index but occasional live lookups are still needed.

# Quick deployment checklist

  • Python 3.12 virtualenv created inside project folder.
  • requirements.txt installed in that virtualenv.
  • .env populated with OpenAI, Pinecone, and Apify credentials.
  • Pinecone index created and configured for the chosen embedding dimension.
  • ingest.py run to populate the index and namespace file produced.
  • app.py run locally or deployed to Streamlit Community Cloud.

# Next steps Use the included GitHub repo to test with your credentials, adjust text-split sizes for your docs, tune Pinecone search parameters, and add or swap OpenAI model settings to balance cost and response quality.

More context around this story.

Building a Document Q&A System with On-Device AI
Raymondcamden iconRaymondcamdenSep 6, 2026

Building a Document Q&A System with On-Device AI

Every now and then I build a demo for a presentation and think to myself - this deserves its own blog post. I then promptly forget to actually do that. Even better, I completely forget to even show the demo in the presentation. A few weeks ago I made my first presentation at RenderATL and gave my talk on Chrome's on-de

Создавать сайты и веб-приложения в ChatGPT теперь можно командой
3dnews icon3dnewsSep 12, 2026

Создавать сайты и веб-приложения в ChatGPT теперь можно командой

OpenAI улучшила работу запущенного около трёх месяцев назад сервиса ChatGPT Sites, который позволяет создавать, публиковать сайты и простые веб-приложения, просто описывая желаемый результат естественным языком. Теперь над проектом могут работать несколько человек. Источник изображения: BoliviaInteligente / unsplash.co

AI бЂ”бЂЉбЂєбЂёбЂ•бЂЉбЂ¬бЂЂбЂ­бЂЇ бЂЎбЂ™бЂјбЂ”бЂєбЂ†бЂЇбЂ¶бЂё бЂњбЂ±бЂ·бЂњбЂ¬бЂ”бЂЉбЂєбЂё
Medium iconMediumSep 5, 2026

AI бЂ”бЂЉбЂєбЂёбЂ•бЂЉбЂ¬бЂЂбЂ­бЂЇ бЂЎбЂ™бЂјбЂ”бЂєбЂ†бЂЇбЂ¶бЂё бЂњбЂ±бЂ·бЂњбЂ¬бЂ”бЂЉбЂєбЂё

AI (Artificial Intelligence) နည်းပညာက အá€á€¯á€¡á€á€»á€­á€”်မှာ နေရာá€á€­á€¯á€„်းမှာ ရှိနေပါပြီዠဒါပေမဲ့ “AI ကို ဘယ်ကနေ စလေ့လာရမလဲአအမြန်ဆုံး á€á€á€ºá€™á€¼á€±á€¬á€€á€ºá€¡á€±á€¬á€„်â

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app