Skip to main content

zx2xberry translates ZX Spectrum+ keyboard keypresses into commands for XBerry Pi devices.

Project description

zx2xberry

PyPI version License: MIT Downloads LinkedIn

A Python package that enables users to control their XBerry Pi devices using a ZX Spectrum+ keyboard by translating keypresses into structured commands.

Features

  • Translates ZX Spectrum+ keyboard keypresses into structured commands for XBerry Pi devices
  • Uses LLM7 by default (via langchain_llm7)
  • Supports custom LLM instances from LangChain
  • Free tier of LLM7 has sufficient rate limits for most use cases

Installation

pip install zx2xberry

Usage

Basic Usage

from zx2xberry import zx2xberry

response = zx2xberry("user input describing keypresses")

Using a Custom LLM

You can use any LLM compatible with LangChain. Here are examples with different LLMs:

OpenAI

from langchain_openai import ChatOpenAI
from zx2xberry import zx2xberry

llm = ChatOpenAI()
response = zx2xberry("user input", llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from zx2xberry import zx2xberry

llm = ChatAnthropic()
response = zx2xberry("user input", llm=llm)

Google

from langchain_google_genai import ChatGoogleGenerativeAI
from zx2xberry import zx2xberry

llm = ChatGoogleGenerativeAI()
response = zx2xberry("user input", llm=llm)

Using a Custom API Key

You can provide your own API key for LLM7 either via environment variable or directly:

from zx2xberry import zx2xberry

# Via environment variable
import os
os.environ["LLM7_API_KEY"] = "your_api_key"
response = zx2xberry("user input")

# Directly
response = zx2xberry("user input", api_key="your_api_key")

Parameters

  • user_input (str): The user input text to process
  • llm (Optional[BaseChatModel]): The LangChain LLM instance to use. Defaults to ChatLLM7.
  • api_key (Optional[str]): The API key for LLM7. If not provided, it will use the environment variable LLM7_API_KEY or the default LLM7 key.

Returns

A list of structured commands that the XBerry Pi can interpret and execute.

Getting an LLM7 API Key

You can get a free API key by registering at LLM7.

Issues

If you encounter any issues, please report them on the GitHub issues page.

Author

Eugene Evstafev

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

zx2xberry-2025.12.21201323.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

zx2xberry-2025.12.21201323-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file zx2xberry-2025.12.21201323.tar.gz.

File metadata

  • Download URL: zx2xberry-2025.12.21201323.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for zx2xberry-2025.12.21201323.tar.gz
Algorithm Hash digest
SHA256 ffdf3e0808bf3e5fac569b54c3bc3ebbe9e5bc4572e04fa39bb59ad8a6d2c4ed
MD5 b01d0329324ac010024ad6bf6285ec9a
BLAKE2b-256 f3611d87f6ad4994fca1ca0094aa98aa128026240e04c6c656da1d0f7266458f

See more details on using hashes here.

File details

Details for the file zx2xberry-2025.12.21201323-py3-none-any.whl.

File metadata

File hashes

Hashes for zx2xberry-2025.12.21201323-py3-none-any.whl
Algorithm Hash digest
SHA256 b42496ca3d321173770e49af72b33eae214aa9038cab18026f278f5cb24d8794
MD5 94a015bf831919091024afd099ca2495
BLAKE2b-256 44b4e8f4b414b9eb36445450a1dc87060e01914a13e5930fd451ddeff97da50e

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