一键导入
opik-prompt
Manage prompt versions and run comparisons. Use when versioning prompts, comparing prompt variations, or optimizing prompt performance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage prompt versions and run comparisons. Use when versioning prompts, comparing prompt variations, or optimizing prompt performance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create and run evaluations on your LLM outputs. Use when testing prompts, measuring quality, comparing models, or creating evaluation datasets.
Configure Opik SDK for LLM observability. Use when setting up a new project, connecting to Opik Cloud, or configuring self-hosted Opik.
Add LLM tracing and observability to your code. Use when instrumenting functions, integrating frameworks (LangChain, OpenAI, etc.), or adding custom spans.
| name | opik-prompt |
| description | Manage prompt versions and run comparisons. Use when versioning prompts, comparing prompt variations, or optimizing prompt performance. |
Create: client.create_prompt(name="my-prompt", prompt="template")
Get: client.get_prompt(name="my-prompt")
Version: client.get_prompt(name="my-prompt", version=2)
Note: Prompt management APIs are Python-primary in the Opik SDK.
Python: Run opik healthcheck
TypeScript: Verify config exists at ~/.opik.config or env vars are set
✅ "Connection successful" / config exists → Continue below
❌ "Connection failed" / no config → Run /opik-setup first, then return here
from opik import Opik
client = Opik()
# Create a new prompt
prompt = client.create_prompt(
name="qa-assistant",
prompt="Answer this question: {question}\n\nContext: {context}"
)
prompt = client.get_prompt(name="qa-assistant")
print(prompt.prompt) # The template string
prompt = client.get_prompt(name="qa-assistant", version=1)
prompt = client.get_prompt(name="qa-assistant")
formatted = prompt.format(
question="What is Python?",
context="Python is a programming language."
)
# "Answer this question: What is Python?\n\nContext: Python is a programming language."
from openai import OpenAI
client = OpenAI()
opik = Opik()
prompt = opik.get_prompt(name="qa-assistant")
formatted = prompt.format(question=user_question, context=retrieved_context)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": formatted}]
)
Creating a prompt with the same name automatically creates a new version:
# Version 1
client.create_prompt(name="qa-assistant", prompt="Answer: {question}")
# Version 2 (new version, same name)
client.create_prompt(name="qa-assistant", prompt="Please answer: {question}")
See VERSIONING.md for detailed version management.
/opik-eval - Evaluate prompts against datasets