Skip to main content

The easiest AI wrapper for OpenAI, Anthropic, Gemini, and HuggingFace

Project description

Documentation: ethan-super-ai-wrapper (v0.1.10+)

Welcome! ethan-super-ai-wrapper is a simple, unified Python library designed to make integrating different AI models into your projects as easy as possible.

Instead of learning separate libraries for OpenAI, Google, Anthropic, and HuggingFace, you only need to learn one set of simple commands. The library automatically handles the different API formats in the background.

  1. Installation

Install the library directly from PyPI using pip. This will also install its required dependencies (requests and huggingface_hub).

pip install ethan-super-ai-wrapper

  1. Quick Start (30 Seconds)

This is the fastest way to get a response.

1. Import the global 'ai' object

from ez_ai import ai

2. Set your API key

ai.openai_key = "YOUR_OPENAI_API_KEY_HERE"

3. Ask a question!

response = ai.ask("Write a short poem about Python code.") print(response)

  1. Core Commands: The API Reference

All commands are accessed through the imported ai object.

Authentication (Setting API Keys)

Setting a key automatically activates that provider and sets a recommended default model. You only need to set the key for the provider you want to use.

Command Description Default Model Set ai.openai_key = "sk-..." Activates OpenAI (GPT models). gpt-4o

ai.gemini_key = "AIza..." Activates Google Gemini. gemini-1.5-flash

ai.anthropic_key = "sk-..." Activates Anthropic (Claude models). claude-3-5-sonnet

ai.hf_key = "hf_..." Activates HuggingFace (Open Source). mistralai/Mistral-7B...

Generating Text

This is the primary function for all text-based tasks.

ai.ask(prompt)

Description: Sends a prompt to the currently active AI provider and returns the text response.

Parameters:

prompt (string): Your question or instruction for the AI.

Returns: A string containing the AI's answer.

Model Selection

You can manually override the default model at any time.

ai.model = "model-name"

Description: Sets the specific model to be used for the next ai.ask() call. The library will automatically switch to the correct provider's logic based on the name.

Examples:

Use a cheaper OpenAI model

ai.model = "gpt-3.5-turbo"

Use Google's most powerful model

ai.model = "gemini-1.5-pro"

Use a specific open-source model

ai.model = "google/flan-t5-large"

Advanced Chat Features

These commands give you more control over the conversation.

ai.set_personality(text)

Description: Sets a "system prompt" to define the AI's character or give it specific instructions for the entire conversation.

Example:

ai.set_personality("You are a sarcastic robot from the future.") print(ai.ask("What do you think of humans?"))

ai.clear_memory()

Description: The library remembers the last few turns of conversation. Use this command to clear the history and start a fresh conversation.

Image Generation

ai.generate_image(prompt)

Description: Creates an image based on a text prompt.

Note: This feature currently requires an OpenAI key (ai.openai_key) and uses the DALL-E 3 model.

Returns: A string containing the URL of the generated image.

  1. Usage Examples by Provider

See how easy it is to switch between different AI companies.

Example: OpenAI (GPT)

from ez_ai import ai

ai.openai_key = "YOUR_KEY"

print(ai.ask("Why is the sky blue?"))

Example: Google (Gemini)

from ez_ai import ai

ai.gemini_key = "YOUR_KEY"

Let's use the stable model

ai.model = "gemini-1.5-flash" print(ai.ask("Why is the sky blue?"))

Example: Anthropic (Claude)

from ez_ai import ai

ai.anthropic_key = "YOUR_KEY"

print(ai.ask("Why is the sky blue?"))

Example: HuggingFace (Open Source)

from ez_ai import ai

ai.hf_key = "YOUR_KEY"

Use a reliable, small model for testing

ai.model = "gpt2"

print(ai.ask("Why is the sky blue?"))

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

ethan_super_ai_wrapper-0.1.15.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

ethan_super_ai_wrapper-0.1.15-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file ethan_super_ai_wrapper-0.1.15.tar.gz.

File metadata

  • Download URL: ethan_super_ai_wrapper-0.1.15.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ethan_super_ai_wrapper-0.1.15.tar.gz
Algorithm Hash digest
SHA256 f883b56b9b4c235668c1919c272bff4968f1bfc48051915e45cea7a95e0bfbb8
MD5 fbe3ed942a4b3e7dd704ade32af84210
BLAKE2b-256 07d588465bfc9026040f7fe21707791933fe7d50f9b6da1e4eb7e0c94ce4ac16

See more details on using hashes here.

File details

Details for the file ethan_super_ai_wrapper-0.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for ethan_super_ai_wrapper-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 69108d9c3d42de69d74759bb4d12995d6602dd1519c3d1f7aedfbeebbaffd270
MD5 af5eee0b41b57e1607399eb2dea0d2d1
BLAKE2b-256 b4167c20d7f6cc8668d7ff2e4846221c4bc240bd23c456e37d33f7e4b79ca3de

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