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).

code Bash download content_copy expand_less pip install ethan-super-ai-wrapper 2. Quick Start (30 Seconds)

This is the fastest way to get a response.

code Python download content_copy expand_less

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) 3. 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:

code Python download content_copy expand_less

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:

code Python download content_copy expand_less 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) code Python download content_copy expand_less from ez_ai import ai ai.openai_key = "YOUR_KEY" print(ai.ask("Why is the sky blue?")) Example: Google (Gemini) code Python download content_copy expand_less 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) code Python download content_copy expand_less from ez_ai import ai ai.anthropic_key = "YOUR_KEY" print(ai.ask("Why is the sky blue?")) Example: HuggingFace (Open Source) code Python download content_copy expand_less 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.14.tar.gz (4.5 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.14-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ethan_super_ai_wrapper-0.1.14.tar.gz
  • Upload date:
  • Size: 4.5 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.14.tar.gz
Algorithm Hash digest
SHA256 557cf52293a14650b8bc106938b64732a18f797d86ebb6a177de206a3b209733
MD5 b12697b9df6d6e96f7aecdc075b1a2f4
BLAKE2b-256 9932dd4e04a6a82e0def237256612d523673929d5bfffd003d059e256b157a31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ethan_super_ai_wrapper-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 16d5388ad0381b2073dc4184033bb562321ea0e9218c899fe46781aa87798459
MD5 654daa5fe9888d0a4f3d4ae48e152807
BLAKE2b-256 7c957209b3ca54f90e4bd9f164a9f3f3e6d2bfeeae78b7a23cdd061ee20a93e1

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