lex-prompt 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +73 -0
- data/lib/legion/extensions/prompt/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68b2cd97eb63d60560cee2f12ee0257ab7dfbfd09f6845b438d07f232da49b20
|
|
4
|
+
data.tar.gz: 5cef6da05fde3cd63870028241d10ed9c25df99c2acf4e1293cd2627058ace4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 750df2fb2b66c07876cde1d5c61f4a0543a591f46d6673a61938c502bfab845932f8019893a8a1293c2d2edbd5841540063611892753e7465a79c4b0d28f043c
|
|
7
|
+
data.tar.gz: cdfb4123ec0228525be344541423fe61385a8b2c7eb77ee1ff72e49b1a8aecb155ffe1d4d960ab4474f8497313a7ed4a832ba8b25541e7bee31043719852da36
|
data/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# lex-prompt
|
|
2
|
+
|
|
3
|
+
Versioned prompt management for LegionIO. Provides immutable versioned prompt storage with tagged releases, variable substitution via ERB, and content-hash deduplication.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`lex-prompt` manages LLM prompt templates as first-class versioned artifacts. Prompts have named versions and optional tags (e.g., `stable`, `production`). Updating a prompt with unchanged content is a no-op. Variable substitution uses ERB rendering.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'lex-prompt'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require 'legion/extensions/prompt'
|
|
19
|
+
|
|
20
|
+
client = Legion::Extensions::Prompt::Client.new
|
|
21
|
+
|
|
22
|
+
# Create a prompt
|
|
23
|
+
client.create_prompt(
|
|
24
|
+
name: 'code-review',
|
|
25
|
+
template: 'Review this <%= language %> code for bugs:\n\n<%= code %>',
|
|
26
|
+
description: 'Code review prompt',
|
|
27
|
+
model_params: { temperature: 0.2, max_tokens: 1000 }
|
|
28
|
+
)
|
|
29
|
+
# => { created: true, name: 'code-review', version: 1, prompt_id: 1 }
|
|
30
|
+
|
|
31
|
+
# Update (creates version 2 only if content changed)
|
|
32
|
+
client.update_prompt(
|
|
33
|
+
name: 'code-review',
|
|
34
|
+
template: 'Carefully review this <%= language %> code for bugs and style:\n\n<%= code %>'
|
|
35
|
+
)
|
|
36
|
+
# => { updated: true, name: 'code-review', version: 2 }
|
|
37
|
+
|
|
38
|
+
# Tag a specific version
|
|
39
|
+
client.tag_prompt(name: 'code-review', tag: 'stable', version: 1)
|
|
40
|
+
|
|
41
|
+
# Render with variable substitution
|
|
42
|
+
client.render_prompt(
|
|
43
|
+
name: 'code-review',
|
|
44
|
+
variables: { language: 'Ruby', code: 'def foo; end' },
|
|
45
|
+
tag: 'stable'
|
|
46
|
+
)
|
|
47
|
+
# => { rendered: "Review this Ruby code for bugs:\n\ndef foo; end", prompt_version: 1 }
|
|
48
|
+
|
|
49
|
+
# Retrieve without rendering
|
|
50
|
+
client.get_prompt(name: 'code-review', version: 1)
|
|
51
|
+
|
|
52
|
+
# List all prompts
|
|
53
|
+
client.list_prompts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Related Repos
|
|
57
|
+
|
|
58
|
+
- `lex-eval` — runs evaluation suites; prompts are rendered and passed to evaluators
|
|
59
|
+
- `lex-dataset` — versioned input/output pairs used together with prompt templates
|
|
60
|
+
- `lex-transformer` — named transform definitions can reference prompt templates by name
|
|
61
|
+
- `legion-llm` — LLM execution layer; rendered prompts are passed here for inference
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bundle install
|
|
67
|
+
bundle exec rspec
|
|
68
|
+
bundle exec rubocop
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-prompt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew Iverson
|
|
@@ -17,6 +17,7 @@ executables: []
|
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
+
- README.md
|
|
20
21
|
- lib/legion/extensions/prompt.rb
|
|
21
22
|
- lib/legion/extensions/prompt/client.rb
|
|
22
23
|
- lib/legion/extensions/prompt/helpers/template_renderer.rb
|