simpleaichat  by minimaxir

Python SDK for streamlined chat app integration (ChatGPT, GPT-4)

created 2 years ago
3,521 stars

Top 14.0% on sourcepulse

GitHubView on GitHub
Project Summary

This Python package provides a streamlined interface for interacting with chat-based AI models, primarily OpenAI's ChatGPT. It targets developers and researchers seeking to integrate AI chat capabilities into applications with minimal complexity, offering optimized workflows for cost and latency reduction, and supporting advanced features like streaming, tool usage, and asynchronous operations.

How It Works

The library utilizes a simple AIChat class that manages chat sessions, allowing for multiple independent conversations. It emphasizes a minimal codebase and clear design, enabling users to define AI behavior through system prompts and leverage features like tool integration (similar to ChatGPT plugins) and structured input/output via Pydantic schemas. This approach aims for flexibility and ease of maintenance, avoiding the complexity of larger frameworks.

Quick Start & Requirements

  • Install via pip: pip3 install simpleaichat
  • Requires an OpenAI API key.
  • Supports Python 3.x.
  • Official documentation and examples are available via provided Colab links.

Highlighted Details

  • Optimized workflows for reduced token usage, cost, and latency.
  • Supports streaming responses and tool usage (e.g., Wikipedia search).
  • Enables structured data I/O using Pydantic schemas.
  • Asynchronous support for concurrent chat operations.

Maintenance & Community

  • Maintained by Max Woolf (@minimaxir).
  • Support is available via Patreon and GitHub Sponsors.
  • Roadmap includes support for PaLM Chat, Claude, and CLI/web app examples.

Licensing & Compatibility

  • MIT License.
  • Permissive for commercial use and integration with closed-source applications.

Limitations & Caveats

The library does not address inherent LLM issues like prompt injection or plagiarism. Token counts for async streaming are not supported due to API limitations. Users are advised to exercise caution and adhere to OpenAI's usage policies.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
16 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.