Skip to main content

MonoAI - The complete framework to build AI-powered applications

Project description

MonoAI

alt text

The complete framework to build AI-powered applications

MonoAI is a Python library that enables structured, standardized, and efficient interactions with multiple AI models, harnessing their collective intelligence to deliver richer, more accurate responses.


🚀 Quick Start

Prompts

In MonoAI, a prompt is the request you send to a model.
You can define prompts in three different ways:


1. Plain Text

Directly write the prompt inside the ask method:

from MonoAI.models import Model

model = Model()
response = model.ask("What is 2 + 2?")

2. Prompt Class

Use the Prompt class to enhance your prompts with additional parameters such as response types, chaining, and iteration control:

from MonoAI.models import Model
from MonoAI.prompts import Prompt

model = Model()
prompt = Prompt("What is 2 + 2?", response_type=int)
response = model.ask(prompt)

3. .prompt Files

Store prompts in external .prompt files to separate your codebase from content logic.

Example - sum.prompt:

What is 2 + 2?
from MonoAI.models import Model
from MonoAI.prompts import Prompt

model = Model()
prompt = Prompt(prompt_id="sum", response_type=int)
response = model.ask(prompt)

You can also define additional metadata using an XML-like syntax inside .prompt files:

Example with metadata:

# sum.prompt
<prompt response_type="int">
What is 2 + 2?
</prompt>

Models

MonoAI provides multiple model interfaces to handle different use cases, from basic generation to multi-model aggregation:


Model

The standard interface for interacting with a single AI model.


MultiModel

Send a prompt to multiple models asynchronously and retrieve their individual outputs:

from MonoAI.models import MultiModel

model = MultiModel(models=[
    {"provider": "openai", "model": "gpt-4o"},
    {"provider": "deepseek", "model": "chat"}
])
response = model.ask("What is the capital of Italy?")

CollectiveModel

Send a prompt to multiple models and aggregate their outputs using a separate aggregator model for a richer, consolidated answer:

from MonoAI.models import CollectiveModel

model = CollectiveModel(
    models=[
        {"provider": "openai", "model": "gpt-4o"},
        {"provider": "deepseek", "model": "chat"}
    ],
    aggregator={"provider": "openai", "model": "gpt-4o"}
)
response = model.ask("What is the capital of Italy?")

AutoModel

Automatically select the best model for a given prompt based on configuration or inference:

from MonoAI.models import AutoModel

model = AutoModel()
response = model.ask("What is the capital of Italy?")

🔑 API Key Management

MonoAI simplifies API key management through a providers.keys file in the root directory.
Each line should follow this format:

PROVIDER_NAME=API_KEY

Example providers.keys:

OPENAI=sk-proj-ABCDE12345
DEEPSEEK=sk-proj-FGHIJ67890

MonoAI automatically loads these keys at runtime — no extra setup needed.


⚙️ Configuration

Configure MonoAI globally via a monoai.yaml file.
Supported fields:

Field Description Default
prompts_path Directory where .prompt files are stored "" (current folder)
keysfile_path Path to the API keys file "providers.keys"
base_model Default model to use when no model is specified None

Example monoai.yaml:

prompts_path: prompts
keysfile_path: providers.keys
base_model:
  provider: openai
  model: gpt-4o-mini

📚 Documentation

Full documentation is available at:
👉 MonoAI Documentation

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

monoai-0.0.24.tar.gz (57.9 kB view details)

Uploaded Source

Built Distribution

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

monoai-0.0.24-py3-none-any.whl (72.7 kB view details)

Uploaded Python 3

File details

Details for the file monoai-0.0.24.tar.gz.

File metadata

  • Download URL: monoai-0.0.24.tar.gz
  • Upload date:
  • Size: 57.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for monoai-0.0.24.tar.gz
Algorithm Hash digest
SHA256 04fb7a4de827eafab945306e3a7c70bddfdfd6549e70e9377d13a5c09e9aa7a6
MD5 59ac45548d6f14d8d918dfe74f6823cb
BLAKE2b-256 8d0477042999a67ad7f056cde4aecf48ab9d481c522c79b7c437b6caf439b819

See more details on using hashes here.

File details

Details for the file monoai-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: monoai-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 72.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for monoai-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 cf86d64b564f1d2a621c9dafaf8918db992b0de600a0451fc1c3dde7e47d6e51
MD5 8f8fe037fc6511adfd5c1db9d71430c8
BLAKE2b-256 df3a5907e92697d72976b8e94dc37e5bd205c8575c7d1afe79ba1251af048a50

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