| name | agenta-1-prompt-versioning-strategy |
| description | Sub-skill of agenta: 1. Prompt Versioning Strategy (+2). |
| version | 1.0.0 |
| category | ai-prompting |
| type | reference |
| scripts_exempt | true |
1. Prompt Versioning Strategy (+2)
1. Prompt Versioning Strategy
"""Best practices for prompt versioning."""
version_naming = {
"v1.0.0": "Initial production version",
"v1.1.0": "Added context handling",
"v1.1.1": "Fixed edge case in formatting",
"v2.0.0": "Major rewrite with new approach"
}
def create_versioned_prompt(name: str, template: str, metadata: dict):
return {
"name": name,
"template": template,
"metadata": {
"created_by": metadata.get("author"),
"description": metadata.get("description"),
"changelog": metadata.get("changelog"),
"test_results": metadata.get("test_results")
}
}
def promote_to_production(variant_id: str, min_eval_score: float = 0.8):
score = run_evaluation(variant_id)
if score >= min_eval_score:
client.set_default_variant(variant_id)
return True
return False
2. Evaluation Strategy
"""Best practices for prompt evaluation."""
evaluation_criteria = {
"accuracy": {"weight": 0.4, "threshold": 0.8},
"relevance": {"weight": 0.3, "threshold": 0.7},
"coherence": {"weight": 0.2, "threshold": 0.7},
"safety": {"weight": 0.1, "threshold": 0.9}
}
def create_evaluation_set():
return [
{"input": "...", "expected": "...", "category": "basic"},
{"input": "...", "expected": "...", "category": "edge_case"},
{"input": "...", "expected": "...", "category": "adversarial"}
]
def track_evaluation_history(app_name: str, variant_id: str, results: dict):
3. A/B Testing Guidelines
"""Best practices for A/B testing prompts."""
def calculate_sample_size(
baseline_metric: float,
minimum_detectable_effect: float,
alpha: float = 0.05,
power: float = 0.8
) -> int:
pass
def analyze_ab_test(control_results: list, treatment_results: list):
from scipy import stats
t_stat, p_value = stats.ttest_ind(control_results, treatment_results)
return {
"significant": p_value < 0.05,
"p_value": p_value,
"effect_size": (sum(treatment_results)/len(treatment_results) -
sum(control_results)/len(control_results))
}