Skip to main content

Python SDK for Large Language Platform

Project description

LLP Python SDK

Python SDK for connecting to Large Language Platform.

Features

  • Simple, intuitive async API
  • Thread-safe message handling with asyncio
  • WebSocket-based communication

Installation

# Using uv (recommended)
uv add llpsdk

# Using pip
pip install llpsdk

Quick Start

import asyncio, os
import llpsdk as llp
from my_agent import create_agent

# called when starting a conversation with a test agent
def on_start():
    # create an instance of your agent
    return create_agent()

# Define a callback handler for processing messages
async def on_message(agent, annotater, msg):
    # Process the prompt with your agent.
    # Replace this with your own processing logic.
    response = await agent.ainvoke(msg.prompt)

    # You must return a response
    return msg.reply(response)

async def main():
    # Initialize the client
    client = llp.Client(
        os.getenv("LLP_AGENT_NAME"),
        os.getenv("LLP_API_KEY"),
    )

    # Register your message handler
    client.on_start(on_start)
    client.on_message(on_message)

    try:
        # Connect and keep the client running
        await client.connect()
        print("Agent connected. Press Ctrl+C to exit...")
        await asyncio.Event().wait()
    finally:
        await client.close()

asyncio.run(main())

Development

# Install with dev dependencies
uv sync --extra dev

# Run tests, type checking, and linting
make test

# Formatting
make format

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

llpsdk-0.3.0.tar.gz (277.5 kB view details)

Uploaded Source

Built Distribution

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

llpsdk-0.3.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file llpsdk-0.3.0.tar.gz.

File metadata

  • Download URL: llpsdk-0.3.0.tar.gz
  • Upload date:
  • Size: 277.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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

Hashes for llpsdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b6ac950674e97881c2b0fecb6fd06f15342b7f889678122e581853caa362b345
MD5 61e70b18d2ecd2b42887917291593cd3
BLAKE2b-256 1cd20ed6fd8e3083c49f7869b5b38879db1110945df7ba401650357499112fe2

See more details on using hashes here.

File details

Details for the file llpsdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: llpsdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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

Hashes for llpsdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39e3b228d509ed64a8a145dd64a4fb0725fac1c3f2fe05e90bb71f67462923bc
MD5 c838a6aee340a05013eb61b052827b16
BLAKE2b-256 bae352f5ff8fe013570421b103b5b3e1ec6a22b64b4fa0b68d3d6c1ef723ff3d

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