No project description provided
Project description
🦁 Lion Framework
A powerful Python framework for structured AI conversations and operations
🌟 Features
- 🎯 Dynamic structured output at runtime
- 🔄 Easy composition of multi-step processes
- 🤖 Support for any model via
litellm - 🏗️ Built-in conversation management
- 🧩 Extensible architecture
- 🔍 Type-safe with Pydantic models
🚀 Quick Install
pip install lion-os
💡 Usage Examples
1️⃣ Simple Communication
from lion import iModel, Branch
# Initialize model and branch
imodel = iModel(
model="openai/gpt-4o",
api_key="OPENAI_API_KEY",
temperature=0.2,
)
branch = Branch(imodel=imodel)
# Basic communication
result = await branch.communicate(
instruction="Give me ideas for FastAPI interview questions",
context="We're hiring senior engineers"
)
2️⃣ Structured Output with Pydantic
from pydantic import BaseModel
class CodingQuestion(BaseModel):
question: str
evaluation_criteria: str
# Get structured responses
questions = await branch.operate(
instruction="Generate FastAPI coding questions",
context="Technical interview context",
operative_model=CodingQuestion
)
3️⃣ Advanced Operations (Brainstorming)
from lion.operations import brainstorm
result = await brainstorm(
instruct={
"instruction": "Design API endpoints for a todo app",
"context": "Building a modern task management system"
},
imodel=imodel,
num_instruct=3,
operative_model=CodingQuestion,
auto_run=True
)
🎯 Key Components
| Component | Description |
|---|---|
| Branch | Main conversation controller |
| MessageManager | Handles message flow and history |
| ToolManager | Manages function execution and tools |
| Operative | Structures operations and responses |
Requirements
python 3.11+ required
⭐ Star History
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
lion_os-0.0.3.tar.gz
(112.2 kB
view details)
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
lion_os-0.0.3-py3-none-any.whl
(142.8 kB
view details)
File details
Details for the file lion_os-0.0.3.tar.gz.
File metadata
- Download URL: lion_os-0.0.3.tar.gz
- Upload date:
- Size: 112.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65cb029c95b1852e4d5caff6eba562590520f2606ab125cc49c72ae43707870d
|
|
| MD5 |
019c6ecd29d6089173a501d25d767878
|
|
| BLAKE2b-256 |
73882377c2013332f2fef5ffecc1098893b08f60a1d622823bb94657ff9f4ea2
|
File details
Details for the file lion_os-0.0.3-py3-none-any.whl.
File metadata
- Download URL: lion_os-0.0.3-py3-none-any.whl
- Upload date:
- Size: 142.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
135f5dfae76f2b2081f7123e50ca289662daa8218a214cd9a3a25a8081964cce
|
|
| MD5 |
a80fe3e3c0a91c282a5eac21f3af40bc
|
|
| BLAKE2b-256 |
9dcbd30c3f4575c5bdb91b625ae3352e790fa30dff630920b90c3cfb76cbc6dc
|