Skip to main content

polimind

An extensible Python toolkit for AI capabilities. Its current public OpenAI interface lives under polimind.api.openai and preserves the existing chat, history, multimodal, and metrics workflow.

Features

  • Centralized Client: Use a single Client to manage your connection and spawn multiple chat sessions.
  • Variadic Chat Interface: Send multiple message components directly: chat.chat("Text", Image("local.png"), "More text").
  • Node-Based History: Every interaction is a node with an incremental ID.
  • Context Control: Activate or deactivate conversation nodes by their ID to manage the model's window.
  • Enhanced Metrics: Track token usage, models, and active nodes per request with built-in Pandas integration.
  • Multimodal Support: Handle local images (auto-base64 encoding) and remote URLs seamlessly.
  • State Persistence: Save Chat states and load them via the Client to resume sessions.
  • Deep Copy: Create independent clones of your chat session.

Installation

# Via Pip (once published)
pip install polimind

# From source
git clone https://github.com/artitzco/openai-api.git
cd openai-api
pip install .

Quick Start

from polimind.api.openai import Client, Image

# Initialize the main client
client = Client(api_key="your-api-key") # or use OPENAI_API_KEY env var

# Start a new chat session
chat = client.chat(model="gpt-4o-mini", system_prompt="You are a helpful assistant.")

# Basic Chat
response = chat.chat("Hello! What can you do?")
print(response)

# Multimodal Chat (Local and URL)
chat.chat(
    "Analyze these images:",
    Image("path/to/local_image.png"),
    "and also this one:",
    Image("https://example.com/image.jpg")
)

# Manage History
df_history = chat.history.to_dataframe()
chat.history.toggle(node_id=1, active=False) # Context management

# Persistence
chat.save("my_session.json")
new_chat_recovered = client.load_chat("my_session.json")

Project Structure

  • src/polimind/: Root package for the project.
  • src/polimind/api/openai/: OpenAI integration exposed by the package.
    • __init__.py: Contains the Client factory and exports.
    • core.py: Contains the Chat session manager.
    • history.py: Logic for node-based conversation management.
    • metrics.py: Token usage and request tracking.
    • content.py: Multimodal data builders (Images, etc.).
  • notebooks/: Interactive guides and testing playgrounds.
  • img/: Storage for sample assets.
  • output/: Default location for saved session JSONs.

License

MIT

Metadata

Release files for polimind 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polimind 0.1.0
File Size Uploaded Provenance Actions
polimind-0.1.0.tar.gz 11.1 kB Without provenance Details for polimind-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polimind 0.1.0
File Interpreter ABI Platform Actions
polimind-0.1.0-py3-none-any.whl Python 3 none any Details for polimind-0.1.0-py3-none-any.whl

Total release size: 22.9 kB

Release files / polimind-0.1.0.tar.gz

Download URL polimind-0.1.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7f54d7d9e5b26626584f9f07f946a5da1dde952ad8ff72da75a06da194fa2a12
BLAKE2b-256 checksum
How to use checksums
dc0d26bf3a1b291631054a39d37244692ee79226441c714c380235898b4f214c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / polimind-0.1.0-py3-none-any.whl

Download URL polimind-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04bfe438c91101079f47142f5f9af4964b8bb181645407d09acacf9137674b3d
BLAKE2b-256 checksum
How to use checksums
7c52cce1a0cb9d800afbdc6f3a0e7043a94b87667cf4a6d5655ed7b33311cc0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for polimind 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page