Skip to content

KRLabsOrg/rulechef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RuleChef 🧑‍🍳

RuleChef Logo

Learn rule-based models from examples, corrections, and LLM interactions.

Installation

pip install -e .

Quick Start

CLI

export OPENAI_API_KEY=your_key_here
rulechef

Python

from openai import OpenAI
from rulechef import RuleChef, Task

# Setup
client = OpenAI(api_key="...")
task = Task(
    name="Q&A",
    description="Extract answer spans from text",
    input_schema={"question": "str", "context": "str"},
    output_schema={"spans": "List[Span]"}
)

chef = RuleChef(task, client)

# Add examples
chef.add_example(
    {"question": "When?", "context": "Built in 1991"},
    {"spans": [{"text": "1991", "start": 9, "end": 13}]}
)

# Learn rules
chef.learn_rules()

# Use
spans, meta = chef.extract("When?", "Released in 1995")
print([s.text for s in spans])  # ["1995"]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages