A simple framework for coordinating classical compute and LLM-based tasks.
Project description
PlanAI
PlanAI is an innovative system designed for complex task automation through a sophisticated graph-based architecture. It integrates traditional computations and cutting-edge AI technologies to enable versatile and efficient workflow management.
Table of Contents
- Key Features
- Requirements
- Installation
- Usage
- Advanced Features
- Documentation
- Contributing
- License
- Roadmap
Key Features
- Graph-Based Architecture: Construct dynamic workflows comprising interconnected TaskWorkers for highly customizable automation.
- Hybrid TaskWorkers: Combine conventional computations (e.g., API calls) with powerful LLM-driven operations, leveraging Retrieval-Augmented Generation (RAG) capabilities.
- Type Safety with Pydantic: Ensure data integrity and type consistency across workflows with Pydantic-validated input and output.
- Intelligent Data Routing: Utilize type-aware routing to efficiently manage data flow between nodes, adapting to multiple downstream consumers.
Requirements
- Python 3.10+
- Poetry (for development)
Installation
You can install PlanAI using pip:
pip install planai
For development, clone the repository and install dependencies:
git clone https://github.com/provos/planai.git
cd planai
poetry install
Usage
PlanAI allows you to create complex, AI-enhanced workflows using a graph-based architecture. Here's a basic example:
from planai import Graph, TaskWorker, LLMTaskWorker, llm_from_config
from planai.task import TaskWorkItem
from pydantic import Field
# Define custom TaskWorkers
class CustomDataProcessor(TaskWorker):
output_types = [ProcessedData]
def consume_work(self, task: RawData):
processed_data = self.process(task.data)
self.publish_work(ProcessedData(data=processed_data))
# Define an LLM-powered task
class AIAnalyzer(LLMTaskWorker):
output_types = [AnalysisResult]
def consume_work(self, task: ProcessedData):
super().consume_work(task)
# Create and run the workflow
graph = Graph(name="Data Analysis Workflow")
data_processor = CustomDataProcessor()
ai_analyzer = AIAnalyzer(
llm=llm_from_config(provider="openai", model_name="gpt-4"),
prompt="Analyze the provided data and derive insights")
graph.add_workers(data_processor, ai_analyzer)
graph.set_dependency(data_processor, ai_analyzer)
initial_data = RawData(data="Some raw data")
graph.run(initial_tasks=[(data_processor, initial_data)])
Advanced Features
PlanAI supports advanced features like:
- Caching results with
CachedTaskWorker
- Joining multiple task results with
JoinedTaskWorker
- Integrating with various LLM providers (OpenAI, Ollama, etc.)
For more detailed examples and advanced usage, please refer to the examples/
directory in the repository.
Documentation
Full documentation for PlanAI is available at https://planai.readthedocs.io/
Contributing
We welcome contributions to PlanAI! Please see our Contributing Guide for more details on how to get started.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For any questions or support, please open an issue on our GitHub issue tracker.
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
Built Distribution
File details
Details for the file planai-0.1.0.tar.gz
.
File metadata
- Download URL: planai-0.1.0.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0444f1aea2e1ddc085be79c07657628283fa2a21bba1fae10133b407be184c95 |
|
MD5 | 41a429c74647957f13b265242d52d447 |
|
BLAKE2b-256 | 51e88555a459a7c5a3c8dd981c61447cc34f3ec4d83599f556519803a5eba7d1 |
File details
Details for the file planai-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: planai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e197fc88e9fb07408e45b87f7c025a345d7d1c4dba69bf2f9b8d245d5f0756f6 |
|
MD5 | effdd85805f090e707e4da1c472b7b03 |
|
BLAKE2b-256 | 1e4612da74d4f60fbb2a90dc148102004ad697c50314d8fc5ac4b24ca8d90618 |