langchain_llms
一个测试不同llm集成(如MCP和RAG)的项目
📁 项目结构
agent/
├── src/
│ └── agent/ # Main package (modules only)
│ └── __init__.py
├── scripts/ # Executable scripts
│ ├── build_index.py # Build vector database
│ ├── chat.py # Chat with RAG + agents
│ ├── chat_rag.py # Chat with RAG (advanced)
│ ├── chat_simple.py # Simple chat without RAG
│ ├── rag_only.py # RAG retrieval only
│ └── crawl.py # Web crawler for data collection
├── data/ # Data directory
│ ├── markdowns/ # Downloaded markdown files
│ └── chroma_db/ # Vector database
├── pyproject.toml # Dependencies & project config
├── uv.lock # Locked versions
├── .python-version # Python version (3.11)
└── .env # Environment variables (not committed)🚀 设置为 uv
1.安装 uv (一次)
pip install uv2.创建虚拟环境并安装依赖项
uv sync3.运行脚本
# Using uv run (recommended - auto venv)
uv run python scripts/build_index.py
uv run python scripts/chat.py
uv run python scripts/rag_only.py
uv run python scripts/chat_simple.py
uv run python scripts/crawl.py
# OR activate venv manually
.\.venv\Scripts\Activate.ps1
python scripts/build_index.py4.添加新的依赖关系
# Option 1: Quick add
uv add new-package
# Option 2: Edit pyproject.toml and sync
uv sync5.开发设置
# Install with dev dependencies
uv sync --all-extras
# Run tests
uv run pytest
# Format code
uv run black .
# Lint code
uv run ruff check .📋 重要文件
pyproject.toml-所有依赖项(替换requirements.txt)uv.lock-锁定的依赖关系版本(自动生成)src/agent/-Python包(仅模块,无脚本)scripts/-可执行脚本data/-标记和矢量数据库
🔧 环境变量
创建 .env 文件(基于 .env_example):
OLLAMA_BASE_URL=http://localhost:11434
FIRECRAWL_API_KEY=your_key_here📝 备注
- 使用
uv run用于所有脚本执行 - 脚本中的路径会自动解析为项目根目录
- 所有数据存储在
data/目录 - 保持
src/agent/仅适用于可重复使用的模块
