Ploppie
A high-level, stupid-simple Pythonic LiteLLM abstraction layer for implementing simple chat workflows, with tools. Supports vision and audio models. Includes facilities for easy (de)serialization of chat histories.
So stupid that I couldn't come up with a better name.
Installation
pip install ploppie
Example Usage
Simple chat
from ploppie import Chat
chat = Chat()
response = chat.system("You are a helpful assistant.") \
.user("What is the capital of France?") \
.ready()
print(response)
Chat with tools
from ploppie import Chat
chat = Chat(model="gpt-4o-mini")
@chat.tool("Perform mathematical calculations")
def calculate(expression: "str: The expression to calculate"):
return eval(expression)
print(chat.send("What is 2502 * 2502, and 2858 - 28592? Please tell me the results."))
Chat with vision
from ploppie import Chat
from ploppie.messages import Image
chat = Chat(model="gpt-4o-mini")
response = chat.system("You are a helpful assistant.") \
.user(Image(file_handle=open("beautiful_landscape.png", "rb"))) \
.ready()
print(response)
Utility
from ploppie import Utility
from datetime import datetime
utility = Utility(model="gpt-4o-mini")
time_of_day = datetime.now().strftime("%I:%M %p")
print(f"Time of day: {time_of_day}")
response = utility.selector(
f"Pick a color that best matches the sky for this time of day: {time_of_day}",
options=[
"red",
"blue",
"green",
"yellow",
"purple",
"orange",
"pink",
]
)
print(response)
See the examples directory for more information.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ploppie-0.6.1.tar.gz
(13.7 kB
view details)
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
ploppie-0.6.1-py3-none-any.whl
(16.4 kB
view details)
File details
Details for the file ploppie-0.6.1.tar.gz.
File metadata
- Download URL: ploppie-0.6.1.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c53eeb3ce4d855d0f61dcf5cb0dcb217519e7f1b569758e32be43762ac0ee62c
|
|
| MD5 |
e8f58e38fed0bf795323ca39cb0b9477
|
|
| BLAKE2b-256 |
888279a97596edf4c3dabe6252292fd6aa34ccd59847f3ed2802ea65fd52e0bc
|
File details
Details for the file ploppie-0.6.1-py3-none-any.whl.
File metadata
- Download URL: ploppie-0.6.1-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ff45bd1c6c9807c6724832f01806b7d4a229ecb1cf28f570e912683bc175205
|
|
| MD5 |
9f7670aca76c1918a73b4346d4d16843
|
|
| BLAKE2b-256 |
3ca1b9f0d154ca5f6bd963a68ca65af816f4077a60ef191274fd9ae8abd6b3d4
|