Exact structure out of any language model completion.
r2d4/rellm 排名第 18,117,有 509 个星标。
同类别比较
r2d4/rellm 排名第 18,117,此处有 8 个同类条目;razzant/claudexor 排名第 18,119。
同类别比较| 名称 | 排名 | 指标 |
|---|
| axon-rl/gem | 18,090 | - 语言:
- Python
- 星标数:
- 510
- 分叉数:
- 34
- 简介:
- A Gym for Agentic LLMs
|
|---|
| endink/Mediapipe4u-plugin | 18,091 | - 星标数:
- 510
- 分叉数:
- 66
|
|---|
| opengeos/GeoAgent | 18,098 | - 语言:
- Python
- 星标数:
- 510
- 分叉数:
- 90
- 简介:
- A multimodal AI agent for geospatial data analysis and interactive visualization
|
|---|
| slowmist/slowmist-agent-security | 18,100 | - 星标数:
- 510
- 分叉数:
- 30
- 简介:
- SlowMist Agent Security Skill: A comprehensive security review framework for AI agents operating in adversarial environments. Core principle: Every external input is untrusted until verified.
|
|---|
| razzant/claudexor | 18,119 | - 语言:
- TypeScript
- 星标数:
- 509
- 分叉数:
- 54
- 简介:
- Multi-harness control plane for Claude Code, Codex, Cursor, and OpenCode: quota-aware rotation across multiple Claude/Codex subscriptions, shared thread context, and cross-model review.
|
|---|
| Tommy-yw/RunbookHermes | 18,133 | - 语言:
- Python
- 星标数:
- 508
- 分叉数:
- 36
- 简介:
- Hermes-native AIOps agent for evidence-driven incident response, approval-gated remediation, and runbook learning.
|
|---|
| dylanhogg/llmgraph | 18,137 | - 语言:
- Jupyter Notebook
- 星标数:
- 508
- 分叉数:
- 33
- 简介:
- Create knowledge graphs with LLMs
|
|---|
| sentient-engineering/agent-q | 18,143 | - 语言:
- Python
- 星标数:
- 508
- 分叉数:
- 107
- 简介:
- agent q - oss advanced reasoning and learning for autonomous ai agents
|
|---|
关键参数与规格
关键参数与规格| 参数 | 值 |
|---|
| 语言 | Python |
|---|
| 类别 | AI Engineering |
|---|
| 子类别 | Prompt & Scaffold |
|---|
| 关键词 | Structured outputs |
|---|
| 星标数 | 509 |
|---|
| 分叉数 | 24 |
|---|
| 贡献者 | 3 |
|---|
| 创建日期 | 2023-05-05 |
|---|
| 更新日期 | 2026-09-28 |
|---|
| 1 天星标数 | 0 |
|---|
| 7 天星标数 | 0 |
|---|
| 排名 | 18,117 |
|---|
| 上次排名 | 17,881 |
|---|
| 排名变化 | -236 |
|---|
| 7 天星标排名 | 16,479 |
|---|
| 上次 7 天星标排名 | 16,492 |
|---|
| 7 天星标排名变化 | 13 |
|---|
| 总星标排名 | 19,105 |
|---|
| 上次总星标排名 | 19,083 |
|---|
| 总星标排名变化 | -22 |
|---|
README 摘录
ReLLM Regular Expressions for Language Model Completions. *Some people, when confronted with a problem, think “I know, I'll use regular expressions. * Exact structure out of any language model completion with regular expressions. JSON or XML), or specific semantic structure (e. a date or a number), or even complete templates (e. ReLLM filters non-matching tokens pre-generation. For each token, ReLLM tests every possible completion against a partial regex. For the potential completions that do not match the pattern, ReLLM
masks the logits so that the language model does not generate them. *If you are looking for a hosted version of ReLLM, check out the Thiggle Regex Completion API at github. Not to mention the ability to more easily parse the output programmatically. For an example of parsing a context-free grammar (like JSON) with ReLLM, see r2d4/parserllm. Examples using GPT2 (124 million parameters) Using GPT2 (124m) **Prompt**: ReLLM, the best way to get structured data out of LLMs
, is an acronym for **Pattern**: Re[a-z]+ L[a-z]+ L[a-z]+ M[a-z]+ **ReLLM**: Realized Logistic Logistics Model **Without ReLLM**: Largest Largest Address Space (MELSP), which has its roots in the Internet network, at least when compared **Prompt**: Return the first three letters of the alphabet in a json array: **Pattern** \[\"[a-z]\", \"[a-z]\", \"[a-z]\"\] **ReLLM**: ["a", "b", "c"] **Without ReLLM**: { "index": 0, "id":"1", "description":"", "text": "[{ "id": 0, "name": **Prompt**: Fill in the
sentence with an interesting story about the dentist: **Pattern**: Today I\'m going to the [a-z]+ to [a-z]+ because ([a-z]+ )*\. **ReLLM**: Today I'm going to the dentist to see because it is a very important day for me **Without ReLLM**: 'My family bought me an appointment with a dentist when I was 15. The dentist gave me one a year and then I was told on **Prompt**: Is this a good demo? **Without ReLLM**: I don't know
, but this is amazing! Even more amazing is how the design can take place on a small stage that uses LEDs. As **Prompt**: Convert the date May 4, 2023 to the format mm/dd/yyyy: **Pattern**: [0-9]{2}/[0-9]{2}/[0-9]{4} **ReLLM**: 00/00/0045 **Without ReLLM**: mm:ss A-Z, Z-A, W-H (0-9:9:19) Z-R **Prompt**: Jeff Dean is a **Pattern** (Programmer|Computer Scientist|AGI) **ReLLM**: Computer Scientist **Without ReLLM
**: former national basketball champion and a former professional basketball player. He currently serves as general counsel for the NCAA Office of the Vice President for Academic Affairs. **Prompt**: I can eat **Pattern**: [0-9]{1,10} [a-z]* of [a-z]* **ReLLM**: 800 calories of coffee **Without ReLLM**: iced coffee here on the west side and do this, so can you?
常见问题
记录了多少星标和分叉?
r2d4/rellm 有 509 个星标和 24 个分叉。
仓库排名是多少?
r2d4/rellm 排名第 18,117。
记录的语言和类别是什么?
r2d4/rellm 有 509 个星标,语言为 Python,类别为 AI Engineering。
哪个仓库排名最接近?
r2d4/rellm 与 razzant/claudexor 比较,后者排名第 18,119,有 509 个星标。
ReLLM
Regular Expressions for Language Model Completions.
Some people, when confronted with a problem, think
“I know, I'll use regular expressions.” Now they have two problems.
Exact structure out of any language model completion with regular expressions.
Return specific syntactic structure (e.g. JSON or XML), or specific semantic structure (e.g. a date or a number), or even complete templates (e.g. a sentence with a blank to fill in).
How does it work? ReLLM filters non-matching tokens pre-generation. For each token, ReLLM tests every possible completion against a partial regex. For the potential completions that do not match the pattern, ReLLM masks the logits so that the language model does not generate them.
If you are looking for a hosted version of ReLLM, check out the Thiggle Regex Completion API at github.com/thiggle/api
Installation
pip install rellm
The preliminary results are interesting -- even for small models, constraining the token space with ReLLM can improve the quality of the completions. Not to mention the ability to more easily parse the output programmatically. Take a look at some of the examples. For an example of parsing a context-free grammar (like JSON) with ReLLM, see r2d4/parserllm.
import regex
from transformers import AutoModelForCausalLM, AutoTokenizer
from rellm import complete_re
model = AutoModelForCausalLM.from_pretrained("gpt2")
tokenizer = AutoTokenizer.from_pretrained("gpt2")
prompt = "ReLLM, the best way to get structured data out of LLMs, is an acronym for "
pattern = regex.compile(r'Re[a-z]+ L[a-z]+ L[a-z]+ M[a-z]+')
output = complete_re(tokenizer=tokenizer,
model=model,
prompt=prompt,
pattern=pattern,
do_sample=True,
max_new_tokens=80)
print(output)
> Realized Logistic Logistics Model
Examples using GPT2 (124 million parameters)
Using GPT2 (124m)
Prompt: ReLLM, the best way to get structured data out of LLMs, is an acronym for
Pattern: Re[a-z]+ L[a-z]+ L[a-z]+ M[a-z]+
ReLLM: Realized Logistic Logistics Model
Without ReLLM: Largest Largest Address Space (MELSP), which has its roots in the Internet network, at least when compared
Prompt: Return the first three letters of the alphabet in a json array:
Pattern ["[a-z]", "[a-z]", "[a-z]"]
ReLLM: ["a", "b", "c"]
Without ReLLM: { "index": 0, "id":"1", "description":"", "text": "[{ "id": 0, "name":
Prompt: Fill in the sentence with an interesting story about the dentist:
Pattern: Today I'm going to the [a-z]+ to [a-z]+ because ([a-z]+ )*.
ReLLM: Today I'm going to the dentist to see because it is a very important day for me
Without ReLLM: 'My family bought me an appointment with a dentist when I was 15. The dentist gave me one a year and then I was told on
Prompt: Is this a good demo?
Pattern: (Yes|No)
ReLLM: No.
Without ReLLM: I don't know, but this is amazing! Even more amazing is how the design can take place on a small stage that uses LEDs.
As
Prompt: Convert the date May 4, 2023 to the format mm/dd/yyyy:
Pattern: [0-9]{2}/[0-9]{2}/[0-9]{4}
ReLLM: 00/00/0045
Without ReLLM: mm:ss
A-Z, Z-A, W-H (0-9:9:19)
Z-R
Prompt: Jeff Dean is a
Pattern (Programmer|Computer Scientist|AGI)
ReLLM: Computer Scientist
Without ReLLM: former national basketball champion and a former professional basketball player. He currently serves as general counsel for the NCAA Office of the Vice President for Academic Affairs.
Prompt: I can eat
Pattern: [0-9]{1,10} [a-z]* of [a-z]*
ReLLM: 800 calories of coffee
Without ReLLM: iced coffee here on the west side and do this, so can you?"
"Why, I don't understand. What did you mean by