Skip to content

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

Notifications You must be signed in to change notification settings

chigwell/zx2xberry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages