Agent skill
prompt-engineering-inconsistent-outputs
Sub-skill of prompt-engineering: Inconsistent Outputs (+2).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/ai/prompting/prompt-engineering/inconsistent-outputs
SKILL.md
Inconsistent Outputs (+2)
Inconsistent Outputs
# Lower temperature for consistency
response = client.chat.completions.create(
model="gpt-4",
messages=messages,
temperature=0.1 # Lower = more consistent
)
# Or use seed for reproducibility
response = client.chat.completions.create(
model="gpt-4",
messages=messages,
seed=42
)
Outputs Too Long/Short
# Control length explicitly
prompt = """
Provide a summary in exactly 3 sentences.
Do not exceed 100 words.
"""
# Or use max_tokens
response = client.chat.completions.create(
model="gpt-4",
messages=messages,
max_tokens=150
)
Wrong Format
# Be very explicit about format
prompt = """
Return ONLY a JSON object. No explanation, no markdown.
{
"key": "value"
}
"""
# Validate and retry
def get_json_response(prompt, max_retries=3):
for attempt in range(max_retries):
response = llm(prompt)
try:
return json.loads(response)
except json.JSONDecodeError:
prompt = f"Your response was not valid JSON. Try again.\n\n{prompt}"
raise ValueError("Failed to get valid JSON")
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?