Initial commit: PROMETHEUS v0.1.0 - Prompt optimizer

- Clean architecture (domain/application/infrastructure)
- DSPy-based evolution engine with scoring
- CLI via pyproject.toml entry point
- Unit + integration tests (~300 tests)
- Configs for glm-5.1 and glm-4.5-air models
- Z.AI endpoint integration
This commit is contained in:
2026-03-29 11:44:03 +00:00
commit 837a44970f
49 changed files with 6599 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
# PROMETHEUS Configuration File
# ==================================
# The initial prompt to optimize
seed_prompt: |
You are an expert assistant in contract analysis.
Analyze the provided text and identify potentially abusive clauses.
Be precise and cite the relevant passages.
# Task description (used to generate synthetic inputs)
task_description: |
Legal analysis of contracts to identify abusive clauses.
The assistant must examine a contract text and flag
any clause that could be considered abusive under
French consumer protection law.
# LLM models (DSPy/litellm format)
task_model: "openai/gpt-4o-mini"
judge_model: "openai/gpt-4o"
proposer_model: "openai/gpt-4o"
synth_model: "openai/gpt-4o"
# Evolution parameters
max_iterations: 30
n_synthetic_inputs: 20
minibatch_size: 5
seed: 42

View File

@@ -0,0 +1,20 @@
# PROMETHEUS Test Config — Code Review Task
# ===========================================
seed_prompt: |
You are a helpful coding assistant. Help the user write code.
task_description: |
Code review and bug detection assistant. Reviews code snippets and
identifies bugs, security issues, and style problems. The assistant
receives a code snippet and must produce a structured review.
task_model: "openai/glm-4.5-air"
judge_model: "openai/glm-4.5-air"
proposer_model: "openai/glm-4.5-air"
synth_model: "openai/glm-4.5-air"
max_iterations: 5
n_synthetic_inputs: 8
minibatch_size: 3
seed: 123

View File

@@ -0,0 +1,26 @@
# PROMETHEUS Test Config — Real run with Z.AI
# =============================================
seed_prompt: |
You are a helpful coding assistant. Help the user write clean, bug-free code.
When reviewing code, identify bugs and suggest improvements.
task_description: |
Code review and bug detection assistant. Reviews code snippets and
identifies bugs, security issues, and style problems. The assistant
receives a code snippet and must produce a structured review.
task_model: "openai/glm-4.5-air"
judge_model: "openai/glm-4.5-air"
proposer_model: "openai/glm-4.5-air"
synth_model: "openai/glm-4.5-air"
# API configuration for z.ai
api_base: "https://api.z.ai/api/paas/v4"
api_key_env: "GLM_API_KEY"
# Evolution parameters (reduced for quick test)
max_iterations: 3
n_synthetic_inputs: 3
minibatch_size: 2
seed: 42

34
examples/zai_config.yaml Normal file
View File

@@ -0,0 +1,34 @@
# PROMETHEUS Configuration File — z.ai Backend
# ==================================
# REQUIRES env vars:
# export OPENAI_API_KEY=<your_glm_key>
# (api_base is configured below)
# The initial prompt to optimize
seed_prompt: |
You are an expert assistant in contract analysis.
Analyze the provided text and identify potentially abusive clauses.
Be precise and cite the relevant passages.
# Task description (used to generate synthetic inputs)
task_description: |
Legal analysis of contracts to identify abusive clauses.
The assistant must examine a contract text and flag
any clause that could be considered abusive under
French consumer protection law.
# LLM models (DSPy/litellm format with openai/ prefix for z.ai)
task_model: "openai/glm-4.5-air"
judge_model: "openai/glm-4.5-air"
proposer_model: "openai/glm-4.5-air"
synth_model: "openai/glm-4.5-air"
# API configuration for z.ai
api_base: "https://api.z.ai/api/paas/v4"
api_key_env: "OPENAI_API_KEY"
# Evolution parameters (reduced for functional testing)
max_iterations: 3
n_synthetic_inputs: 5
minibatch_size: 3
seed: 42