AI-Powered Python Library for Code Generation
Project description
Keeya
AI-Powered Python Library for Code Generation
Keeya is a simple Python library that uses AI to generate clean, executable Python code on-demand. Unlike traditional code completion tools, Keeya runs in your Python environment and generates production-ready code based on your requirements.
Installation
pip install keeya
Setup
No setup required! Keeya works out of the box with free AI models.
Optional: If you want to use your own OpenRouter API key:
- Get your key from OpenRouter
- Set it:
export OPENROUTER_API_KEY="your_key_here"
Quick Start
import keeya
# Generate any Python function
code = keeya.generate("function to add two numbers")
print(code)
# Generate complex algorithms
code = keeya.generate("function to implement quicksort")
print(code)
Examples
Basic Code Generation
import keeya
# Generate any Python function
code = keeya.generate("function to add two numbers")
print(code)
# Output: def add_numbers(a, b): return a + b
# Generate data processing function
code = keeya.generate("function to calculate mean of a list")
print(code)
# Output: def calculate_mean(numbers): return sum(numbers) / len(numbers)
Data Science Operations
import keeya
import pandas as pd
# Load your data
df = pd.read_csv('data.csv')
# AI-powered data cleaning
cleaned_df = keeya.clean(df)
# AI-powered analysis
insights = keeya.analyze(df)
# AI-powered visualization
keeya.visualize(df, plot_type='scatter')
# AI-powered ML training
model = keeya.train(df, target='price')
Features
- Simple API: Just call
keeya.generate()orkeeya.clean() - AI-Powered: Uses AI to generate code based on your data
- Context-Aware: Understands your DataFrames and generates appropriate code
- Smart Model Selection: Automatically chooses the best AI model based on task complexity
- Jupyter Ready: Works seamlessly in notebooks and Colab
- Safe Execution: Safely executes generated code and returns results
- Multi-Model Support: GPT-OSS-20B (fast), Qwen2.5-32B (balanced), Qwen3-480B (powerful)
Examples
Basic Functions
# Generate utility functions
code = keeya.generate("function to reverse a string")
code = keeya.generate("function to find duplicates in a list")
code = keeya.generate("function to sort a dictionary by values")
Data Science
# Data cleaning
cleaned_df = keeya.clean(df)
# Data analysis
analysis = keeya.analyze(df)
# Visualizations
keeya.visualize(df, plot_type='histogram')
keeya.visualize(df, plot_type='correlation')
# Machine learning
model = keeya.train(df, target='target_column')
predictions = model.predict(test_df)
Smart Model Selection
Keeya automatically selects the best AI model based on task complexity:
- GPT-OSS-20B (2-4 seconds): Fast fallback for simple tasks
- Qwen2.5-32B (3-6 seconds): Sweet spot for balanced performance
- Qwen3-480B (6-12 seconds): Worth the wait for complex tasks
Manual Model Selection
You can also specify a model manually:
# Use specific model
code = keeya.generate("complex function", model="qwen3-480b")
cleaned_df = keeya.clean(df, model="gpt-oss-20b")
# See available models
models = keeya.get_available_models()
print(models)
API Reference
keeya.generate(prompt, model=None)
Generate Python code from natural language prompt.
keeya.clean(df, model=None)
AI-powered data cleaning. Returns cleaned DataFrame.
keeya.analyze(df, model=None)
AI-powered data analysis. Returns analysis results.
keeya.visualize(df, plot_type=None, model=None)
AI-powered visualization. Creates and displays plots.
keeya.train(df, target, model=None)
AI-powered ML model training. Returns trained model.
keeya.get_available_models()
Get available models and their descriptions.
Requirements
- Python 3.8+
- pandas
- requests
License
MIT License
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 keeya-0.1.2.tar.gz.
File metadata
- Download URL: keeya-0.1.2.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7a2c44fb71b1837b4814d335b67cab7d00f89e31c068a0728ef51ea351e7ab
|
|
| MD5 |
d379e04f17d30cea04e1013c491b14a8
|
|
| BLAKE2b-256 |
aa1256bb101840debb8e452198fc4e6612a93879fbb56210b7f7066f2e350190
|
File details
Details for the file keeya-0.1.2-py3-none-any.whl.
File metadata
- Download URL: keeya-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a27c0c2f3c45d509392fff0489db2706544b8f1a075aaef660da288333519fcc
|
|
| MD5 |
693d8a616b94ea114c16fb9edbb3f52b
|
|
| BLAKE2b-256 |
86575acffbe334371fcb5c17103dd493407f0e74450ebae3948914a8fe1a90ea
|