promptic  by knowsuchagency

SDK for LLM app development

created 1 year ago
266 stars

Top 96.9% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides a Pythonic interface for building LLM applications, abstracting away complexities and offering features like type-safe structured outputs, agent creation with function calling, streaming, and automatic prompt caching. It targets developers looking for a streamlined and efficient way to integrate LLMs into their projects, aiming to be the go-to tool for LLM app development.

How It Works

Promptic utilizes a decorator-based approach (@llm) to define LLM interactions. Functions decorated with @llm use their docstrings as prompt templates, automatically combining them with function arguments. It leverages LiteLLM for broad LLM provider support, allowing easy switching between models. For structured outputs, it integrates with Pydantic or JSON Schema, and for agentic behavior, functions can be registered as tools callable by the LLM.

Quick Start & Requirements

  • Install via pip: pip install promptic
  • Requires Python 3.7+
  • Supports various LLM providers (OpenAI, Anthropic, Google, etc.) via environment variables or API keys.
  • Official documentation: https://github.com/knowsuchagency/promptic

Highlighted Details

  • Type-safe structured outputs with Pydantic or JSON Schema.
  • Easy agent creation with LLM-invokable tools.
  • Built-in conversation memory and state management (customizable).
  • Automatic prompt caching for supported models.
  • Image input support via ImageBytes for vision-capable models.

Maintenance & Community

  • Actively maintained by knowsuchagency.
  • Contributions are welcome; see CONTRIBUTING.md.

Licensing & Compatibility

  • License: MIT
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

Gemini models do not support streaming when using tools/function calls, a limitation inherited from the underlying provider. For provider-specific features or workarounds, direct interaction with LiteLLM or the provider's SDK may be necessary.

Health Check
Last commit

1 month ago

Responsiveness

1 day

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

Explore Similar Projects

Starred by Carol Willing Carol Willing(Core Contributor to CPython, Jupyter), Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm), and
13 more.

llm by simonw

1.3%
9k
CLI tool and Python library for LLM interaction
created 2 years ago
updated 1 month ago
Feedback? Help us improve.