sifaka


Namesifaka JSON
Version 0.1.6 PyPI version JSON
download
home_pageNone
SummarySimple AI text improvement through research-backed critique with complete observability
upload_time2025-07-20 13:30:30
maintainerNone
docs_urlNone
authorNone
requires_python<3.14,>=3.10
licenseNone
keywords ai llm validation text-improvement critique
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sifaka

**Simple AI text improvement through research-backed critique with complete observability**

[![Python](https://img.shields.io/badge/python-3.10+-blue)](https://python.org)
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![Version](https://img.shields.io/badge/version-0.1.2-blue)](https://github.com/sifaka-ai/sifaka)
[![CI/CD](https://github.com/sifaka-ai/sifaka/actions/workflows/ci.yml/badge.svg)](https://github.com/sifaka-ai/sifaka/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/badge/coverage-60%25+-yellowgreen)](https://github.com/sifaka-ai/sifaka/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/sifaka)](https://pypi.org/project/sifaka/)
[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://sifaka-ai.github.io/sifaka/)


## What is Sifaka?

Sifaka improves AI-generated text through iterative critique using research-backed techniques. Instead of hoping your AI output is good enough, Sifaka provides a transparent feedback loop where AI systems validate and improve their own outputs.

**Core Value**: See exactly how AI improves your text through research-backed techniques with complete audit trails.

## Installation

```bash
# Install from PyPI
pip install sifaka

# Or with uv
uv pip install sifaka
```

## Quick Start

### 1. Set up your API key

Sifaka requires an LLM API key. Set one of these environment variables:

```bash
export OPENAI_API_KEY="your-api-key"     # For OpenAI (GPT-4, etc.)
# or
export ANTHROPIC_API_KEY="your-api-key"  # For Claude
# or
export GEMINI_API_KEY="your-api-key"     # For Google Gemini
# or
export GROQ_API_KEY="your-api-key"       # For Groq
# or (for local Ollama - no API key needed)
export OLLAMA_BASE_URL="http://localhost:11434/v1"  # Optional, defaults to localhost
```

Or create a `.env` file in your project:
```env
OPENAI_API_KEY=your-api-key
```

**Using Ollama (Local LLMs)**:
```python
from sifaka import improve_sync, Config
from sifaka.core.config import LLMConfig

# Use Ollama with specific model (must set critic_model too!)
config = Config(
    llm=LLMConfig(
        provider="ollama",
        model="mistral:latest",
        critic_model="mistral:latest"  # Important: set this to use Ollama for critiques
    )
)
result = improve_sync("Climate change is bad.", config=config)
```

### 2. Use Sifaka

```python
from sifaka import improve_sync

# Simple one-liner
result = improve_sync("Climate change is bad.")
print(result.final_text)
```

📚 **[Full Documentation →](https://sifaka-ai.github.io/sifaka/)**

## Key Features

- **🔬 Research-Backed**: Implements Reflexion, Constitutional AI, Self-Refine, and more
- **👁️ Complete Observability**: Full audit trail of every improvement
- **🎯 Simple API**: One function does everything you need
- **💾 Memory-Safe**: Bounded history prevents memory leaks
- **⚡ Fast**: Minimal dependencies, maximum performance

## Documentation

### Getting Started
- **[Installation](https://sifaka-ai.github.io/sifaka/installation/)** - Installation options and setup
- **[Quickstart Guide](https://sifaka-ai.github.io/sifaka/getting-started/quickstart/)** - Get up and running in 5 minutes
- **[Basic Usage](https://sifaka-ai.github.io/sifaka/guide/basic-usage/)** - Common usage patterns
- **[API Reference](API.md)** - Complete API documentation

### User Guides
- **[Critics Guide](https://sifaka-ai.github.io/sifaka/guide/critics/)** - Available critics and usage
- **[Validators Guide](https://sifaka-ai.github.io/sifaka/guide/validators/)** - Input validation options
- **[Configuration](https://sifaka-ai.github.io/sifaka/guide/configuration/)** - Configuration options
- **[Advanced Usage](https://sifaka-ai.github.io/sifaka/guide/advanced-usage/)** - Advanced patterns

### Architecture & Development
- **[Architecture Overview](https://sifaka-ai.github.io/sifaka/architecture/)** - System design
- **[Contributing](CONTRIBUTING.md)** - How to contribute
- **[Changelog](CHANGELOG.md)** - Version history

### Examples
- **[Working Examples](examples/)** - Code examples for all features

## Research Foundation

Sifaka implements these peer-reviewed techniques:

- **[Reflexion](https://arxiv.org/abs/2303.11366)** - Self-reflection for iterative improvement
- **[Constitutional AI](https://arxiv.org/abs/2212.08073)** - Principle-based evaluation
- **[Self-Refine](https://arxiv.org/abs/2303.17651)** - Iterative self-improvement
- **[N-Critics](https://arxiv.org/abs/2310.18679)** - Ensemble of diverse perspectives
- **[Self-RAG](https://arxiv.org/abs/2310.11511)** - Retrieval-augmented critique
- **[Meta-Rewarding](https://arxiv.org/abs/2407.19594)** - Two-stage meta-evaluation
- **[Self-Consistency](https://arxiv.org/abs/2203.11171)** - Multiple reasoning paths
- **Style** - Transform text to match specific writing styles and voices

## Development

```bash
git clone https://github.com/sifaka-ai/sifaka
cd sifaka
pip install -e ".[dev]"
pytest
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.

## License

MIT License - see [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sifaka",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.10",
    "maintainer_email": null,
    "keywords": "ai, llm, validation, text-improvement, critique",
    "author": null,
    "author_email": "Evan Volgas <evan.volgas@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/02/60/446a6f0b32fbca2e5de22fca96aef3564a815b613c8b69ceb4d7b94e76da/sifaka-0.1.6.tar.gz",
    "platform": null,
    "description": "# Sifaka\n\n**Simple AI text improvement through research-backed critique with complete observability**\n\n[![Python](https://img.shields.io/badge/python-3.10+-blue)](https://python.org)\n[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n[![Version](https://img.shields.io/badge/version-0.1.2-blue)](https://github.com/sifaka-ai/sifaka)\n[![CI/CD](https://github.com/sifaka-ai/sifaka/actions/workflows/ci.yml/badge.svg)](https://github.com/sifaka-ai/sifaka/actions/workflows/ci.yml)\n[![Coverage](https://img.shields.io/badge/coverage-60%25+-yellowgreen)](https://github.com/sifaka-ai/sifaka/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/sifaka)](https://pypi.org/project/sifaka/)\n[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://sifaka-ai.github.io/sifaka/)\n\n\n## What is Sifaka?\n\nSifaka improves AI-generated text through iterative critique using research-backed techniques. Instead of hoping your AI output is good enough, Sifaka provides a transparent feedback loop where AI systems validate and improve their own outputs.\n\n**Core Value**: See exactly how AI improves your text through research-backed techniques with complete audit trails.\n\n## Installation\n\n```bash\n# Install from PyPI\npip install sifaka\n\n# Or with uv\nuv pip install sifaka\n```\n\n## Quick Start\n\n### 1. Set up your API key\n\nSifaka requires an LLM API key. Set one of these environment variables:\n\n```bash\nexport OPENAI_API_KEY=\"your-api-key\"     # For OpenAI (GPT-4, etc.)\n# or\nexport ANTHROPIC_API_KEY=\"your-api-key\"  # For Claude\n# or\nexport GEMINI_API_KEY=\"your-api-key\"     # For Google Gemini\n# or\nexport GROQ_API_KEY=\"your-api-key\"       # For Groq\n# or (for local Ollama - no API key needed)\nexport OLLAMA_BASE_URL=\"http://localhost:11434/v1\"  # Optional, defaults to localhost\n```\n\nOr create a `.env` file in your project:\n```env\nOPENAI_API_KEY=your-api-key\n```\n\n**Using Ollama (Local LLMs)**:\n```python\nfrom sifaka import improve_sync, Config\nfrom sifaka.core.config import LLMConfig\n\n# Use Ollama with specific model (must set critic_model too!)\nconfig = Config(\n    llm=LLMConfig(\n        provider=\"ollama\",\n        model=\"mistral:latest\",\n        critic_model=\"mistral:latest\"  # Important: set this to use Ollama for critiques\n    )\n)\nresult = improve_sync(\"Climate change is bad.\", config=config)\n```\n\n### 2. Use Sifaka\n\n```python\nfrom sifaka import improve_sync\n\n# Simple one-liner\nresult = improve_sync(\"Climate change is bad.\")\nprint(result.final_text)\n```\n\n\ud83d\udcda **[Full Documentation \u2192](https://sifaka-ai.github.io/sifaka/)**\n\n## Key Features\n\n- **\ud83d\udd2c Research-Backed**: Implements Reflexion, Constitutional AI, Self-Refine, and more\n- **\ud83d\udc41\ufe0f Complete Observability**: Full audit trail of every improvement\n- **\ud83c\udfaf Simple API**: One function does everything you need\n- **\ud83d\udcbe Memory-Safe**: Bounded history prevents memory leaks\n- **\u26a1 Fast**: Minimal dependencies, maximum performance\n\n## Documentation\n\n### Getting Started\n- **[Installation](https://sifaka-ai.github.io/sifaka/installation/)** - Installation options and setup\n- **[Quickstart Guide](https://sifaka-ai.github.io/sifaka/getting-started/quickstart/)** - Get up and running in 5 minutes\n- **[Basic Usage](https://sifaka-ai.github.io/sifaka/guide/basic-usage/)** - Common usage patterns\n- **[API Reference](API.md)** - Complete API documentation\n\n### User Guides\n- **[Critics Guide](https://sifaka-ai.github.io/sifaka/guide/critics/)** - Available critics and usage\n- **[Validators Guide](https://sifaka-ai.github.io/sifaka/guide/validators/)** - Input validation options\n- **[Configuration](https://sifaka-ai.github.io/sifaka/guide/configuration/)** - Configuration options\n- **[Advanced Usage](https://sifaka-ai.github.io/sifaka/guide/advanced-usage/)** - Advanced patterns\n\n### Architecture & Development\n- **[Architecture Overview](https://sifaka-ai.github.io/sifaka/architecture/)** - System design\n- **[Contributing](CONTRIBUTING.md)** - How to contribute\n- **[Changelog](CHANGELOG.md)** - Version history\n\n### Examples\n- **[Working Examples](examples/)** - Code examples for all features\n\n## Research Foundation\n\nSifaka implements these peer-reviewed techniques:\n\n- **[Reflexion](https://arxiv.org/abs/2303.11366)** - Self-reflection for iterative improvement\n- **[Constitutional AI](https://arxiv.org/abs/2212.08073)** - Principle-based evaluation\n- **[Self-Refine](https://arxiv.org/abs/2303.17651)** - Iterative self-improvement\n- **[N-Critics](https://arxiv.org/abs/2310.18679)** - Ensemble of diverse perspectives\n- **[Self-RAG](https://arxiv.org/abs/2310.11511)** - Retrieval-augmented critique\n- **[Meta-Rewarding](https://arxiv.org/abs/2407.19594)** - Two-stage meta-evaluation\n- **[Self-Consistency](https://arxiv.org/abs/2203.11171)** - Multiple reasoning paths\n- **Style** - Transform text to match specific writing styles and voices\n\n## Development\n\n```bash\ngit clone https://github.com/sifaka-ai/sifaka\ncd sifaka\npip install -e \".[dev]\"\npytest\n```\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Simple AI text improvement through research-backed critique with complete observability",
    "version": "0.1.6",
    "project_urls": null,
    "split_keywords": [
        "ai",
        " llm",
        " validation",
        " text-improvement",
        " critique"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "26bdb45c2d7bc40908bd0e6f0168087c59ed8e682abba596ca3bb9d251627762",
                "md5": "accf213eff26154137f4e9b0a69279e2",
                "sha256": "66d2e9d9e79c71237521aabfb5f3972f58762fedef2bb3a855414ec2fd710004"
            },
            "downloads": -1,
            "filename": "sifaka-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "accf213eff26154137f4e9b0a69279e2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.10",
            "size": 217023,
            "upload_time": "2025-07-20T13:30:29",
            "upload_time_iso_8601": "2025-07-20T13:30:29.415900Z",
            "url": "https://files.pythonhosted.org/packages/26/bd/b45c2d7bc40908bd0e6f0168087c59ed8e682abba596ca3bb9d251627762/sifaka-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0260446a6f0b32fbca2e5de22fca96aef3564a815b613c8b69ceb4d7b94e76da",
                "md5": "751040cc49f9ae405666919cdd2d862e",
                "sha256": "48fdfb09409b92cb835b4274902122ed67abce45d349049eec7a6e34b771ed82"
            },
            "downloads": -1,
            "filename": "sifaka-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "751040cc49f9ae405666919cdd2d862e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.10",
            "size": 177669,
            "upload_time": "2025-07-20T13:30:30",
            "upload_time_iso_8601": "2025-07-20T13:30:30.979260Z",
            "url": "https://files.pythonhosted.org/packages/02/60/446a6f0b32fbca2e5de22fca96aef3564a815b613c8b69ceb4d7b94e76da/sifaka-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-20 13:30:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sifaka"
}
        
Elapsed time: 1.38604s