Skip to content

Commit e571547

Browse files
pull prompt from latest
1 parent 8f4fa22 commit e571547

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

autotune/setup.mdx

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ prompt = ze.prompt(
2525

2626
That's it! You'll start seeing production traces in your dashboard for this specific task at [`ZeroEval › Tuning › [task_name]`](https://app.zeroeval.com).
2727

28+
<Note>
29+
**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+
</Note>
31+
2832
## Pushing models to production
2933

3034
Once you see a model that performs well, you can send it to production with a single click, as seen below.
@@ -73,32 +77,43 @@ response = client.chat.completions.create(
7377

7478
## Understanding Prompt Versions
7579

76-
Every time you change your prompt content, a new version is created:
80+
ZeroEval automatically manages prompt versions for you. When you use `ze.prompt()` with `content`, the SDK will:
81+
82+
1. **Check for optimized versions**: First, it tries to fetch the latest optimized version from your dashboard
83+
2. **Fall back to your content**: If no optimized versions exist yet, it uses the `content` you provided
84+
3. **Create a version**: Your provided content is stored as the initial version for this task
85+
86+
This means you get the best of both worlds: hardcoded fallback prompts in your code, with automatic optimization in production.
7787

7888
```python
79-
# Version 1 - Initial prompt
80-
prompt_v1 = ze.prompt(
89+
# This will use the latest optimized version if one exists in your dashboard
90+
# Otherwise, it uses the content you provide here
91+
prompt = ze.prompt(
8192
name="customer-support",
8293
content="You are a helpful assistant."
8394
)
95+
```
8496

85-
# Version 2 - Updated prompt (automatically creates new version)
86-
prompt_v2 = ze.prompt(
87-
name="customer-support",
88-
content="You are a helpful customer support assistant." # Changed!
89-
)
97+
### Explicit version control
9098

91-
# Fetch specific versions by hash
92-
latest_prompt = ze.prompt(
99+
If you need more control over which version to use, you can explicitly specify versions:
100+
101+
```python
102+
# Always use the latest optimized version (fails if none exists)
103+
prompt = ze.prompt(
93104
name="customer-support",
94-
from="latest" # Always get the latest tuned version
105+
from_="latest"
95106
)
96107

97-
# Or fetch a specific version by its content hash
98-
specific_prompt = ze.prompt(
108+
# Use a specific version by its content hash
109+
prompt = ze.prompt(
99110
name="customer-support",
100-
from="a1b2c3d4..." # 64-character SHA-256 hash
111+
from_="a1b2c3d4..." # 64-character SHA-256 hash
101112
)
102113
```
103114

115+
<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.
117+
</Tip>
118+
104119

autotune/tuning/prompts.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ from openai import OpenAI
5858
ze.init()
5959
client = OpenAI()
6060

61-
# Define your prompt
61+
# Define your prompt - ZeroEval will automatically use the latest optimized
62+
# version from your dashboard if one exists, falling back to this content
6263
system_prompt = ze.prompt(
6364
name="support-bot",
6465
content="You are a helpful customer support agent."
@@ -90,6 +91,10 @@ ze.send_feedback(
9091
)
9192
```
9293

94+
<Note>
95+
**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+
</Note>
97+
9398
### Feedback through the API
9499

95100
For integration with non-Python systems or direct API access, you can submit feedback using the public HTTP API.

0 commit comments

Comments
 (0)