Skip to main content

๐ŸŒธ Beautiful and simple AI generation library for images, text, and audio

Project description

โœจ Features

๐Ÿ–ผ๏ธ HD Image Generation

  • Create stunning images from text
  • HD quality up to 2048x2048
  • Advanced controls (guidance, quality)
  • Direct URL generation

๐Ÿ’ฌ Advanced Text Generation

  • Multiple AI models (OpenAI, Gemini, etc.)
  • Real-time streaming
  • Function calling & tools
  • JSON mode

๐Ÿ‘๏ธ Vision & Multimodal

  • Analyze images with AI
  • Multiple image support
  • Local & URL images
  • High-quality analysis

๐Ÿ–ฅ๏ธ CLI Interface

  • Interactive terminal menu
  • Quick command-line access
  • No code required
  • Shell automation

๐Ÿš€ Production Ready

  • Sync & async support
  • Connection pooling
  • Smart caching
  • Comprehensive tests

โšก Fast & Secure

  • Token in headers only
  • SSL verification enforced
  • Optimized performance
  • No memory leaks

๐Ÿ†• What's New in v0.5.0

๐Ÿ‘๏ธ Vision Support (NEW!)

Analyze images with AI:

  • ๐Ÿ” Image analysis from URLs or local files
  • ๐ŸŽจ Multiple images in one request
  • ๐Ÿ“Š Adjustable detail levels (low/auto/high)
  • ๐Ÿค– Works with vision-capable models
from blossom_ai import Blossom, MessageBuilder

with Blossom(api_token="token") as client:
    messages = [
        MessageBuilder.image(
            role="user",
            text="What's in this image?",
            image_url="https://example.com/image.jpg",
            detail="high"
        )
    ]
    
    response = client.text.chat(messages, model="openai")
    print(response)

๐Ÿ“š Full Vision Documentation โ†’

๐ŸŽจ Enhanced Image Generation

Advanced image controls:

  • ๐ŸŽฏ Quality levels: low, medium, high, hd
  • ๐ŸŽจ Guidance scale control (1.0-20.0)
  • ๐Ÿšซ Negative prompts for better control
  • ๐ŸŒˆ Transparent background support
  • ๐Ÿ–ผ๏ธ Image-to-image transformation
  • โšก Fast URL generation (no download needed)
with Blossom(api_token="token") as client:
    # HD quality with advanced controls
    image = client.image.generate(
        "majestic dragon",
        quality="hd",
        guidance_scale=7.5,
        negative_prompt="blurry, low quality",
        width=1920,
        height=1080
    )
๐Ÿ“ Advanced Text Features

Powerful text generation:

  • ๐Ÿ› ๏ธ Function calling / Tool use
  • ๐Ÿ“‹ Structured JSON output
  • โš™๏ธ Advanced parameters: max_tokens, frequency_penalty, presence_penalty, top_p
  • ๐ŸŒŠ Improved streaming with SSE
  • ๐ŸŒก๏ธ Extended temperature range (0-2)
  • ๐Ÿ’ฌ Multi-turn conversations
with Blossom(api_token="token") as client:
    response = client.text.generate(
        "Explain quantum computing",
        max_tokens=500,
        temperature=0.8,
        frequency_penalty=0.5,
        json_mode=True
    )

๐Ÿš€ Quick Start

๐Ÿ“ฆ Installation

pip install eclips-blossom-ai

๐Ÿ–ฅ๏ธ CLI Interface

Perfect for quick testing and learning:

# Launch interactive menu
python -m blossom_ai.utils.cli

# Quick commands
python -m blossom_ai.utils.cli --image "a beautiful sunset" --output sunset.png
python -m blossom_ai.utils.cli --text "Explain quantum computing"

# Set API token (optional for some features)
export POLLINATIONS_API_KEY="your_token"
python -m blossom_ai.utils.cli

Interactive Menu:

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘        ๐ŸŒธ BLOSSOM AI CLI ๐ŸŒธ            โ•‘
โ•‘  Simple interface for AI generation    โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

1. ๐Ÿ–ผ๏ธ  Generate Image
2. ๐Ÿ’ฌ Generate Text
3. ๐Ÿ‘๏ธ  Analyze Image (Vision)
4. โ„น๏ธ  Show Available Models
5. ๐Ÿšช Exit

๐Ÿ“š Full CLI Documentation โ†’

โšก Python Library

from blossom_ai import Blossom
import os
api_token = os.getenv('POLLINATIONS_API_KEY')
# Simple usage
with Blossom(api_token=api_token) as ai:
    # Generate image URL 
    url = ai.image.generate_url("a beautiful sunset")
    print(url)
    
    # Save image directly
    ai.image.save("a serene lake at dawn", "lake.jpg")
    
    # Generate text
    response = ai.text.generate("Explain quantum computing")
    print(response)
    
    # Stream text in real-time
    for chunk in ai.text.generate("Tell me a story", stream=True):
        print(chunk, end='', flush=True)

๐ŸŽฏ With API Token (Advanced Features)

import os
from blossom_ai import Blossom

# โœ… Best practice: Use environment variables
api_token = os.getenv('POLLINATIONS_API_KEY')

with Blossom(api_token=api_token) as client:
    # HD image with advanced controls
    image = client.image.generate(
        "majestic dragon",
        quality="hd",
        guidance_scale=7.5,
        negative_prompt="blurry, low quality",
        width=1920,
        height=1080
    )
    
    # Advanced text generation
    response = client.text.generate(
        "Explain AI",
        max_tokens=200,
        frequency_penalty=0.5,
        temperature=0.8
    )
    
    # Vision analysis (requires token)
    from blossom_ai import MessageBuilder
    
    messages = [
        MessageBuilder.image(
            role="user",
            text="Describe this image",
            image_url="https://example.com/photo.jpg"
        )
    ]
    
    analysis = client.text.chat(messages, model="openai")
    print(analysis)

# Automatic cleanup - no resource leaks!

๐Ÿ“Š Why Blossom AI?

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โœ“ CLI Interface for quick terminal access                 โ”‚
โ”‚  โœ“ Vision & multimodal support (images + text)             โ”‚
โ”‚  โœ“ HD image generation with advanced controls              โ”‚
โ”‚  โœ“ Function calling and structured outputs                 โ”‚
โ”‚  โœ“ Both sync and async support out of the box              โ”‚
โ”‚  โœ“ Clean, modern Python with type hints                    โ”‚
โ”‚  โœ“ Production-ready with comprehensive testing             โ”‚
โ”‚  โœ“ Smart caching and optimization utilities                โ”‚
โ”‚  โœ“ Secure: tokens in headers only, SSL enforced            โ”‚
โ”‚  โœ“ Active development and community support                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽฏ Choose Your Style

๐Ÿ–ฅ๏ธ CLI (Terminal)

Perfect for:

  • โœ… Quick testing
  • โœ… Learning the API
  • โœ… Shell automation
  • โœ… No code required
python -m blossom_ai.utils.cli \
  --image "sunset" \
  --output sunset.png

๐Ÿ“š Library (Python)

Perfect for:

  • โœ… Production apps
  • โœ… Complex workflows
  • โœ… Integration
  • โœ… Advanced features
from blossom_ai import Blossom

with Blossom() as ai:
    ai.image.save("sunset", "sunset.png")

๐Ÿ“š Documentation

Resource Description
๐Ÿ“– Getting Started Complete guide to using Blossom AI
๐Ÿ–ฅ๏ธ CLI Interface Terminal interface documentation
๐Ÿ‘๏ธ Vision Guide Vision and multimodal features
๐ŸŽจ Image Generation HD images with advanced controls
๐Ÿ’ฌ Text Generation Advanced text generation features
โš™๏ธ Installation Setup and configuration
๐Ÿ’ก Examples Practical code examples
๐ŸŒ Web Apps Build FastAPI/Flask applications
๐Ÿ“ Changelog Version history and updates
๐Ÿ”’ Security Security best practices

๐ŸŒŸ Showcase

๐ŸŽจ Image Generation Examples

CLI:

# Quick generation
python -m blossom_ai.utils.cli --image "cyberpunk city" --output city.png

# HD quality with custom size
python -m blossom_ai.utils.cli \
  --image "mountain landscape" \
  --width 1920 \
  --height 1080 \
  --quality hd \
  --output landscape.png

Python:

# Simple and fast
with Blossom() as ai:
    ai.image.save("a cyberpunk city at night", "cyberpunk.jpg")
    ai.image.save("watercolor painting of mountains", "mountains.jpg")

# HD quality with advanced controls
with Blossom(api_token="token") as ai:
    image = ai.image.generate(
        "majestic dragon breathing fire",
        quality="hd",
        guidance_scale=7.5,
        negative_prompt="blurry, low quality, distorted",
        width=1920,
        height=1080,
        seed=42  # Reproducible results
    )
๐Ÿ’ฌ Text Generation Examples

CLI:

# Quick text generation
python -m blossom_ai.utils.cli --text "Write a haiku about AI"

# With streaming for real-time output
python -m blossom_ai.utils.cli --text "Tell me a story" --stream

Python:

# Creative writing
story = ai.text.generate("Write a short sci-fi story about time travel")

# Code generation
code = ai.text.generate("Create a Python function to sort a list")

# Advanced controls
response = ai.text.generate(
    "Explain quantum computing for beginners",
    max_tokens=500,
    temperature=0.8,
    frequency_penalty=0.5,
    stream=True  # Real-time streaming
)

# Structured JSON output
json_data = ai.text.generate(
    "List 5 programming languages with their use cases",
    json_mode=True
)
๐Ÿ‘๏ธ Vision Analysis Examples (NEW!)

Python:

from blossom_ai import Blossom, MessageBuilder

with Blossom(api_token="token") as ai:
    # Analyze image from URL
    messages = [
        MessageBuilder.image(
            role="user",
            text="What's in this image? Describe in detail.",
            image_url="https://example.com/photo.jpg",
            detail="high"
        )
    ]
    
    analysis = ai.text.chat(messages, model="openai")
    print(analysis)
    
    # Analyze local image
    messages = [
        MessageBuilder.image(
            role="user",
            text="Identify the objects in this image",
            image_path="/path/to/image.jpg",
            detail="auto"
        )
    ]
    
    result = ai.text.chat(messages, model="openai")
    
    # Compare multiple images
    messages = [
        MessageBuilder.image(
            role="user",
            text="Compare these two images",
            image_url="https://example.com/image1.jpg"
        ),
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "And this second image:"},
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://example.com/image2.jpg",
                        "detail": "high"
                    }
                }
            ]
        }
    ]
    
    comparison = ai.text.chat(messages, model="openai")
๐Ÿ”ง Shell Automation Examples
#!/bin/bash

# Generate multiple images in parallel
for i in {1..5}; do
    python -m blossom_ai.utils.cli \
        --image "abstract art style $i" \
        --output "art_$i.png" &
done
wait

# Batch text processing
questions=(
    "What is AI?"
    "Explain machine learning"
    "What is deep learning?"
)

for q in "${questions[@]}"; do
    echo "Q: $q"
    python -m blossom_ai.utils.cli --text "$q"
    echo "---"
done

# Vision analysis pipeline
for img in *.jpg; do
    echo "Analyzing: $img"
    python -c "
from blossom_ai import Blossom, MessageBuilder
with Blossom(api_token='token') as ai:
    messages = [MessageBuilder.image('user', 'Describe', image_path='$img')]
    print(ai.text.chat(messages, model='openai'))
"
done

๐Ÿ›ก๏ธ Production Ready

Blossom AI v0.5.0 is battle-tested with:

โœ… Vision Support: Analyze images with AI models
โœ… HD Image Generation: Up to 2048x2048 with quality controls
โœ… Advanced Text Features: Function calling, JSON mode, streaming
โœ… CLI Interface: Quick terminal access for testing and automation
โœ… Comprehensive Testing: Integration tests with VCR.py
โœ… Memory Safe: No memory leaks in long-running applications
โœ… Secure: Tokens only in headers, SSL verification enforced
โœ… Fast: Optimized caching and connection pooling
โœ… Reliable: Smart retry logic with exponential backoff

Quick Health Check

from blossom_ai import Blossom

def health_check():
    """Verify everything works"""
    try:
        with Blossom(api_token="token") as client:
            # Test image
            img = client.image.generate("test", width=256, height=256)
            assert len(img) > 1000
            
            # Test text
            txt = client.text.generate("Say hello", max_tokens=10)
            assert len(txt) > 0
            
            # Test vision
            from blossom_ai import MessageBuilder
            messages = [
                MessageBuilder.image(
                    "user",
                    "What's this?",
                    image_url="https://pollinations.ai/p/test"
                )
            ]
            vision = client.text.chat(messages, model="openai")
            assert len(vision) > 0
            
            print("โœ… Health check passed!")
            return True
    except Exception as e:
        print(f"โŒ Health check failed: {e}")
        return False

health_check()

๐ŸŽจ Advanced Features

๐Ÿง  Reasoning Module

Enhance prompts with structured thinking:

from blossom_ai.utils import ReasoningEnhancer

enhancer = ReasoningEnhancer()
enhanced = enhancer.enhance(
    "Design a microservices architecture",
    level="high",
    mode="auto"
)

โšก Caching Module

Cache responses for better performance:

from blossom_ai.utils import cached

@cached(ttl=3600)
def generate_text(prompt):
    with Blossom() as ai:
        return ai.text.generate(prompt)

๐Ÿ“ File Reader

Process files for AI prompts:

from blossom_ai.utils import read_file_for_prompt

content = read_file_for_prompt(
    "code.py",
    max_length=8000,
    truncate_if_needed=True
)

๐ŸŒ Web Applications

Build REST APIs with FastAPI/Flask:

from fastapi import FastAPI
app = FastAPI()

@app.post("/generate")
async def generate(prompt: str):
    async with Blossom() as ai:
        return await ai.text.generate(prompt)

๐Ÿ“š View Full Documentation โ†’

๐Ÿค Contributing

Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines.

๐Ÿ“„ License

Distributed under the MIT License. See LICENSE for more information.

๐Ÿ’– Support

If you find this project helpful, please consider:

  • โญ Starring the repository
  • ๐Ÿ› Reporting bugs
  • ๐Ÿ’ก Suggesting new features
  • ๐Ÿ“ข Sharing with others

Made with ๐ŸŒธ and โค๏ธ by Eclips Team

Made with Python Powered by Pollinations.AI Version 0.5.0

โฌ†๏ธ Back to top

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

eclips_blossom_ai-0.5.3.tar.gz (181.0 kB view details)

Uploaded Source

Built Distribution

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

eclips_blossom_ai-0.5.3-py3-none-any.whl (187.7 kB view details)

Uploaded Python 3

File details

Details for the file eclips_blossom_ai-0.5.3.tar.gz.

File metadata

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

File hashes

Hashes for eclips_blossom_ai-0.5.3.tar.gz
Algorithm Hash digest
SHA256 c713eee4dd72c97a6f6b4c317e4bd05d8592375c8e313608543ce1e1d55e9fc7
MD5 b839bc6fed3e1dc1e25591d059a5eb90
BLAKE2b-256 7f38790b7324ef7f57cf60aa780842b7c32338426a136d62320d04a6643b65c9

See more details on using hashes here.

File details

Details for the file eclips_blossom_ai-0.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for eclips_blossom_ai-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ce14748aa38fc3ed476d0af1eb9e499eae3932659c2976dd090fd66340a9de74
MD5 010e63c7f628b8459c802ee0b29b4997
BLAKE2b-256 1699953da5f9e08a43709bce05c4c9a77fb210bc8ebf512e5426305012225f62

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