Skip to main content

A high-level, stupid-simple Pythonic LiteLLM abstraction layer for implementing simple chat workflows, with tools.

Project description

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.

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

ploppie-0.5.2.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

ploppie-0.5.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file ploppie-0.5.2.tar.gz.

File metadata

  • Download URL: ploppie-0.5.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for ploppie-0.5.2.tar.gz
Algorithm Hash digest
SHA256 c6eec9a25ffe26cab97e2d0395760974becc87cc6d5ea494fe5ebd8a8944835c
MD5 575b7964c2bc752858403e5479dc3cc6
BLAKE2b-256 aa5bfdaf3842a0462085eb7006c7294c580d03a0a6e7da01bd3593bb2256dd34

See more details on using hashes here.

File details

Details for the file ploppie-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: ploppie-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for ploppie-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 142d4305f74909d92eedc2a9180574b2c4563f6242e546aa14f5f7ca2fdc2a78
MD5 2e015e599a27ada8368c80f5471b1cb3
BLAKE2b-256 f6b5f4223e6287b107bcca60b5fc7044bbfe9417036724a6626f682cb3b1d3d6

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