Skip to main content

EasilyAI

PyPI Supported Python Versions PyPI Downloads License Build Status Contributors

EasilyAI is a Python library that simplifies AI app development by integrating popular AI services like OpenAI and Ollama. It provides a clean, unified interface for text generation, image generation, and text-to-speech (TTS) tasks.


Features

  • App Creation: Simplify initializing AI services like OpenAI and Ollama.
  • Text-to-Speech: Convert text to speech with OpenAI's TTS API (with voice selection).
  • Custom AI Support: Integrate and register custom AI models.
  • Unified Request Handling: Automatically determine task types like text, image, or TTS requests.
  • Pipeline Support: Chain multiple tasks into a seamless workflow.

Installation

Install the library via pip:

pip install easilyai

Quick Start

1. Create an AI App

Create an app for OpenAI:

import easilyai

# Initialize an OpenAI App
app = easilyai.create_app(
    name="my_ai_app",
    service="openai",
    apikey="YOUR_OPENAI_API_KEY",
    model="gpt-4"
)

# Make a request
response = app.request("Tell me a joke about AI.")
print(response)

2. Generate Text-to-Speech

Create a dedicated TTS app and specify the model and voice:

# Initialize a TTS App
tts_app = easilyai.create_tts_app(
    name="my_tts_app",
    service="openai",
    apikey="YOUR_OPENAI_API_KEY",
    model="tts-1"
)

# Convert text to speech
output_file = tts_app.request_tts(
    text="Hello, I am your AI assistant!",
    tts_model="tts-1",
    voice="onyx",
    output_file="hello_ai.mp3"
)
print(f"TTS output saved to: {output_file}")

3. Use Pipelines

Chain multiple tasks (text generation, image generation, and TTS):

# Create a pipeline
pipeline = easilyai.EasilyAIPipeline(app)

# Add tasks
pipeline.add_task("generate_text", "Write a poem about AI and nature.")
pipeline.add_task("generate_image", "A futuristic city with flying cars.")
pipeline.add_task("text_to_speech", "Here is a talking car in a futuristic world!")

# Run the pipeline
results = pipeline.run()

# Print results
for task_result in results:
    print(f"Task: {task_result['task']}\nResult: {task_result['result']}\n")

4. Register Custom AI Services

Integrate your own AI models into EasilyAI:

from easilyai.custom_ai import CustomAIService, register_custom_ai

# Define a custom AI service
class MyCustomAI(CustomAIService):
    def generate_text(self, prompt):
        return f"Custom AI response for: {prompt}"

    def text_to_speech(self, text, **kwargs):
        return f"Custom TTS Output: {text}"

# Register the custom AI
register_custom_ai("my_custom_ai", MyCustomAI)

# Use the custom AI
custom_app = easilyai.create_app(name="custom_app", service="my_custom_ai", model="v1")
print(custom_app.request("What is 2 + 2?"))

Supported Services

  1. OpenAI

    • Text Generation (ChatGPT models like gpt-4o)
    • Image Generation (dall-e-3)
    • Text-to-Speech (tts-1, voices: onyx, alloy, etc.)
  2. Ollama

    • Local LLM text generation (e.g., llama3.1).
  3. Custom AI

    • Extend functionality by registering your own AI services.

Error Handling

EasilyAI includes robust error handling with informative, emoji-coded messages.

Examples:

  • 🔐 Missing API Key: "No API key provided! Add your API key to initialize the service."
  • 🚫 Invalid Request: "The request is invalid. Please check your inputs."
  • 🌐 Connection Error: "Unable to connect to the API. Ensure the server is running."
  • ⏳ Rate Limit Exceeded: "Too many requests! Wait and try again."

Future Features

  • Full support for additional TTS providers.
  • Model-specific optimizations.
  • Enhanced CLI tools for developers.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch.
  3. Submit a pull request with detailed changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Links


Contact

For questions, bugs, or feature requests, please reach out to GustyCube at gc@gustycube.xyz.

Metadata

Release files for EasilyAI 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EasilyAI 0.2.1
File Size Uploaded Provenance
easilyai-0.2.1.tar.gz 13.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for EasilyAI 0.2.1
File Interpreter ABI Platform
EasilyAI-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.4 kB

Release files / easilyai-0.2.1.tar.gz

Download URL easilyai-0.2.1.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
011ad8d880d8a5f911abbdab14efef7f8433231d1068d281a2e75d3278fc2df6
BLAKE2b-256 checksum
How to use checksums
11edeebfdf794ce7103f9c97c266186076e6746d05a5f95965cb42c751b0e78e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2024.

Transparency log

Release files / EasilyAI-0.2.1-py3-none-any.whl

Download URL EasilyAI-0.2.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3530c269f040119d6be3937b437314f8fdfa69a44fae3e037c6e35c81cc82bc
BLAKE2b-256 checksum
How to use checksums
5623c760d2ee0a326fc939f3f95dad07857ab7c7dfb2237b2d872e7e0d0a752d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2024.

Transparency log

Security for EasilyAI 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for easilyai-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 29, 2024.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page