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, and local package/docs development commands.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmfy-0.10.1.tar.gz.
File metadata
- Download URL: llmfy-0.10.1.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daac2ee16de65d571bb22f191cb7d935805d6f28b4b62458e310c1b085bde0b1
|
|
| MD5 |
d7f159ac25bfff86219b33447ba92829
|
|
| BLAKE2b-256 |
8c8640a88f9e0c9e30e9d7063dd3c312235691e698c35fe66cc1ef470112f522
|
File details
Details for the file llmfy-0.10.1-py3-none-any.whl.
File metadata
- Download URL: llmfy-0.10.1-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a50d1cd1b45aadb16a298a113f64ac6b2e5de3deed854e2af3aec2bac5fb1e33
|
|
| MD5 |
cca7b46dfc0fbf092cdfcf706558d20c
|
|
| BLAKE2b-256 |
06e6023f96532108c8b78dedeb88a3380ae805c846547230a2a3ff00b233a0d3
|