Skip to content

Commit 3cd76b7

Browse files
authored
Merge pull request #58 from connortreacy/frontend
Frontend
2 parents a6424b1 + 8ccfd14 commit 3cd76b7

208 files changed

Lines changed: 17316 additions & 9154 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[run]
2-
source = src/llama_prompt_ops
2+
source = src/prompt_ops
33
omit =
44
*/tests/*
55
*/site-packages/*

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 33 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,61 @@
11
name: 🐛 Bug Report
2-
description: Create a report to help us reproduce and fix the bug
2+
description: Report a bug to help us improve prompt-ops
33
labels: ["bug"]
44
body:
55
- type: markdown
66
attributes:
77
value: >
8-
#### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the
9-
existing and past issues](https://github.com/meta-llama/llama-stack/issues).
8+
Thanks for taking the time to report a bug! Please search [existing issues](https://github.com/meta-llama/prompt-ops/issues) first to avoid duplicates.
109
1110
- type: textarea
12-
id: system-info
11+
id: bug-description
1312
attributes:
14-
label: System Info
15-
description: |
16-
Please share your system info with us. You can use the following command to capture your environment information
17-
python -m "torch.utils.collect_env"
18-
13+
label: What happened?
14+
description: A clear description of the bug and what you expected to happen instead.
1915
placeholder: |
20-
PyTorch version, CUDA version, GPU type, #num of GPUs...
16+
I was trying to optimize prompts using the facility dataset, but...
17+
18+
Expected: The optimization should complete successfully
19+
Actual: Got an error about missing configuration
2120
validations:
2221
required: true
2322

24-
- type: checkboxes
25-
id: information-scripts-examples
26-
attributes:
27-
label: Information
28-
description: 'The problem arises when using:'
29-
options:
30-
- label: "The official example scripts"
31-
- label: "My own modified scripts"
32-
3323
- type: textarea
34-
id: bug-description
24+
id: reproduction
3525
attributes:
36-
label: 🐛 Describe the bug
37-
description: |
38-
Please provide a clear and concise description of what the bug is.
39-
40-
Please also paste or describe the results you observe instead of the expected results.
26+
label: How to reproduce
27+
description: Steps to reproduce the issue, including any commands or code.
4128
placeholder: |
42-
A clear and concise description of what the bug is.
29+
1. Run `prompt-ops optimize --config configs/facility.yaml`
30+
2. See error...
4331
44-
```llama stack
45-
# Command that you used for running the examples
32+
```bash
33+
# Your command here
4634
```
47-
Description of the results
4835
validations:
4936
required: true
5037

5138
- type: textarea
39+
id: environment
5240
attributes:
53-
label: Error logs
54-
description: |
55-
If you observe an error, please paste the error message including the **full** traceback of the exception. It may be relevant to wrap error messages in ```` ```triple quotes blocks``` ````.
56-
41+
label: Environment
42+
description: Your Python version and any relevant system info.
5743
placeholder: |
58-
```
59-
The error message you got, with the full traceback.
60-
```
61-
44+
- Python version: 3.9.0
45+
- prompt-ops version: 0.0.8
46+
- OS: macOS 14.0
6247
validations:
63-
required: true
64-
48+
required: false
6549

6650
- type: textarea
67-
id: expected-behavior
68-
validations:
69-
required: true
70-
attributes:
71-
label: Expected behavior
72-
description: "A clear and concise description of what you would expect to happen."
73-
74-
- type: markdown
51+
id: error-logs
7552
attributes:
76-
value: >
77-
Thanks for contributing 🎉!
53+
label: Error logs (if any)
54+
description: Paste any error messages or stack traces.
55+
placeholder: |
56+
```
57+
Traceback (most recent call last):
58+
...
59+
```
60+
validations:
61+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,5 @@ blank_issues_enabled: false
22

33
contact_links:
44
- name: Have you read the docs?
5-
url: https://llama-stack.readthedocs.io/en/latest/index.html
6-
about: Much help can be found in the docs
7-
- name: Start a discussion
8-
url: https://github.com/meta-llama/llama-stack/discussions/new
9-
about: Start a discussion on a topic
10-
- name: Chat on Discord
11-
url: https://discord.gg/llama-stack
12-
about: Maybe chatting with the community can help
5+
url: https://github.com/meta-llama/prompt-ops/blob/main/README.md
6+
about: Much help can be found in the README and documentation
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
1-
name: 🚀 Feature request
2-
description: Request a new llama-stack feature
1+
name: 🚀 Feature Request
2+
description: Suggest a new feature for prompt-ops
33
labels: ["enhancement"]
44
body:
55
- type: textarea
6-
id: feature-pitch
6+
id: feature-description
77
attributes:
8-
label: 🚀 Describe the new functionality needed
9-
description: >
10-
A clear and concise description of _what_ needs to be built.
8+
label: What feature would you like?
9+
description: A clear description of the feature you'd like to see.
10+
placeholder: |
11+
I'd like to be able to...
12+
13+
This would help with...
1114
validations:
1215
required: true
1316

1417
- type: textarea
15-
id: feature-motivation
18+
id: use-case
1619
attributes:
17-
label: 💡 Why is this needed? What if we don't build it?
18-
description: >
19-
A clear and concise description of _why_ this functionality is needed.
20+
label: What's your use case?
21+
description: How would you use this feature? What problem does it solve?
22+
placeholder: |
23+
I'm working on optimizing prompts for customer support and need...
2024
validations:
2125
required: true
2226

2327
- type: textarea
24-
id: other-thoughts
28+
id: additional-context
2529
attributes:
26-
label: Other thoughts
27-
description: >
28-
Any thoughts about how this may result in complexity in the codebase, or other trade-offs.
30+
label: Additional context
31+
description: Any other details, examples, or screenshots that might help.
32+
placeholder: |
33+
Here's an example of what I'm trying to achieve...
34+
validations:
35+
required: false

.github/workflows/ci-with-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Run tests with coverage
3636
run: |
37-
pytest --cov=src/llama_prompt_ops --cov-report=xml tests/
37+
pytest --cov=src/prompt_ops --cov-report=xml tests/
3838
3939
- name: Upload coverage to Codecov
4040
uses: codecov/codecov-action@v3

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
echo "Package version: $VERSION"
4141
4242
# Check if this version already exists on PyPI
43-
if pip index versions llama-prompt-ops 2>/dev/null | grep -q "$VERSION"; then
43+
if pip index versions prompt-ops 2>/dev/null | grep -q "$VERSION"; then
4444
echo "Error: Version $VERSION already exists on PyPI"
4545
exit 1
4646
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
local.env
2+
3+
14
# Python cache files
25
__pycache__/
36
*.py[cod]

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to llama-prompt-ops
1+
# Contributing to prompt-ops
22
We want to make contributing to this project as easy and transparent as
33
possible.
44

@@ -23,4 +23,4 @@ We use GitHub issues to track public bugs. Please ensure your description is cle
2323
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
2424

2525
## License
26-
By contributing to llama-prompt-ops, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.
26+
By contributing to prompt-ops, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.

MANIFEST.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
recursive-include src/llama_prompt_ops *.py
2-
recursive-include src/llama_prompt_ops/interfaces *.py
3-
recursive-include src/llama_prompt_ops/core *.py
4-
recursive-include src/llama_prompt_ops/templates *
1+
recursive-include src/prompt_ops *.py
2+
recursive-include src/prompt_ops/interfaces *.py
3+
recursive-include src/prompt_ops/core *.py
4+
recursive-include src/prompt_ops/templates *

README.md

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,52 @@
1-
<h1 align="center"> Llama Prompt Ops </h1>
1+
<h1 align="center"> Prompt Ops </h1>
22

3-
## What is llama-prompt-ops?
3+
### 🎉 New: Prompt Duel Optimizer (PDO) Published!
4+
5+
We've published a new paper on **PDO (Prompt Duel Optimizer)** - an efficient label-free prompt optimization method using dueling bandits and Thompson sampling. PDO achieves state-of-the-art results on BIG-bench Hard and MS MARCO benchmarks.
6+
7+
📄 **Read the paper:** [LLM Prompt Duel Optimizer: Efficient Label-Free Prompt Optimization](https://www.arxiv.org/abs/2510.13907) (arXiv:2510.13907)
8+
9+
🧪 **Try it yourself:** Check out the [Web of Lies use case](use-cases/web-of-lies-pdo/) demonstrating PDO on logical reasoning tasks
10+
11+
**Star this repo** and follow along - we'll be publishing a detailed tutorial notebook soon!
12+
13+
---
14+
15+
## What is prompt-ops?
416
<p align="center">
5-
<a href="https://pypi.org/project/llama-prompt-ops/"><img src="https://img.shields.io/pypi/v/llama-prompt-ops.svg" /></a>
17+
<a href="https://pypi.org/project/prompt-ops/"><img src="https://img.shields.io/pypi/v/prompt-ops.svg" /></a>
618
</p>
719
<p align="center">
8-
<a href="https://llama.developer.meta.com/?utm_source=llama-prompt-ops&utm_medium=readme&utm_campaign=main"><img src="https://img.shields.io/badge/Llama_API-Join_Waitlist-brightgreen?logo=meta" /></a>
9-
<a href="https://llama.developer.meta.com/docs?utm_source=llama-prompt-ops&utm_medium=readme&utm_campaign=main"><img src="https://img.shields.io/badge/Llama_API-Documentation-4BA9FE?logo=meta" /></a>
20+
<a href="https://llama.developer.meta.com/?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main"><img src="https://img.shields.io/badge/Llama_API-Join_Waitlist-brightgreen?logo=meta" /></a>
21+
<a href="https://llama.developer.meta.com/docs?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main"><img src="https://img.shields.io/badge/Llama_API-Documentation-4BA9FE?logo=meta" /></a>
1022

1123
</p>
1224

1325
<p align="center">
14-
<a href="https://github.com/meta-llama/llama-models/blob/main/models/?utm_source=llama-prompt-ops&utm_medium=readme&utm_campaign=main"><img alt="Llama Model cards" src="https://img.shields.io/badge/Llama_OSS-Model_cards-green?logo=meta" /></a>
15-
<a href="https://www.llama.com/docs/overview/?utm_source=llama-prompt-ops&utm_medium=readme&utm_campaign=main"><img alt="Llama Documentation" src="https://img.shields.io/badge/Llama_OSS-Documentation-4BA9FE?logo=meta" /></a>
26+
<a href="https://github.com/meta-llama/llama-models/blob/main/models/?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main"><img alt="Llama Model cards" src="https://img.shields.io/badge/Llama_OSS-Model_cards-green?logo=meta" /></a>
27+
<a href="https://www.llama.com/docs/overview/?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main"><img alt="Llama Documentation" src="https://img.shields.io/badge/Llama_OSS-Documentation-4BA9FE?logo=meta" /></a>
1628
<a href="https://huggingface.co/meta-llama"><img alt="Hugging Face meta-llama" src="https://img.shields.io/badge/Hugging_Face-meta--llama-yellow?logo=huggingface" /></a>
1729

1830
</p>
1931
<p align="center">
2032
<a href="https://github.com/meta-llama/synthetic-data-kit"><img alt="Llama Tools Syntethic Data Kit" src="https://img.shields.io/badge/Llama_Tools-synthetic--data--kit-orange?logo=meta" /></a>
21-
<a href="https://github.com/meta-llama/llama-prompt-ops"><img alt="Llama Tools Syntethic Data Kit" src="https://img.shields.io/badge/Llama_Tools-llama--prompt--ops-orange?logo=meta" /></a>
33+
<a href="https://github.com/meta-llama/prompt-ops"><img alt="Llama Tools Syntethic Data Kit" src="https://img.shields.io/badge/Llama_Tools-prompt--ops-orange?logo=meta" /></a>
2234
<a href="https://github.com/meta-llama/llama-cookbook"><img alt="Llama Cookbook" src="https://img.shields.io/badge/Llama_Cookbook-llama--cookbook-orange?logo=meta" /></a>
2335
</p>
2436

2537

2638

27-
llama-prompt-ops is a Python package that **automatically optimizes prompts** for Llama models. It transforms prompts that work well with other LLMs into prompts that are optimized for Llama models, improving performance and reliability.
39+
prompt-ops is a Python package that **automatically optimizes prompts** for Llama models. It transforms prompts that work well with other LLMs into prompts that are optimized for LLM models, improving performance and reliability.
2840

2941
**Key Benefits:**
3042
- **No More Trial and Error**: Stop manually tweaking prompts to get better results
31-
- **Fast Optimization**: Get Llama-optimized prompts in minutes with template-based optimization
43+
- **Fast Optimization**: Get model-optimized prompts in minutes with template-based optimization
3244
- **Data-Driven Improvements**: Use your own examples to create prompts that work for your specific use case
3345
- **Measurable Results**: Evaluate prompt performance with customizable metrics
3446

3547
## Requirements
3648

37-
To get started with llama-prompt-ops, you'll need:
49+
To get started with prompt-ops, you'll need:
3850

3951
- Existing System Prompt: Your existing system prompt that you want to optimize
4052
- Existing Query-Response Dataset: A JSON file containing query-response pairs (as few as 50 examples) for evaluation and optimization (see [prepare your dataset](#preparing-your-data) below)
@@ -50,7 +62,7 @@ To get started with llama-prompt-ops, you'll need:
5062
│ │ │
5163
▼ ▼ ▼
5264
┌────────────────────────────────────────────────────────────────────┐
53-
llama-prompt-ops migrate │
65+
│ prompt-ops migrate │
5466
└────────────────────────────────────────────────────────────────────┘
5567
5668
@@ -66,7 +78,7 @@ To get started with llama-prompt-ops, you'll need:
6678
2. [**Prepare your dataset**](#preparing-your-data): Create a JSON file with query-response pairs for evaluation and optimization
6779
3. **Configure optimization**: Set up a simple YAML file with your dataset and preferences (see [example configuration](configs/facility-simple.yaml))
6880
4. [**Run optimization**](#step-4-run-optimization): Execute a single command to transform your prompt
69-
5. [**Get results**](#prompt-transformation-example): Receive a Llama-optimized prompt with performance metrics
81+
5. [**Get results**](#prompt-transformation-example): Receive a model-optimized prompt with performance metrics
7082

7183

7284
## Real-world Results
@@ -85,27 +97,29 @@ These results were measured on the [HotpotQA multi-hop reasoning benchmark](http
8597

8698
### Step 1: Installation
8799

100+
> **Note:** We recommend installing from source as we are currently transitioning package names on PyPI. This ensures you get the latest stable version without any naming conflicts.
101+
88102
```bash
89103
# Create a virtual environment
90104
conda create -n prompt-ops python=3.10
91105
conda activate prompt-ops
92106

93-
# Install from PyPI
94-
pip install llama-prompt-ops
95-
96-
# OR install from source
97-
git clone https://github.com/meta-llama/llama-prompt-ops.git
98-
cd llama-prompt-ops
107+
# Recommended: Install from source
108+
git clone https://github.com/meta-llama/prompt-ops.git
109+
cd prompt-ops
99110
pip install -e .
100111

112+
# Alternative: Install from PyPI (may have naming transition issues, still on version 0.0.7)
113+
# pip install llama-prompt-ops
114+
101115
```
102116

103117
### Step 2: Create a sample project
104118

105119
This will create a directory called my-project with a sample configuration and dataset in the current folder.
106120

107121
```bash
108-
llama-prompt-ops create my-project
122+
prompt-ops create my-project
109123
cd my-project
110124
```
111125

@@ -116,13 +130,14 @@ Add your API key to the `.env` file:
116130
```bash
117131
OPENROUTER_API_KEY=your_key_here
118132
```
119-
You can get an OpenRouter API key by creating an account at [OpenRouter](https://openrouter.ai/). For more inference provider options, see [Inference Providers](./docs/inference_providers.md).
133+
134+
prompt-ops uses LiteLLM as a unified API client. LiteLLM automatically detects the provider from your model name (e.g., `openrouter/model`, `groq/model`) and looks for the corresponding provider-specific environment variable (`OPENROUTER_API_KEY`, `GROQ_API_KEY`, etc.). For more inference provider options, see [Inference Providers](./docs/inference_providers.md).
120135

121136
### Step 4: Run Optimization
122137
The optimization will take about 5 minutes.
123138

124139
```bash
125-
llama-prompt-ops migrate # defaults to config.yaml if --config not specified
140+
prompt-ops migrate # defaults to config.yaml if --config not specified
126141
```
127142

128143
Done! The optimized prompt will be saved to the `results` directory with performance metrics comparing the original and optimized versions.
@@ -141,7 +156,7 @@ Below is an example of a transformed system prompt from proprietary LM to Llama:
141156

142157
## Preparing Your Data
143158

144-
To use llama-prompt-ops for prompt optimization, you'll need to prepare a dataset with your prompts and expected responses. The standard format is a JSON file structured like this:
159+
To use prompt-ops for prompt optimization, you'll need to prepare a dataset with your prompts and expected responses. The standard format is a JSON file structured like this:
145160

146161
```json
147162
[
@@ -156,15 +171,15 @@ To use llama-prompt-ops for prompt optimization, you'll need to prepare a datase
156171
]
157172
```
158173

159-
If your data matches this format, you can use the built-in [`StandardJSONAdapter`](src/llama_prompt_ops/core/datasets.py) which will handle it automatically.
174+
If your data matches this format, you can use the built-in [`StandardJSONAdapter`](src/prompt_ops/core/datasets.py) which will handle it automatically.
160175

161176
### Custom Data Formats
162177

163178
If your data is formatted differently, and there isn't a built-in dataset adapter, you can create a custom dataset adapter by extending the `DatasetAdapter` class. See the [Dataset Adapter Selection Guide](docs/dataset_adapter_selection_guide.md) for more details.
164179

165180
## Multiple Inference Provider Support
166181

167-
llama-prompt-ops supports various inference providers and endpoints to fit your infrastructure needs. See our [detailed guide on inference providers](./docs/inference_providers.md) for configuration examples with:
182+
prompt-ops supports various inference providers and endpoints to fit your infrastructure needs. See our [detailed guide on inference providers](./docs/inference_providers.md) for configuration examples with:
168183

169184
- OpenRouter (cloud-based API)
170185
- vLLM (local deployment)
@@ -174,7 +189,7 @@ llama-prompt-ops supports various inference providers and endpoints to fit your
174189

175190
For more detailed information, check out these resources:
176191

177-
- [Quick Start Guide](docs/basic/readme.md): Get up and running with llama-prompt-ops in 5 minutes
192+
- [Quick Start Guide](docs/basic/readme.md): Get up and running with prompt-ops in 5 minutes
178193
- [Intermediate Configuration Guide](docs/intermediate/readme.md): Learn how to configure datasets, metrics, and optimization strategies
179194
- [Dataset Adapter Selection Guide](docs/dataset_adapter_selection_guide.md): Choose the right adapter for your dataset format
180195
- [Metric Selection Guide](docs/metric_selection_guide.md): Select appropriate evaluation metrics for your use case

0 commit comments

Comments
 (0)