Skip to main content

Hi Cutie

Project description

askOmi

AI-powered HTML response generator with inline and separate file output options.

Features

  • AI-Powered Responses: Uses Google's Gemini AI to generate intelligent responses
  • Flexible Output Options:
    • Generate responses in separate HTML files
    • Add responses inline to existing HTML files
  • Easy Integration: Simple Python functions for quick implementation
  • Beautiful Styling: Professional HTML output with modern CSS

Installation

pip install askOmi

Quick Start

from askOmi import askOmi, html, inline_html

# Get AI response as text
response = askOmi("What is Python programming?")

# Generate separate HTML file
html("What is Python programming?")

# Add response to existing file or create new one
inline_html("What is Python programming?", "my_page.html")

Functions

askOmi(error)

Returns AI-generated response as plain text.

Parameters:

  • error (str): Your question or prompt

Returns:

  • str: AI-generated response

html(error)

Creates a separate HTML file (output.html) with the AI response.

Parameters:

  • error (str): Your question or prompt

inline_html(error, filename="index.html")

Adds AI response to an existing HTML file or creates a new one.

Parameters:

  • error (str): Your question or prompt
  • filename (str, optional): Target HTML file (default: "index.html")

Features:

  • If file doesn't exist: Creates new HTML file with styled layout
  • If file exists: Appends styled response to existing content

get(error, style="inline")

Returns HTML content as a string instead of writing to a file. Perfect for using directly in Python code!

Parameters:

  • error (str): Your question or prompt
  • style (str): "inline" for appending style, "full" for complete HTML document

Returns:

  • str: HTML content as string

destroy()

Cleans up installed packages and generated files.

Examples

Basic Usage

from askOmi import askOmi

# Get text response
answer = askOmi("How do I learn programming?")
print(answer)

Generate HTML File

from askOmi import html

# Creates output.html with styled response
html("What are the best programming languages for beginners?")

Inline HTML Generation

from askOmi import inline_html

# Create new file or add to existing one
inline_html("What is machine learning?", "tutorial.html")
inline_html("How does AI work?", "tutorial.html")  # Appends to same file

Get HTML as String (NEW!)

from askOmi import get

# Get HTML content as string (perfect for web apps!)
html_content = get("What is Python programming?", style="inline")

# Use in Flask/Django or any web framework
from flask import render_template_string
template = f'''
<!DOCTYPE html>
<html>
<head><title>My App</title></head>
<body>
    <h1>Welcome</h1>
    {html_content}
</body>
</html>
'''

# Get full HTML document
full_html = get("What is web development?", style="full")

Requirements

  • Python 3.8+
  • Google Generative AI API key

API Key Setup

The package uses Google's Gemini AI. Make sure you have a valid API key. The current implementation includes a hardcoded key, but for production use, consider using environment variables:

import os
from askOmi import askOmi

# Set your API key as environment variable
os.environ['GEMINI_API_KEY'] = 'your-api-key-here'

License

MIT License

Contributing

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

Support

If you encounter any issues or have questions, please open an issue on GitHub.

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

askomi-0.8.5.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

askomi-0.8.5-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file askomi-0.8.5.tar.gz.

File metadata

  • Download URL: askomi-0.8.5.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for askomi-0.8.5.tar.gz
Algorithm Hash digest
SHA256 a818a1787514d837e1b26d0ae4c4fe9431d2f1230c0dc7544892d71238762f22
MD5 64344f132aa7a02d008f6e3bb1df9570
BLAKE2b-256 02ce28469a6cbe4f17c8a45ff22f3748cdb07830b848e03b15bdc86f864e84c1

See more details on using hashes here.

File details

Details for the file askomi-0.8.5-py3-none-any.whl.

File metadata

  • Download URL: askomi-0.8.5-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for askomi-0.8.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6d7767e89e9e8db32ec619a91c5539bd39058a3f7d7ce79418f411cfd6b34ccf
MD5 4d4f7d136cbbd0b457b89abea76da346
BLAKE2b-256 4a962b8460c44a773e9365af7e3d4484c8c5e159d1447c160de1c6f42492ebe9

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