update readme
This commit is contained in:
95
README.md
95
README.md
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
regspy is a regex pattern generator, you enter some data -> select what you want matched and or not matched -> ??? -> Pattern!
|
regspy is a regex pattern generator, you enter some data -> select what you want matched and or not matched -> ??? -> Pattern!
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
This project started as me trying to learn dspy, its vibe coded to shit and back but it works and has some accomplishments:
|
This project started as me trying to learn dspy, its vibe coded to shit and back but it works and has some accomplishments:
|
||||||
- Runs on small models with 3B parameter at a minimum, so it should run on anything.
|
- Runs on small models with 3B parameter at a minimum, so it should run on anything.
|
||||||
@@ -36,7 +36,7 @@ But if you're a everyday smooth brain like me that needs a simple pattern on the
|
|||||||
- **AutoHotkey v2.0** - [Download](https://www.autohotkey.com/)
|
- **AutoHotkey v2.0** - [Download](https://www.autohotkey.com/)
|
||||||
- **Python Libs**:
|
- **Python Libs**:
|
||||||
```bash
|
```bash
|
||||||
pip install dspy grex ollama
|
pip install dspy grex ollama modaic
|
||||||
```
|
```
|
||||||
- **Ollama**:
|
- **Ollama**:
|
||||||
```bash
|
```bash
|
||||||
@@ -48,27 +48,6 @@ But if you're a everyday smooth brain like me that needs a simple pattern on the
|
|||||||
AutoHotkey64.exe regspy.ahk # Or just double click regspy.ahk
|
AutoHotkey64.exe regspy.ahk # Or just double click regspy.ahk
|
||||||
```
|
```
|
||||||
|
|
||||||
### CLI flags
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Run test suite
|
|
||||||
python regexgen.py --test
|
|
||||||
|
|
||||||
# Pre-compile for faster runtime
|
|
||||||
python regexgen.py --compile
|
|
||||||
|
|
||||||
# Generate regex from JSON input
|
|
||||||
python regexgen.py input.json output.json
|
|
||||||
|
|
||||||
# With custom config
|
|
||||||
python regexgen.py input.json output.json --config config.json
|
|
||||||
|
|
||||||
# Dataset management
|
|
||||||
python regexgen.py --list-dataset output.json
|
|
||||||
python regexgen.py --add-example example.json
|
|
||||||
python regexgen.py --delete-example <index>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -90,4 +69,72 @@ The Config tab allows session-level adjustments:
|
|||||||
- **Max Attempts**: Refinement iterations (default: 10)
|
- **Max Attempts**: Refinement iterations (default: 10)
|
||||||
- **Reward Threshold**: Stop early if score exceeds (default: 0.85)
|
- **Reward Threshold**: Stop early if score exceeds (default: 0.85)
|
||||||
- **Scoring Weights**: Adjust the 5 criteria weights
|
- **Scoring Weights**: Adjust the 5 criteria weights
|
||||||
- **Context Window** (`num_ctx`): Ollama context size (default: 8192). Ollama defaults to 4096 which can truncate prompts with many training examples. If you see "truncating input prompt" warnings in Ollama logs, bump this up. Uses ~200MB extra VRAM per 4K increase on 3B models.
|
- **Context Window** (`num_ctx`): Ollama context size (default: 8192). Ollama defaults to 4096 which can truncate prompts with many training examples. If you see "truncating input prompt" warnings in Ollama logs, bump this up. Uses ~200MB extra VRAM per 4K increase on 3B models.
|
||||||
|
|
||||||
|
## Modaic Hub
|
||||||
|
|
||||||
|
RegSpy uses Modaic's `PrecompiledProgram` so you can publish and load programs with bundled prompts, config, and optionally code.
|
||||||
|
|
||||||
|
### Push to Modaic Hub
|
||||||
|
|
||||||
|
Use the helper script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
uv run push.py your-username/regspy --with-code
|
||||||
|
```
|
||||||
|
|
||||||
|
Or directly in Python:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from regspy import RegexConfig, RegexProgram
|
||||||
|
|
||||||
|
program = RegexProgram(RegexConfig())
|
||||||
|
program.push_to_hub("me/regspy", with_code=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
### DSPy Programs: Auto Classes
|
||||||
|
|
||||||
|
Load a program:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from modaic import AutoProgram
|
||||||
|
|
||||||
|
program = AutoProgram.from_precompiled("raet/regspy")
|
||||||
|
```
|
||||||
|
|
||||||
|
Load a config:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from modaic import AutoConfig
|
||||||
|
|
||||||
|
config = AutoConfig.from_precompiled("raet/regspy")
|
||||||
|
```
|
||||||
|
|
||||||
|
Override a config:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from modaic import AutoProgram
|
||||||
|
|
||||||
|
program = AutoProgram.from_precompiled(
|
||||||
|
"raet/regspy",
|
||||||
|
config={"use_cot": False, "temperature": 0.2},
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Specify runtime parameters:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from modaic import AutoProgram
|
||||||
|
|
||||||
|
program = AutoProgram.from_precompiled("raet/regspy", timeout=60)
|
||||||
|
```
|
||||||
|
|
||||||
|
Load a specific revision:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from modaic import AutoProgram
|
||||||
|
|
||||||
|
program = AutoProgram.from_precompiled("raet/regspy", rev="dev")
|
||||||
|
program = AutoProgram.from_precompiled("raet/regspy", rev="v1.0")
|
||||||
|
program = AutoProgram.from_precompiled("raet/regspy", rev="918ad95")
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user