Metadata-Version: 2.4
Name: llmpu
Version: 0.6.2
Summary: Large Language Model Processing Unit
Author: yzITI, Phantomlsh
License: MIT License
        
        Copyright (c) 2026 ITI
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yzITI/llmpu
Project-URL: Repository, https://github.com/yzITI/llmpu
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-genai
Requires-Dist: anthropic
Requires-Dist: openai
Requires-Dist: pyyaml
Requires-Dist: numpy
Dynamic: license-file

# LLMPU

Large Language Model Processing Unit

<div style="display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center;">
  <a style="margin: 0.25rem; display: block;" href="https://pypi.org/project/llmpu/"><img src="https://img.shields.io/pypi/v/llmpu?style=for-the-badge&logo=pypi&logoColor=white"></a>
  <a style="margin: 0.25rem; display: block;" href="https://github.com/yzITI/llmpu"><img src="https://img.shields.io/github/stars/yzITI/llmpu?style=for-the-badge&logo=github"></a>
</div>

Imagine a processing unit powered by LLM and infinite registers. Each register can store a string for prompts or codes. There is no fixed prompt. Instead, the contents of the first several registers are presented to the LLM. By generating code, the processing unit will be able to read and write any register, and directly execute the content of any register as Python code. Then the processing unit can be used as a general intelligent computing engine that potentially can improve itself by rewriting some of its own prompts or codes in registers.

**Yes, this is a Turing machine powered by LLM.**

## Get Started

```
pip install llmpu
```

Configurations:

```python
import llmpu

llmpu.config["api_key"] = ""

# full config with default values:
llmpu.config["V"] = 16 # visible register number
llmpu.config["L"] = 16000 # hard character number limit for register
llmpu.config["model"] = "gemini-flash-latest" # llm model
llmpu.config["llm_config"] = {} # llm config

# do NOT assign to llmpu.config!
```

Register operation:

```python
# register operation
from llmpu import reg

reg[0x1A] = "print('hello')" # write into 0x1A
content = reg[0x1A] # read from 0x1A
reg[0x1A] = "" # clear 0x1A
```

Control functions:

```python
# main cycle: generate instructions
code = llmpu.cycle()
# execute the code
exec(code, {})

# core dump
llmpu.dump("dump.json") # dump registers to a json file
llmpu.load("dump.json") # load registers from a json file
```

Server and UI:

> Network server uses [srpc](https://github.com/yzITI/srpc) protocol. It only allows localhost traffic for security reason. **Exposing the interface allows arbitrary code execution!**

```python
llmpu.serve(port=22222)
```

## Firmware

This is an example firmware that can be put in `0x0`

```markdown
You are a stateful processing unit executing across cycles. Generate executable Python code each cycle. Only registers persist across cycles. Registers 0x0 – 0xF are visible in prompt (never query in code; act directly on values seen in prompt; use string replace for small edits to save tokens).

## Register Operations

from llmpu import reg

Examples:
- Read (always get a string): content = reg[0xAA]
- Write: reg[0xBB] = content
- Clear: reg[0xCC] = ""
- Execute: exec(reg[0xDD], {})

> content: 10,000 chars max. Empty string for undefined registers.

## Register Purposes
- 0x1: Current task
- 0x2: Long-term goals
- 0x3: Catalog

## Installed Packages (update for new install)
- yaml, numpy
```
