Skip to content

Commit 90730c0

Browse files
prompt logic improvements
1 parent e571547 commit 90730c0

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

autotune/setup.mdx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ That's it! You'll start seeing production traces in your dashboard for this spec
2727

2828
<Note>
2929
**Auto-tune behavior:** When you provide `content`, ZeroEval automatically uses the latest optimized version from your dashboard if one exists. The `content` parameter serves as a fallback for when no optimized versions are available yet. This means you can hardcode a default prompt in your code, but ZeroEval will seamlessly swap in tuned versions without any code changes.
30+
31+
To explicitly use the hardcoded content and bypass auto-optimization, use `from_="explicit"`:
32+
```python
33+
prompt = ze.prompt(
34+
name="assistant",
35+
from_="explicit",
36+
content="You are a helpful assistant"
37+
)
38+
```
3039
</Note>
3140

3241
## Pushing models to production
@@ -96,7 +105,7 @@ prompt = ze.prompt(
96105

97106
### Explicit version control
98107

99-
If you need more control over which version to use, you can explicitly specify versions:
108+
If you need more control over which version to use:
100109

101110
```python
102111
# Always use the latest optimized version (fails if none exists)
@@ -105,15 +114,31 @@ prompt = ze.prompt(
105114
from_="latest"
106115
)
107116

117+
# Always use the hardcoded content (bypass auto-optimization)
118+
prompt = ze.prompt(
119+
name="customer-support",
120+
from_="explicit",
121+
content="You are a helpful assistant."
122+
)
123+
108124
# Use a specific version by its content hash
109125
prompt = ze.prompt(
110126
name="customer-support",
111127
from_="a1b2c3d4..." # 64-character SHA-256 hash
112128
)
113129
```
114130

131+
### When to use each mode
132+
133+
| Mode | Use Case | Behavior |
134+
|------|----------|----------|
135+
| `content` only | **Recommended for most cases** | Auto-optimization with fallback |
136+
| `from_="explicit"` | Testing, debugging, or A/B testing specific prompts | Always use hardcoded content |
137+
| `from_="latest"` | Production where optimization is required | Fail if no optimized version exists |
138+
| `from_="<hash>"` | Pinning to specific tested versions | Use exact version by hash |
139+
115140
<Tip>
116-
**Best practice**: Use `content` parameter for local development and testing. ZeroEval will automatically use optimized versions in production without any code changes. Only use `from_="latest"` if you want to explicitly require an optimized version to exist.
141+
**Best practice**: Use `content` parameter alone for local development and production. ZeroEval will automatically use optimized versions when available. Only use `from_="explicit"` when you specifically need to test or debug the hardcoded content.
117142
</Tip>
118143

119144

autotune/tuning/prompts.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ ze.send_feedback(
9393

9494
<Note>
9595
**Auto-optimization**: When you use `ze.prompt()` with `content`, ZeroEval automatically fetches the latest optimized version from your dashboard if one exists. Your `content` serves as a fallback for initial setup. This means your prompts improve automatically as you tune them, without any code changes.
96+
97+
If you need to test the hardcoded content specifically (e.g., for debugging or A/B testing), use `from_="explicit"`:
98+
```python
99+
# Bypass auto-optimization and always use this exact content
100+
prompt = ze.prompt(
101+
name="support-bot",
102+
from_="explicit",
103+
content="You are a helpful customer support agent."
104+
)
105+
```
96106
</Note>
97107

98108
### Feedback through the API

0 commit comments

Comments
 (0)