A Python library for text-based AI interactions
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 |
| 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.
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 hiYou 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.
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 multiai-1.3.1.tar.gz.
File metadata
- Download URL: multiai-1.3.1.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d10677064b686853e9aa8c08a869cf229e15a7f1af472bc0b4e40221180de9d9
|
|
| MD5 |
20c6b68f0d7c5bedc1ca4276e1f6053b
|
|
| BLAKE2b-256 |
90fb702c93c029e4687bee4434c99bedccae1c552c9084cf20fc4d0f5462a18f
|
File details
Details for the file multiai-1.3.1-py3-none-any.whl.
File metadata
- Download URL: multiai-1.3.1-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ebe5e2cd422f35f8a1753f62cb185888641d0ce759e1644e6aab12bd084d4dd
|
|
| MD5 |
811e79255a8792ca87a45a2aaf33d4cd
|
|
| BLAKE2b-256 |
834022246bff3e7e92e968ddda43f3dd0fdf6b7eff60d9fdbdb9a05838600d2d
|