mirror of
https://github.com/LearningCircuit/local-deep-research.git
synced 2026-06-15 19:46:56 +03:00
* feat: Add LangChain retriever integration for vector store support - Add RetrieverRegistry for dynamic retriever registration - Create RetrieverSearchEngine wrapper for LangChain BaseRetriever - Integrate retrievers with search factory and config system - Add retrievers parameter to all API functions - Include comprehensive test suite and examples - Support thread-safe operations and multiple retrievers This allows users to pass any LangChain retriever (FAISS, Pinecone, Vertex AI, etc.) to LDR and use it as a search engine seamlessly. * refactor: Organize API examples into structured folders - Create api_usage/ directory with programmatic/ and http/ subdirectories - Move existing examples to appropriate folders - Add comprehensive HTTP API examples (simple and advanced) - Add curl examples for command-line usage - Add simple programmatic example for quick start - Include README explaining when to use each API type * chore: Remove old example files from root examples directory Files have been moved to examples/api_usage/programmatic/ * fix: Address PR review comments - Replace logger.error with logger.exception for better error tracking - Default retriever name to class name if not provided
2.2 KiB
2.2 KiB
Local Deep Research API Examples
This directory contains examples for using LDR through different interfaces.
Directory Structure
-
programmatic/- Direct Python API usage (import fromlocal_deep_research.api)programmatic_access.ipynb- Jupyter notebook with comprehensive examplesretriever_usage_example.py- Using LangChain retrievers with LDR
-
http/- HTTP REST API usage (requires running server)simple_http_example.py- Quick start examplehttp_api_examples.py- Comprehensive examples including batch processing
Quick Start
Programmatic API (Python Package)
from local_deep_research.api import quick_summary
result = quick_summary("What is quantum computing?")
print(result["summary"])
HTTP API (REST)
First, start the server:
python -m src.local_deep_research.web.app
Then use the API:
import requests
response = requests.post(
"http://localhost:5000/api/v1/quick_summary",
json={"query": "What is quantum computing?"}
)
print(response.json()["summary"])
Which API Should I Use?
-
Programmatic API: Use when integrating LDR into your Python application
- ✅ Direct access, no HTTP overhead
- ✅ Full access to all features and parameters
- ✅ Can pass Python objects (like LangChain retrievers)
- ❌ Requires LDR to be installed in your environment
-
HTTP API: Use when accessing LDR from other languages or remote systems
- ✅ Language agnostic - works with any HTTP client
- ✅ Can run LDR on a separate server
- ✅ Easy to scale and deploy
- ❌ Limited to JSON-serializable parameters
- ❌ Requires running the web server
Running the Examples
Programmatic Examples
# Run the retriever example
python examples/api_usage/programmatic/retriever_usage_example.py
# Or use the Jupyter notebook
jupyter notebook examples/api_usage/programmatic/programmatic_access.ipynb
HTTP Examples
# First, start the LDR server
python -m src.local_deep_research.web.app
# In another terminal, run the examples
python examples/api_usage/http/simple_http_example.py
python examples/api_usage/http/http_api_examples.py