Skip to main content

Extensible LLM provider system

Project description

Prompter: Extensible LLM Provider System

Prompter is a flexible, plugin-style Python framework for working with multiple Large Language Model (LLM) providers. It supports dynamic provider loading, robust error handling, and unified response parsing, making it easy to integrate, extend, and use in any open source or production environment.

Features

  • Plugin-style LLM providers: Easily add or swap providers (OpenAI, Cohere, Anthropic, etc.)
  • Optional SDKs: Only install what you need; clear errors if a provider's SDK is missing
  • Unified response handling: Consistent, type-safe output from all providers
  • Prompting flexibility: Use prompt templates or build prompts programmatically
  • Extensible and testable: Add new providers or prompt strategies with minimal code

Concepts

1. Prompt Creation

  • Template File Way: Define prompts in external template files (e.g., Jinja2, plain text) and load them at runtime. This enables easy prompt management and reuse.
  • Programmatic Way: Build prompts dynamically in code using string formatting, f-strings, or other logic. This is useful for advanced or highly dynamic use cases.

2. Service Providers

  • Each provider (OpenAI, Cohere, Anthropic, etc.) is a class with a unified generate method.
  • Providers are loaded dynamically and only require their SDK if used.
  • All providers support structured output via a result_object parameter, enabling type-safe parsing of LLM responses.

Usage Example

from prompter.providers import OpenAIService

service = OpenAIService(api_key="sk-...", model="gpt-4")
response = service.generate("What is the capital of France?")
print(response)  # "Paris"

Extending

  • Add new providers by subclassing and implementing the generate method.
  • Add new prompt strategies by creating new template loaders or programmatic builders.

License

MIT

Contributing

Pull requests and issues are welcome! Please see CONTRIBUTING.md for guidelines.

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

falat_prompter-0.1.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

falat_prompter-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file falat_prompter-0.1.0.tar.gz.

File metadata

  • Download URL: falat_prompter-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for falat_prompter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1d3f13decef4d1dc839fb3948ea1031b5275f8b7736a10bd4a3903f38e4d55f
MD5 e0f81e4a1eeb3c7d8282c9785bd43a96
BLAKE2b-256 e9cc25e1c7b80c1085988c7381a7a0a5673ac30381430d706a2038f330856ab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for falat_prompter-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on falatform/prompter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file falat_prompter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: falat_prompter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for falat_prompter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faf00e8158c18ffe4256cc0fd1e6eea62868bee676a90fa4e6c76c3f81a686de
MD5 e5be7b51d5de694c22964ac29f8976aa
BLAKE2b-256 8b25ebee9ebc3ddbb5b4b4613afbe0f6644ba584a79fd28cf1819962a1d76daa

See more details on using hashes here.

Provenance

The following attestation bundles were made for falat_prompter-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on falatform/prompter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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