Skip to main content

A Python client for interacting with llamafile local LLM instances

Project description

llmfastdev

A Python client for interacting with llamafile local LLM instances.

Installation

pip install llmfastdev

Usage

from llmfastdev import LlamafileClient

# Initialize the client
client = LlamafileClient("http://localhost:8080")

# Check if server is running
if client.health_check():
    print("Server is running!")

# Generate a completion
response = client.complete("Hello, how are you?", max_tokens=50)
print(response)

# Use chat format
messages = [
    {"role": "user", "content": "What is the capital of France?"}
]
response = client.chat(messages, max_tokens=50)
print(response)

# Stream completion
for token in client.stream_completion("Tell me a story", max_tokens=100):
    print(token, end="", flush=True)

Features

  • Simple HTTP client for llamafile servers
  • Support for completion and chat endpoints
  • Streaming support
  • Context manager support
  • Health check functionality
  • Model information retrieval

Requirements

  • Python >= 3.7
  • requests >= 2.25.0

License

MIT

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

llmfastdev-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

llmfastdev-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file llmfastdev-0.0.1.tar.gz.

File metadata

  • Download URL: llmfastdev-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for llmfastdev-0.0.1.tar.gz
Algorithm Hash digest
SHA256 557fcebbc0137ed3815eb956d57df23f36a145602f3b592d3c87313b574a0b3d
MD5 aed2525943fc733a3a9d070b213020ea
BLAKE2b-256 ef97c1f7d2a808798f34e4018c8c8e7f995b10cb1d6970b3a5f7e52b5e6045bb

See more details on using hashes here.

File details

Details for the file llmfastdev-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: llmfastdev-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for llmfastdev-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5459e1ae93fe53c22d92676cf697c29e7777b1523af03c87118514b5bc4a2d5e
MD5 05bc31270620dc2805f3490495420700
BLAKE2b-256 4a88744adbc8bf4eec080bdc63ff7549d2194732bc98369de15245dd90d6bfdb

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