Transform text into structured thought models for deep learning
Project description
Deep Thinking Report API - MVP
A streamlined API that transforms text into structured thought models for learning and reflection. Built with FastAPI and supports multiple LLM providers.
Features
- POST /v1/report/insight: Generate structured analysis from text
- Dual Model Support:
- OpenAI GPT-4o-mini: Paid model with higher reasoning capabilities
- DeepSeek: Free model with good performance
- Depth Levels: Support for light (1), standard (2), and deep (3) analysis
- Structured Output: Consistent JSON response format
- Docker Support: Easy deployment with Docker
- Simplified Architecture: Clean 134-line codebase for easy maintenance
Installation
Option 1: Install from PyPI
pip install structured-report
Run the server:
structured-report
Or run programmatically:
from structured_report.main import app
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
Option 2: Run from source
Quick Start
-
Clone and setup:
git clone <repository-url> cd Report_API
-
Configure environment:
# Create .env file with your API keys echo "OPENAI_API_KEY=your_openai_api_key_here" > .env echo "DEEPSEEK_API_KEY=your_deepseek_api_key_here" >> .env
Get API keys from:
- OpenAI: https://platform.openai.com/api-keys
- DeepSeek: https://platform.deepseek.com/
-
Run with Docker:
docker-compose up --build
-
Test the API:
curl -X POST "http://localhost:8000/v1/report/insight" \ -H "Content-Type: application/json" \ -d '{ "content": "The future of AI will be dominated by general intelligence systems that can learn and adapt like humans.", "model": "deepseek", "depth_level": 2 }'
API Usage
Authentication
This API requires an API Key for all requests. Get your API Key first:
Get API Key:
curl -X POST "http://localhost:8000/api-keys" \
-H "Content-Type: application/json" \
-d '{"name": "your-name", "email": "your-email@example.com"}'
Use API Key in requests:
curl -X POST "http://localhost:8000/v1/report/insight" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"content": "your text", "model": "deepseek", "depth_level": 2}'
Rate Limiting
This API implements rate limiting to ensure fair usage:
- API Key Creation: 5 requests per minute per IP address
- Insight Generation: 10 requests per minute per IP address
- Debug Endpoints: 10 requests per minute per IP address
When rate limited, you'll receive a 429 Too Many Requests response. Rate limits reset every minute.
Check current rate limits:
curl http://localhost:8000/rate-limits
Endpoint: POST /v1/report/insight
Request:
{
"content": "Your text content here",
"model": "openai", // or "deepseek"
"depth_level": 2 // 1=light, 2=standard, 3=deep
}
Model Options:
"openai": GPT-4o-mini (paid, higher reasoning quality)"deepseek": DeepSeek Chat (free, good performance)
Response:
{
"core_claim": "Extracted main thesis",
"supporting_arguments": [
{
"claim": "Supporting point",
"evidence": "Evidence from text",
"logic_type": "Type of reasoning"
}
],
"assumptions": ["Implicit assumptions"],
"speaker_position": {
"role": "Speaker's role",
"potential_bias": "Potential biases"
},
"my_evaluation": "[user will fill]",
"personal_impact": "[user will fill]",
"meta_principle": "Transferable principle",
"falsifiability": ["Conditions where claim fails"],
"keywords": [
{
"term": "Key term",
"definition": "Definition"
}
],
"related_insights": ["Related concepts"],
"meta_questions": ["Questions for further thinking"]
}
Development
Run locally:
pip install -r requirements.txt
uvicorn app:app --reload
API Documentation:
Visit http://localhost:8000/docs for interactive API documentation.
Architecture
Clean single-file design with 134 lines of code:
app.py: Complete FastAPI application with Pydantic models- Supports both OpenAI and DeepSeek models
- Simplified prompt engineering and JSON parsing
- Docker-ready deployment
MVP Limitations
- Basic error handling
- Simple API Key authentication (no user accounts)
- Rate limiting per IP address (5-10 requests/minute)
- No caching
- No advanced features (batch processing, web UI)
Next Steps (Future Versions)
- User authentication & API keys
- Advanced rate limiting (per API key quotas)
- Response caching
- Web UI interface
- Batch processing
- Advanced prompt engineering
- Knowledge graph visualization
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file structured_report-0.1.1.tar.gz.
File metadata
- Download URL: structured_report-0.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c38e4ff12578a2879aaed37c4c0c688ca458ea5843e7600c82024a877aeb17
|
|
| MD5 |
5d8e9ac57c94180a6228afbd040b5880
|
|
| BLAKE2b-256 |
c5cc98895e52a3e16cfeffd19c2f6c9f96daa6947abc30846ac361b040e72c57
|
File details
Details for the file structured_report-0.1.1-py3-none-any.whl.
File metadata
- Download URL: structured_report-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7620fbf67c3d1a09c4d5682d28e4bd735ba4c577fe21c109cb890fbf7dffc0ad
|
|
| MD5 |
6a62bd93dc7a99f9282c181a1e6c2dda
|
|
| BLAKE2b-256 |
aee0e1b35cd17726e1761a9712500cc238f31e0c4932f7f097ed35be82c6b1b0
|