Skip to main content

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

  1. Clone and setup:

    git clone <repository-url>
    cd Report_API
    
  2. 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:

  3. Run with Docker:

    docker-compose up --build
    
  4. 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}'

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)
  • No rate limiting per API key
  • No caching
  • No advanced features (batch processing, web UI)

Next Steps (Future Versions)

  • User authentication & API keys
  • Rate limiting and quotas
  • Response caching
  • Web UI interface
  • Batch processing
  • Advanced prompt engineering
  • Knowledge graph visualization

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

structured_report-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

structured_report-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file structured_report-0.1.0.tar.gz.

File metadata

  • Download URL: structured_report-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for structured_report-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ab6b223ce26ea11594eda8e8def3b5da25b17be2aa5b0271fb1b1cc675d36d5
MD5 ae545e3000c38ff547630f2cc38beb6f
BLAKE2b-256 02182feef773d7745fa2ca5a29329338a814b71b3f1c210a2f3c6e26fe759842

See more details on using hashes here.

File details

Details for the file structured_report-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for structured_report-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cee061d3d6c659633443adcf8c3be2a39cfd81de12851c9fff9ee9c83f03bc4d
MD5 b09fb7cfd4e3e7991e13eade9d4a339e
BLAKE2b-256 572dab7dd95b6c6c147576dceccef16a2bff73cc522bdc379ea277a52b387843

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page