Skip to main content

A lightweight LLM wrapper that unifies prompt, RAG and multi-provider calls

Project description

EasyLLM

中文文档 🇨🇳
PyPI License: MIT Stars

EasyLLM is a lightweight LLM wrapper library that helps you interact with large language models in the most intuitive and natural way.
Whether it's prompt engineering, structured output, or multi-vendor model access, EasyLLM is designed to make development simpler and more enjoyable.


🚀 Features

  • 🔁 Unified Interface: Supports multiple model providers (OpenAI, DeepSeek, Moonshot, Kimi, Claude, etc.) with consistent API usage.
  • 🧠 Prompt-as-Content: Write prompts in Markdown + Jinja2 instead of verbose messages dictionaries.
  • 🧩 Structured Output Support: Enable JSON-mode to receive structured responses from models — great for product integration.
  • 🛠️ Easy Integration: Minimal dependencies, easily embedded into any Python project with no learning curve.

📦 Installation

pip install python-easy-llm==0.1.2

✨ Quick Example: Calling an LLM

from easyllm import LLM
import os

llm = LLM(
    model_name="deepseek-chat",
    model_provider="deepseek",
    api_key=os.environ["DEEPSEEK_API_KEY"]
)

response = llm("What is 1 + 1?")
print(response)

📄 Example: Structured Output + Jinja2 Prompt Template

from jinja2 import Template
from easyllm import LLM
import os

llm = LLM(
    model_name="deepseek-chat",
    model_provider="deepseek",
    api_key=os.environ["DEEPSEEK_API_KEY"]
)

prompt_t = Template("""
# System
You are a {{ domain }} assistant. Based on the user's interests and skills, recommend a suitable career path. Please respond in JSON format:
{
  "recommended_job": string,
  "reason": string
}

# User
I'm interested in tech, enjoy programming, and I'm introverted with average communication skills. What job is a good fit for me?
""")

prompt = prompt_t.render(domain="career recommendation")
response = llm(prompt, json_mode=True)
print(response)

Sample output:

{
  "recommended_job": "Backend Developer",
  "reason": "You enjoy programming, have strong technical interests, and prefer limited interpersonal interaction. Backend development is a great fit for focusing on system logic and architecture."
}

🔄 Prompt Style Comparison

Framework Prompt Structure Complexity Readability
OpenAI SDK messages=[...] ⭐⭐
LangChain ChatPromptTemplate ⭐⭐⭐⭐ ⭐⭐
EasyLLM Markdown + Jinja2 ✅✅✅

✅ Recommended EasyLLM Style

from jinja2 import Template

prompt_t = Template("""
# System
You are a {{ domain }} assistant who helps users solve their problems.
# User
What is 1 + 1?
""")

response = llm(prompt_t.render(domain="math"))
print(response)

🔧 Roadmap / TODO

  • Built-in prompt versioning and template storage
  • Visual Prompt Editor (Prompt Studio)
  • Additional providers (e.g., Tongyi, Zhipu AI, Baichuan)

❤️ Contributing

We welcome contributions from the community! You can:

  • Open issues or submit PRs
  • Suggest new prompt templates
  • Help improve the documentation or examples

👉 Don’t forget to ⭐️ the repo to support its growth!


📄 License

MIT License © 2025 [Chunyou Peng]


📬 Contact


⭐️ Project Vision

"We aim to make EasyLLM the most intuitive tool for building Chinese LLM applications — writing prompts should feel as natural as writing Markdown."

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

python_easy_llm-0.1.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

python_easy_llm-0.1.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file python_easy_llm-0.1.2.tar.gz.

File metadata

  • Download URL: python_easy_llm-0.1.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for python_easy_llm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cb3fcf51956b3117b0493b4e1bccf1e3de72eb88bb04fc30336de6d214528b0b
MD5 b338ffcf2d395887858dbf3ddc8c4df1
BLAKE2b-256 72ec6213f251a6b543f9e9ca2a93d094e6602199c84f890d17fc31f7f42b5b96

See more details on using hashes here.

File details

Details for the file python_easy_llm-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_easy_llm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 274c7a330f5097e1289be35df962b9d9abcf640dd92c20f4b457a3b9aaebbfda
MD5 d550b952efa8a788a6cc2b73839dff66
BLAKE2b-256 507e467dd4a583e0589ee41bcccc19d90f15505e05e11c3fedf022a718a407f7

See more details on using hashes here.

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