Skip to main content

A Python library for text-based AI interactions with multi-provider support

Project description

multiai

multiai is a Python library and command-line tool designed to interact with text-based generative AI models from the following providers:

AI Provider Web Service Models Available
OpenAI ChatGPT GPT Models
Anthropic Claude Claude Models
Google Gemini Gemini Models
Perplexity Perplexity Perplexity Models
Mistral Mistral Mistral Models
DeepSeek DeepSeek DeepSeek Models
xAI xAI xAI Models
Local LLM Ollama Ollama Models

Key Features

  • Interactive Chat: Communicate with AI directly from your terminal.
  • Multi-Line Input: Supports multi-line prompts for complex queries.
  • Pager for Long Responses: View lengthy responses conveniently using a pager.
  • Continuation Handling: Automatically handle and request continuations if responses are cut off.
  • Automatic Chat Logging: Automatically save your chat history for future reference.
  • File Attachments: Attach files as additional context.

Usage

Install multiai, then configure your API keys for your chosen AI providers as environment variables or in a user-setting file. Once that's done, you can start interacting with the AI.

  • To send a simple query:

    ai hi
    

    You should see a response like:

    gpt-4o-mini>
    Hello! How can I assist you today?
    
  • For an interactive session, enter interactive mode:

    ai
    

    In this mode, you can continue the conversation:

    user> hi
    gpt-4o-mini>
    Hello! How can I assist you today?
    user> how are you
    gpt-4o-mini>
    I'm just a program, so I don't have feelings, but I'm here and ready to help you! How about you? How are you doing?
    user>
    

To see a list of all command-line options, use:

ai -h

For more detailed documentation, please refer to the manual.

Using multiai as a Python Library

multiai can also be used as a Python library. Here’s a simple example:

import multiai

# Initialize the client
client = multiai.Prompt()
client.set_model('openai', 'gpt-4o')  # Set model
client.temperature = 0.5  # Set temperature

# Send a prompt and get a response
answer = client.ask('hi')
print(answer)

# Continue the conversation with context
answer = client.ask('how are you')
print(answer)

# Clear the conversation context
client.clear()

The manual includes the following sample codes:

  • A script that translates a text file into English.
  • A local chat app that allows you to easily select from various AI models provided by different providers and engage in conversations with them.

Ask DeepWiki

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

multiai-1.5.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

multiai-1.5.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file multiai-1.5.0.tar.gz.

File metadata

  • Download URL: multiai-1.5.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for multiai-1.5.0.tar.gz
Algorithm Hash digest
SHA256 b6038d35d24a143a511b2839559e303b02e8a7e8da50d6f1caea35bdcaa1df7b
MD5 39185e8906a3349291b0ecf3ad74b918
BLAKE2b-256 0936875216ea94fdb30aa199afcc10605f3c54a0dea098ce4bad2e4e3e60f4aa

See more details on using hashes here.

File details

Details for the file multiai-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: multiai-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for multiai-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 346a824d59839f206039aaebcd6286d96c85566e53ec4a37de5c03cedfefe4a2
MD5 c8219b4c05340ef89c790db8d177d6c0
BLAKE2b-256 301a73b1be57f1b04c23e10514955276f7270f50a8c6ee3f4574a46912da748a

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