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.2.tar.gz (19.8 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.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for multiai-1.5.2.tar.gz
Algorithm Hash digest
SHA256 a534a8d3d14095b0415514139fb75ac112b10ee542d2fe6915b49dc54a0e5107
MD5 0ecfae141904498ce22256ddbc4e0929
BLAKE2b-256 e4713140d3ac99a6edbb0dd54afba8c0053dab57640ef00020b04561a31a3429

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for multiai-1.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3315faec0012aeba81db649e075194b430c8fb47362ea89f097e9c963c16547b
MD5 ac053a6b75d182f2007a75b1e84050de
BLAKE2b-256 e30c7bbc4f1f99cd86a2c0ed7921ac971cae50c60237ecfd3051cdc953cf9aac

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