5a558eb09e
TypeScript SDK Compatibility V1.x E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / TypeScript SDK Compatibility V1.x E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
TypeScript SDK E2E Tests / TypeScript SDK E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
Python SDK E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK E2E Tests / Python SDK E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK E2E Tests / build-opik (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Python SDK Compatibility V1.x E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK E2E Tests / build-opik (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer E2E Tests Python ${{matrix.python_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer Integration Smoke Tests (push) Has been cancelled
🐙 Code Quality / detect (push) Has been cancelled
🐙 Code Quality / lint (${{ matrix.leg.name }}) (push) Has been cancelled
🐙 Code Quality / summary (push) Has been cancelled
TypeScript SDK Library Integration Tests / Check Secrets (push) Has been cancelled
TypeScript SDK Library Integration Tests / opik-vercel (Vercel AI SDK / eve) (push) Has been cancelled
SDK Library Integration Tests Runner / Check Secrets (push) Has been cancelled
SDK Library Integration Tests Runner / Missed OpenAI API Key Warning (push) Has been cancelled
SDK Library Integration Tests Runner / Build (push) Has been cancelled
SDK Library Integration Tests Runner / openai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_legacy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / llama_index_tests (push) Has been cancelled
SDK Library Integration Tests Runner / anthropic_tests (push) Has been cancelled
SDK Library Integration Tests Runner / mistral_tests (push) Has been cancelled
SDK Library Integration Tests Runner / groq_tests (push) Has been cancelled
SDK Library Integration Tests Runner / aisuite_tests (push) Has been cancelled
SDK Library Integration Tests Runner / haystack_tests (push) Has been cancelled
SDK Library Integration Tests Runner / dspy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v1_tests (push) Has been cancelled
SDK Library Integration Tests Runner / genai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_legacy_1_3_0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / evaluation_metrics_tests (push) Has been cancelled
SDK Library Integration Tests Runner / bedrock_tests (push) Has been cancelled
SDK Library Integration Tests Runner / litellm_tests (push) Has been cancelled
SDK Library Integration Tests Runner / harbor_tests (push) Has been cancelled
SDK Library Integration Tests Runner / Slack Notification (push) Has been cancelled
Lint Opik Helm Chart / render-equality (push) Has been cancelled
Opik Optimizer - Unit Tests / Opik Optimizer Unit Tests Python ${{matrix.python_version}} (push) Has been cancelled
Python BE E2E Tests / Python BE E2E (push) Has been cancelled
Python Backend Tests / run-python-backend-tests (push) Has been cancelled
Python SDK Unit Tests / Python SDK Unit Tests ${{matrix.python_version}} (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
SDK E2E Libraries Integration Tests / Check Secrets (push) Has been cancelled
SDK E2E Libraries Integration Tests / Missed OpenAI API Key Warning (push) Has been cancelled
SDK E2E Libraries Integration Tests / build-opik (push) Has been cancelled
SDK E2E Libraries Integration Tests / E2E Lib Integration Python ${{matrix.python_version}} (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-gemini) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-langchain) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-openai) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-otel) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-vercel) (push) Has been cancelled
TypeScript SDK Build & Publish / build-and-publish (push) Has been cancelled
TypeScript SDK Unit Tests / Test on Node ${{ matrix.node-version }} (push) Has been cancelled
Backend Tests / discover-tests (push) Has been cancelled
Backend Tests / ${{ matrix.name }} (push) Has been cancelled
Build and Publish SDK / build-and-publish (push) Has been cancelled
Build Opik Docker Images / set-version (push) Has been cancelled
Build Opik Docker Images / build-backend (push) Has been cancelled
Build Opik Docker Images / build-sandbox-executor-python (push) Has been cancelled
Build Opik Docker Images / build-python-backend (push) Has been cancelled
Build Opik Docker Images / build-frontend (push) Has been cancelled
Build Opik Docker Images / create-git-tag (push) Has been cancelled
ClickHouse Migration Cluster Check / validate-clickhouse-migrations (push) Has been cancelled
Docs - Publish / run (push) Has been cancelled
E2E Tests - Post Merge (v2) / 🧪 E2E v2 Tests (${{ github.event.inputs.tier || 't1' }}) (push) Has been cancelled
E2E Tests - Post Merge (v2) / 📢 Slack Notification (push) Has been cancelled
Frontend Unit Tests / Test on Node 20 (push) Has been cancelled
Guardrails E2E Tests / Select Python version matrix (push) Has been cancelled
Guardrails E2E Tests / Guardrails E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Guardrails E2E Tests / 📢 Slack Notification (push) Has been cancelled
Guardrails Backend Unit Tests / Guardrails Backend Unit Tests (push) Has been cancelled
Guardrails Backend Unit Tests / 📢 Slack Notification (push) Has been cancelled
Lint Opik Helm Chart / lint-helm-chart (Helm v3.21.0) (push) Has been cancelled
Lint Opik Helm Chart / lint-helm-chart (Helm v4.2.0) (push) Has been cancelled
Lint Opik Helm Chart / unittest-helm-chart (push) Has been cancelled
142 lines
6.2 KiB
Plaintext
142 lines
6.2 KiB
Plaintext
---
|
|
headline: Prompt Generator and Improver | Opik Documentation
|
|
og:description: Enhance your prompt quality using Opik's AI tools for efficient prompt
|
|
generation and refinement based on expert engineering strategies.
|
|
og:site_name: Opik Documentation
|
|
og:title: Boost Your Prompts with Opik's Generator & Improver
|
|
title: Prompt Generator and Improver
|
|
canonical-url: https://www.comet.com/docs/opik/development/prompt-library/overview
|
|
---
|
|
|
|
Opik provides two AI-powered features to help you create and refine prompts: Prompt Generator and Prompt Improver. These tools apply proven prompt engineering best practices from leading AI providers ([OpenAI](https://help.openai.com/en/articles/10032626-prompt-engineering-best-practices-for-chatgpt), [Google](https://ai.google.dev/gemini-api/docs/prompting-strategies), [Anthropic](https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/overview)) automatically.
|
|
|
|
You can access these features from:
|
|
|
|
- **Playground** - Use the Generate and Improve buttons directly in the prompt editor
|
|
- **Prompt Library** - Improve existing prompts by opening them in the Playground
|
|
|
|
<Tip>
|
|
Prompt generation and improvement use the currently selected model, AI
|
|
provider, and configuration (temperature, max tokens, etc.) from your
|
|
Playground. This will consume credits from your configured provider account.
|
|
</Tip>
|
|
|
|
## Prompt Generator
|
|
|
|
### What is the Prompt Generator?
|
|
|
|
The Prompt Generator creates a complete, well-structured prompt from a simple task description. Describe what you want your LLM to do in plain language, and Opik generates a ready-to-use prompt following industry best practices.
|
|
|
|
<Frame>
|
|
<img src="/img/prompt_engineering/prompt_generation.png" />
|
|
</Frame>
|
|
|
|
### When to Use
|
|
|
|
Use the Prompt Generator when you:
|
|
|
|
- Are starting a new prompt from scratch
|
|
- Need inspiration for prompt structure
|
|
- Want to ensure your prompt follows industry best practices
|
|
- Are unsure how to phrase your task optimally
|
|
|
|
### System Prompt Used
|
|
|
|
Opik uses the following system prompt to generate new prompts:
|
|
|
|
```text
|
|
You are an expert prompt engineer. Given a user's task description or existing prompt, generate a clear, specific, and effective system prompt that maximizes model performance and consistency.
|
|
|
|
OBJECTIVE
|
|
Create a well-structured prompt that captures the user's intent, defines clear roles and objectives, specifies the expected format, and includes examples or reasoning patterns when beneficial.
|
|
|
|
CONSTRUCTION PRINCIPLES (in priority order)
|
|
|
|
1. Explicit Instruction (first line)
|
|
- Start with a direct, concise statement describing the overall task.
|
|
- The instruction must appear before any context or explanation.
|
|
|
|
2. Role Definition
|
|
- "You are a [role] specializing in [expertise]."
|
|
- Keep it to one sentence unless the domain demands elaboration.
|
|
|
|
3. Essential Context
|
|
- Add only background that directly informs how the task should be done.
|
|
- Skip generic or motivational context.
|
|
|
|
4. Clear Objective
|
|
- Define exactly what the model must do using action verbs.
|
|
- When applicable, outline the reasoning-before-conclusion order.
|
|
|
|
5. Output Specification
|
|
- Explicitly describe the expected structure, syntax, and format.
|
|
- Prefer deterministic formats when possible.
|
|
|
|
6. Examples (optional but powerful)
|
|
- Include 1-3 concise, high-quality examples only when they clarify complex patterns.
|
|
- Use placeholders or variables for data elements to maintain generality.
|
|
|
|
7. Key Constraints
|
|
- List critical limitations as bullet points.
|
|
- Avoid redundant or obvious constraints.
|
|
|
|
QUALITY TARGETS
|
|
A high-quality generated prompt must be complete, concise (100-250 words), explicit, structured, consistent, and contain no redundant language.
|
|
```
|
|
|
|
## Prompt Improver
|
|
|
|
### What is the Prompt Improver?
|
|
|
|
The Prompt Improver enhances your existing prompt by applying best industry practices. It refines your prompt for clarity, specificity, and effectiveness while maintaining your original intent.
|
|
|
|
<Frame>
|
|
<img src="/img/prompt_engineering/prompt_improvement.png" />
|
|
</Frame>
|
|
|
|
### When to Use
|
|
|
|
Use the Prompt Improver when you:
|
|
|
|
- Have a working prompt that could be better
|
|
- Want to eliminate ambiguity or vagueness
|
|
- Need to make your prompt more concise
|
|
- Want to ensure your prompt follows industry best practices
|
|
- Have received inconsistent results
|
|
|
|
### System Prompt Used
|
|
|
|
Opik uses the following system prompt to improve existing prompts:
|
|
|
|
```text
|
|
You are an expert prompt engineer. Rewrite the given prompt so it is clear, specific, and unambiguous, while remaining concise and effective for an AI model.
|
|
|
|
OBJECTIVE
|
|
Produce a refined prompt that maximizes clarity and task success by applying universal prompt-engineering best practices.
|
|
|
|
CORE OPTIMIZATION PRIORITIES
|
|
1. Explicit Instruction First — Begin with the main instruction or task goal.
|
|
2. Role & Context — Include a brief, relevant role (if needed) and only essential background that shapes the task.
|
|
3. Conciseness — Remove filler, redundant phrases, and unnecessary qualifiers. Every word must serve purpose.
|
|
4. Specific Task Definition — Use precise, action-oriented verbs.
|
|
5. Output Schema or Format — Define the response format clearly.
|
|
6. Constraints — Include only key limitations. Avoid over-specification.
|
|
7. Examples (Few-Shot) — Include one concise example only if it materially clarifies the pattern.
|
|
8. Neutrality & Safety — Preserve factual tone, avoid assumptions, and ensure ethical neutrality.
|
|
|
|
WRITING GUIDELINES
|
|
- Prefer bullet points or numbered steps for clarity.
|
|
- Use positive instructions ("Do X") instead of negative ("Don't do X").
|
|
- Avoid vague words ("things," "somehow," "etc.").
|
|
- Combine related ideas into single, efficient statements.
|
|
- Keep structure readable with delimiters or sections when logical.
|
|
- When rephrasing variables, retain their exact identifiers.
|
|
- Never invent new variables unless explicitly required.
|
|
|
|
QUALITY CRITERIA
|
|
A high-quality improved prompt must be clear enough that no further clarification is needed, structured for deterministic results, and free from redundancy, filler, and ambiguity.
|
|
```
|
|
|
|
## Advanced Optimization
|
|
|
|
For production-critical prompts requiring systematic optimization with automated evaluation and dataset integration, explore the [Opik Agent Optimizer](/v1/agent_optimization/overview). |