Skip to content
项目

alphasecio/langchain-examples

在 GitHub 查看

关于

一个包含四种 LangChain 工具的 Streamlit 应用:网络调研智能体、摘要、新闻摘要以及文档聊天。使用 OpenAI、pgvector 和你选择的搜索 API。

人工智能与机器学习

这些数字如何统计

实测星标增长

24小时
+1
7天
+1
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

langchain-examples

Released under the MIT license. GitHub Stars GitHub Forks GitHub Watchers Follow on Twitter

A single Streamlit app with four practical LangChain tools, using OpenAI models, your choice of web search provider, and Postgres with pgvector (or Pinecone) for document storage.

Tool What it does
🔎 Web Research An agent that searches the web, reads pages and answers with cited sources.
📝 Summarize Summarizes pasted text, a web page or a PDF, as a short summary, a detailed one or bullet points.
📰 News Digest Finds top stories on any topic, summarizes each, and writes a one-paragraph digest.
📚 Chat with Docs Stores PDF, text and Markdown files in a vector store (Postgres with pgvector, or Pinecone) and answers questions with page-level citations.

Deploy

Vector store Railway template
Postgres with pgvector (default) Deploy on Railway
Pinecone Deploy on Railway

The pgvector template deploys the app and a Postgres database. The Pinecone template deploys only the app and creates a serverless index in your Pinecone project on first use. Add your OpenAI key and at least one search provider key, and you're ready. It also runs on any VPS with Docker, such as a DigitalOcean droplet.

Configuration

Variable Required Description
VECTOR_STORE No pgvector (default) or pinecone.
DATABASE_URL pgvector only Postgres connection string. The pgvector extension and documents table are created on first use.
PINECONE_API_KEY Pinecone only Pinecone API key. Can also be entered in the sidebar.
PINECONE_INDEX No Pinecone index name, default langchain-examples. If it doesn't exist, a serverless index (1536 dimensions, cosine, AWS us-east-1) is created.
OPENAI_API_KEY Yes OpenAI API key.
OPENAI_MODEL No Default model, e.g. gpt-6.1-terra. Users can switch models in the sidebar.
OPENAI_BASE_URL No An OpenAI-compatible endpoint, if you don't call OpenAI directly.
APP_PASSWORD No Password required to open the app. See the note below.
TAVILY_API_KEY No Tavily
EXA_API_KEY No Exa
FIRECRAWL_API_KEY No Firecrawl
PARALLEL_API_KEY No Parallel
PERPLEXITY_API_KEY No Perplexity
TINYFISH_API_KEY No TinyFish
SERPER_API_KEY No Serper
SERPAPI_API_KEY No SerpApi

Any key not set on the server can be entered in the sidebar instead. Keys entered there last only for that browser session and are never stored.

[!IMPORTANT] Set APP_PASSWORD if you put API keys on the server. Without it, anyone who finds your app's URL can use your keys and spend your credits, and can read or delete documents in your library. If you leave the server keys empty and enter them in the sidebar instead, the app is safe to leave open.

Run locally

docker run -d --name pgvector -e POSTGRES_PASSWORD=postgres -p 5432:5432 pgvector/pgvector:pg18
pip install -r requirements.txt
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
export OPENAI_API_KEY=...
streamlit run app.py

Older examples

The earlier standalone apps (Chroma, Pinecone, Gemini, Helicone, SerpApi and others) are preserved on the legacy branch. They are no longer maintained.

探索相关项目

加载中…