A library that simplifies the usage of AI!
Project description
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
-
OpenAI
- Text Generation (ChatGPT models like
gpt-4o) - Image Generation (
dall-e-3) - Text-to-Speech (
tts-1, voices:onyx,alloy, etc.)
- Text Generation (ChatGPT models like
-
Ollama
- Local LLM text generation (e.g.,
llama3.1).
- Local LLM text generation (e.g.,
-
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:
- Fork the repository.
- Create a new branch.
- Submit a pull request with detailed changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Links
- Documentation: [coming soon]
- GitHub Repository: https://github.com/GustyCube/EasilyAI
Contact
For questions, bugs, or feature requests, please reach out to GustyCube at gc@gustycube.xyz.
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
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
File details
Details for the file easilyai-0.1.7.tar.gz.
File metadata
- Download URL: easilyai-0.1.7.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a5b264626233c3e26352b0a6a36b67ca197247939ff4d50337d0eafd0e89ef7
|
|
| MD5 |
bbbc75a9879a09dd3549e5fbec9cf540
|
|
| BLAKE2b-256 |
b7b25c9a1c8484faf0cb2e2ced230d3934b1e5b880115d7a7a9f87a66bc0673f
|
Provenance
The following attestation bundles were made for easilyai-0.1.7.tar.gz:
Publisher:
python-publish.yml on GustyCube/EasilyAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easilyai-0.1.7.tar.gz -
Subject digest:
0a5b264626233c3e26352b0a6a36b67ca197247939ff4d50337d0eafd0e89ef7 - Sigstore transparency entry: 156528812
- Sigstore integration time:
-
Permalink:
GustyCube/EasilyAI@3ba21789ed941308e48fa977ca3e43e86f86d37c -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/GustyCube
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3ba21789ed941308e48fa977ca3e43e86f86d37c -
Trigger Event:
release
-
Statement type:
File details
Details for the file EasilyAI-0.1.7-py3-none-any.whl.
File metadata
- Download URL: EasilyAI-0.1.7-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bfed275737ff50e662d814bda9b76e29b82e5e5cad22bf55f100d445f3de2f6
|
|
| MD5 |
4eccfecd1e8de9b8c0de992dd09cff05
|
|
| BLAKE2b-256 |
1fb24cf0b8ea8f0a2a41b187a3d7349e4d03ff156584909d7a891a8a804d0a10
|
Provenance
The following attestation bundles were made for EasilyAI-0.1.7-py3-none-any.whl:
Publisher:
python-publish.yml on GustyCube/EasilyAI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easilyai-0.1.7-py3-none-any.whl -
Subject digest:
0bfed275737ff50e662d814bda9b76e29b82e5e5cad22bf55f100d445f3de2f6 - Sigstore transparency entry: 156528814
- Sigstore integration time:
-
Permalink:
GustyCube/EasilyAI@3ba21789ed941308e48fa977ca3e43e86f86d37c -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/GustyCube
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3ba21789ed941308e48fa977ca3e43e86f86d37c -
Trigger Event:
release
-
Statement type: