A Python package that enables users to control their XBerry Pi devices using a ZX Spectrum+ keyboard by translating keypresses into structured commands.
- 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
pip install zx2xberryfrom zx2xberry import zx2xberry
response = zx2xberry("user input describing keypresses")You can use any LLM compatible with LangChain. Here are examples with different LLMs:
from langchain_openai import ChatOpenAI
from zx2xberry import zx2xberry
llm = ChatOpenAI()
response = zx2xberry("user input", llm=llm)from langchain_anthropic import ChatAnthropic
from zx2xberry import zx2xberry
llm = ChatAnthropic()
response = zx2xberry("user input", llm=llm)from langchain_google_genai import ChatGoogleGenerativeAI
from zx2xberry import zx2xberry
llm = ChatGoogleGenerativeAI()
response = zx2xberry("user input", llm=llm)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")user_input(str): The user input text to processllm(Optional[BaseChatModel]): The LangChain LLM instance to use. Defaults toChatLLM7.api_key(Optional[str]): The API key for LLM7. If not provided, it will use the environment variableLLM7_API_KEYor the default LLM7 key.
A list of structured commands that the XBerry Pi can interpret and execute.
You can get a free API key by registering at LLM7.
If you encounter any issues, please report them on the GitHub issues page.
Eugene Evstafev
- Email: hi@eugene.plus
- GitHub: chigwell