LLMfy is a flexible and developer-friendly framework designed to streamline the creation of applications powered by large language models (LLMs). It provides essential tools and abstractions that simplify the integration, orchestration, and management of LLMs across various use cases, enabling developers to focus on building intelligent, context-aware solutions without getting bogged down in low-level model handling. With support for modular components, prompt engineering, and extensibility, LLMfy accelerates the development of AI-driven applications from prototyping to production.
See complete documentation at https://llmfy.readthedocs.io/
How to install
- Optional Library:
- Install anthropic to use Anthropic Claude models (native Messages API) — 🔸 optional.
- Install openai to use OpenAI models — 🔸 optional.
- Install boto3 to use AWS Bedrock models — 🔸 optional.
- Install google-genai to use Google AI (Gemini) models — 🔸 optional.
- Install numpy to use Embedding — 🔸 optional.
- Install typing_extensions to use state in
FlowEngine— 🔸 optional. - Install redis to use
RedisCheckpointer— 🔸 optional. - Install SQLAlchemy to use
SQLCheckpointer— 🔸 optional.SQLCheckpointersupports both sync and async drivers for multiple databases:
Using UV
uv add llmfy
Using pip
pip install llmfy
Using github
From a specific branch
# main
uv add git+https://github.com/llmfy-labs/llmfy-python.git@main
# or
pip install git+https://github.com/llmfy-labs/llmfy-python.git@main
# dev
uv add git+https://github.com/llmfy-labs/llmfy-python.git@dev
# or
pip install git+https://github.com/llmfy-labs/llmfy-python.git@dev
From a tag
# example tag version 0.4.3
uv add git+https://github.com/llmfy-labs/llmfy-python.git@v0.4.3
# or
pip install git+https://github.com/llmfy-labs/llmfy-python.git@v0.4.3
Github in requirements.txt
git+https://github.com/llmfy-labs/llmfy-python.git@dev
How to use
Model class names follow <Vendor><APIVariant>Model — e.g. OpenAIChatModel vs OpenAIResponsesModel for OpenAI's two APIs, GoogleAIGenerateModel for Google's generate_content API — so the class name always tells you which API it talks to.
Anthropic models
To use AnthropicMessagesModel (native Messages API), requires install "llmfy[anthropic]" and add below config to your env (or pass api_key= to the model instead):
ANTHROPIC_API_KEY
OpenAI models
To use OpenAIChatModel (Chat Completions) or OpenAIResponsesModel (Responses API), requires install "llmfy[openai]" and add below config to your env (or pass api_key= to the model instead):
OPENAI_API_KEY
AWS Bedrock models
To use BedrockConverseModel, requires install "llmfy[boto3]" and add below config to your env (or pass aws_access_key_id=, aws_secret_access_key=, aws_bedrock_region= to BedrockConverseModel instead):
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_BEDROCK_REGION
Google AI models
To use GoogleAIGenerateModel, requires install "llmfy[google-genai]" and add below config to your env (or pass api_key= to GoogleAIGenerateModel instead):
GOOGLE_API_KEY
Example
LLMfy Example
from llmfy import (
OpenAIChatModel,
OpenAIChatConfig,
LLMfy,
Message,
Role,
LLMfyException,
)
def sample_prompt():
info = """Irufano adalah seorang software engineer.
Dia berasal dari Indonesia.
Kamu bisa mengunjungi websitenya di https:://irufano.github.io"""
# Configuration
config = OpenAIChatConfig(temperature=0.7)
llm = OpenAIChatModel(model="gpt-4o-mini", config=config)
SYSTEM_PROMPT = """Answer any user questions based solely on the data below:
<data>
{info}
</data>
DO NOT response outside context."""
# Initialize framework
framework = LLMfy(llm, system_message=SYSTEM_PROMPT, input_variables=["info"])
try:
messages = [Message(role=Role.USER, content="apa ibukota china")]
response = framework.invoke(messages, info=info)
print(f"\n>> {response.result.content}\n")
except LLMfyException as e:
print(f"{e}")
if __name__ == "__main__":
sample_prompt()
Contributing
See CONTRIBUTING.md for commit message format, the automatic version-bump/release process, local package/docs development commands, and the required testing policy for every change.
Metadata
Release files for llmfy 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llmfy-0.11.0.tar.gz | 1.5 MB | Without provenance | Details for llmfy-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmfy-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for llmfy-0.11.0-py3-none-any.whl |
Total release size: 3.0 MB
Release files / llmfy-0.11.0.tar.gz
| Download URL | llmfy-0.11.0.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a62efefda8ee1c5dac21af8d6755d17cb279614baeeadaf54e09e1ffdc1ec8e
|
|
BLAKE2b-256 checksum How to use checksums |
874879779337a6a96281514965a7d0dc80b24edc73c28eead65ac30d291577b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llmfy-0.11.0-py3-none-any.whl
| Download URL | llmfy-0.11.0-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48d92b3a547ca43e4cd6596c7630b40ba30ce7e3362d46be17d625c4cb5cddd9
|
|
BLAKE2b-256 checksum How to use checksums |
cc92ce5ad76a6b4aaf1df5e89dd94d251a60d575f33e18d2671bc8784d68a678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llmfy 0.11.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.