Skip to main content

A simple and intuitive wrapper around OpenAI Compatible APIs with tool support

Project description

EYAI

pronounced: /eɪ aɪ/

A simple and intuitive wrapper around OpenAI compatible APIs with built-in tool support.

Features

  • Easy-to-use AI assistant with conversation memory
  • Simple tool/function calling with decorators
  • Automatic conversation history management
  • Save and load conversations
  • Support for multiple AI providers (OpenAI, Groq, etc.)
  • Configurable model parameters

Installation

pip install eyai

Quick Start

from eyai import Assistant

assistant = Assistant(api_key="your-api-key-here")

# Simple chat
response = assistant.chat("Hello! What's the weather like?")
print(response)

# With tools
@assistant.tool("Get the current weather for a city")
def get_weather(city: str) -> str:
    # Your weather API logic here
    return f"The weather in {city} is sunny and 72°F"

# The AI can now call your function
response = assistant.chat("What's the weather in New York?")
print(response)  # AI will call get_weather("New York") and respond

Advanced Usage

Using with Groq

from eyai import Assistant

assistant = Assistant(
    api_key="your-groq-api-key",
    base_url="https://api.groq.com/openai/v1",
    model="llama-3.3-70b-versatile"
)

Multiple Tools

@assistant.tool("Calculate the sum of two numbers")
def add(x: int, y: int) -> int:
    return x + y

@assistant.tool("Get user information from database")
def get_user(user_id: str) -> dict:
    # Your database logic here
    return {"id": user_id, "name": "John Doe"}

response = assistant.chat("Add 5 and 3, then get user info for user123")

Conversation Management

# Get conversation history
history = assistant.get_conversation_history()

# Clear conversation (keeps system prompt)
assistant.clear_conversation()

# Save conversation
assistant.save_conversation("chat_history.json")

# Load conversation
assistant.load_conversation("chat_history.json")

API Reference

Assistant

Assistant(
    api_key: str,
    base_url: str,
    model: str,
    system_prompt: str = "You are a helpful AI assistant.",
    temperature: float = 0.7,
    max_tokens: Optional[int] = None
)

Methods

  • chat(message: str) -> str: Send a message and get a response
  • tool(description: str = ""): Decorator to register functions as tools
  • get_conversation_history() -> List[Dict[str, Any]]: Get conversation history
  • clear_conversation(): Clear conversation history
  • save_conversation(filename: str): Save conversation to JSON file
  • load_conversation(filename: str): Load conversation from JSON file

Requirements

  • Python 3.8+

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

eyai-1.0.5.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

eyai-1.0.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file eyai-1.0.5.tar.gz.

File metadata

  • Download URL: eyai-1.0.5.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for eyai-1.0.5.tar.gz
Algorithm Hash digest
SHA256 28c25a27e89373b27f712331203658fd7fbf7f07401be116a8c803b1658c081d
MD5 f689c2c20d9c8f1b038a83a12a3b77a2
BLAKE2b-256 143068d56f088b628fb5554bf06ba75290d984b6a73bc1caa4977953bf9e1f9b

See more details on using hashes here.

File details

Details for the file eyai-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: eyai-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for eyai-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5eb8d6f4ce11019b11f5d759f96addddb62122fe0083092479953b1c06472629
MD5 b7b51cdae40a47dba5941cff774afef2
BLAKE2b-256 d3b6c26ddaa4343c5238bcef6b813560681930ea7083b3a1d99f5dcb26666e4e

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