Loading...
Loading...
Compare original and translation side by side
Skill by ara.so — Hermes Skills collection.
由ara.so开发的技能——Hermes Skills 合集。
undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedfrom evolution.skills.evolve_skill import evolve_skill
from evolution.eval.dataset import EvalDataset, EvalExamplefrom evolution.skills.evolve_skill import evolve_skill
from evolution.eval.dataset import EvalDataset, EvalExampleundefinedundefinedfrom evolution.gepa.optimizer import GEPAOptimizer
from evolution.gepa.trace import ExecutionTracefrom evolution.gepa.optimizer import GEPAOptimizer
from evolution.gepa.trace import ExecutionTraceundefinedundefinedfrom evolution.gepa.mutations import (
AddDetailMutation,
SimplifyMutation,
ReframeMutation,
ExampleMutation
)
optimizer = GEPAOptimizer(
mutations=[
AddDetailMutation(weight=0.4),
SimplifyMutation(weight=0.2),
ReframeMutation(weight=0.2),
ExampleMutation(weight=0.2)
]
)from evolution.gepa.mutations import (
AddDetailMutation,
SimplifyMutation,
ReframeMutation,
ExampleMutation
)
optimizer = GEPAOptimizer(
mutations=[
AddDetailMutation(weight=0.4),
SimplifyMutation(weight=0.2),
ReframeMutation(weight=0.2),
ExampleMutation(weight=0.2)
]
)evolution_config.yamlundefinedevolution_config.yamlundefined
Load and use:
```python
from evolution.config import EvolutionConfig
config = EvolutionConfig.from_yaml("evolution_config.yaml")
result = evolve_skill(
skill_name="github-code-review",
config=config
)
加载并使用:
```python
from evolution.config import EvolutionConfig
config = EvolutionConfig.from_yaml("evolution_config.yaml")
result = evolve_skill(
skill_name="github-code-review",
config=config
)from evolution.constraints import (
TestSuiteConstraint,
SizeLimitConstraint,
SemanticPreservationConstraint,
CachingCompatibilityConstraint
)
constraints = [
TestSuiteConstraint(
test_command="pytest tests/ -q",
required_pass_rate=1.0
),
SizeLimitConstraint(
max_skill_kb=15,
max_tool_desc_chars=500
),
SemanticPreservationConstraint(
drift_threshold=0.15,
embedding_model="text-embedding-3-small"
),
CachingCompatibilityConstraint(
allow_mid_conversation_changes=False
)
]from evolution.constraints import (
TestSuiteConstraint,
SizeLimitConstraint,
SemanticPreservationConstraint,
CachingCompatibilityConstraint
)
constraints = [
TestSuiteConstraint(
test_command="pytest tests/ -q",
required_pass_rate=1.0
),
SizeLimitConstraint(
max_skill_kb=15,
max_tool_desc_chars=500
),
SemanticPreservationConstraint(
drift_threshold=0.15,
embedding_model="text-embedding-3-small"
),
CachingCompatibilityConstraint(
allow_mid_conversation_changes=False
)
]undefinedundefinedfrom evolution.callbacks import (
LoggingCallback,
MetricsCallback,
CheckpointCallback
)
callbacks = [
LoggingCallback(verbose=True),
MetricsCallback(
track_metrics=["fitness", "diversity", "constraint_violations"]
),
CheckpointCallback(
checkpoint_dir="./checkpoints",
save_every=5 # Save every 5 generations
)
]
result = evolve_skill(
skill_name="github-code-review",
iterations=20,
callbacks=callbacks
)from evolution.callbacks import (
LoggingCallback,
MetricsCallback,
CheckpointCallback
)
callbacks = [
LoggingCallback(verbose=True),
MetricsCallback(
track_metrics=["fitness", "diversity", "constraint_violations"]
),
CheckpointCallback(
checkpoint_dir="./checkpoints",
save_every=5 # 每5代保存一次
)
]
result = evolve_skill(
skill_name="github-code-review",
iterations=20,
callbacks=callbacks
)undefinedundefinedfrom evolution.eval.synthetic import SyntheticDataGenerator
generator = SyntheticDataGenerator(
skill_name="github-code-review",
num_examples=50,
difficulty_distribution={
"easy": 0.3,
"medium": 0.5,
"hard": 0.2
}
)
dataset = generator.generate()
dataset.save("eval_datasets/github-code-review.json")from evolution.eval.synthetic import SyntheticDataGenerator
generator = SyntheticDataGenerator(
skill_name="github-code-review",
num_examples=50,
difficulty_distribution={
"easy": 0.3,
"medium": 0.5,
"hard": 0.2
}
)
dataset = generator.generate()
dataset.save("eval_datasets/github-code-review.json")from evolution.eval.session_extractor import SessionExtractor
extractor = SessionExtractor(
session_db_path="~/.hermes/sessions.db",
skill_filter="github-code-review"
)from evolution.eval.session_extractor import SessionExtractor
extractor = SessionExtractor(
session_db_path="~/.hermes/sessions.db",
skill_filter="github-code-review"
)undefinedundefinedfrom evolution.objectives import (
AccuracyObjective,
LatencyObjective,
TokenEfficiencyObjective
)
optimizer = GEPAOptimizer(
objectives=[
AccuracyObjective(weight=0.5),
LatencyObjective(weight=0.3),
TokenEfficiencyObjective(weight=0.2)
],
pareto_frontier=True # Find Pareto-optimal solutions
)
variants = optimizer.evolve(current_prompt, traces, num_generations=15)from evolution.objectives import (
AccuracyObjective,
LatencyObjective,
TokenEfficiencyObjective
)
optimizer = GEPAOptimizer(
objectives=[
AccuracyObjective(weight=0.5),
LatencyObjective(weight=0.3),
TokenEfficiencyObjective(weight=0.2)
],
pareto_frontier=True # 寻找帕累托最优解
)
variants = optimizer.evolve(current_prompt, traces, num_generations=15)undefinedundefinedfrom evolution.batch import batch_evolve_skills
skills_to_evolve = [
"github-code-review",
"python-debugging",
"api-design",
"docker-optimization"
]
results = batch_evolve_skills(
skills=skills_to_evolve,
iterations=10,
parallel=True,
max_workers=4
)
for skill, result in results.items():
print(f"{skill}: {result.improvement_pct}% improvement")from evolution.batch import batch_evolve_skills
skills_to_evolve = [
"github-code-review",
"python-debugging",
"api-design",
"docker-optimization"
]
results = batch_evolve_skills(
skills=skills_to_evolve,
iterations=10,
parallel=True,
max_workers=4
)
for skill, result in results.items():
print(f"{skill}: 提升{result.improvement_pct}%")undefinedundefinedif result.improvement_pct > 5.0: # Only PR if >5% improvement
pr = create_evolution_pr(
skill_name="github-code-review",
variant_text=result.best_variant,
metrics=result.metrics,
repo_path=os.getenv("HERMES_AGENT_REPO"),
branch_name=f"evolution/github-code-review-{result.run_id}"
)
print(f"Created PR: {pr.url}")undefinedif result.improvement_pct > 5.0: # 仅当提升幅度超过5%时创建PR
pr = create_evolution_pr(
skill_name="github-code-review",
variant_text=result.best_variant,
metrics=result.metrics,
repo_path=os.getenv("HERMES_AGENT_REPO"),
branch_name=f"evolution/github-code-review-{result.run_id}"
)
print(f"已创建PR: {pr.url}")undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedfrom evolution.api import RateLimitedClient
client = RateLimitedClient(
provider="openai",
api_key=os.getenv("OPENAI_API_KEY"),
requests_per_minute=50,
retry_on_limit=True,
backoff_factor=2.0
)from evolution.api import RateLimitedClient
client = RateLimitedClient(
provider="openai",
api_key=os.getenv("OPENAI_API_KEY"),
requests_per_minute=50,
retry_on_limit=True,
backoff_factor=2.0
)undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedhermes-agent-self-evolution/
├── evolution/
│ ├── skills/ # Skill evolution
│ ├── prompts/ # Prompt optimization
│ ├── tools/ # Tool description evolution
│ ├── gepa/ # GEPA optimizer implementation
│ ├── eval/ # Evaluation datasets and metrics
│ ├── constraints/ # Constraint gates
│ └── callbacks/ # Evolution callbacks
├── tests/ # Test suite
├── eval_datasets/ # Evaluation data
└── evolution_config.yaml # Default configurationhermes-agent-self-evolution/
├── evolution/
│ ├── skills/ # 技能进化模块
│ ├── prompts/ # 提示词优化模块
│ ├── tools/ # 工具描述进化模块
│ ├── gepa/ # GEPA优化器实现
│ ├── eval/ # 评估数据集与指标
│ ├── constraints/ # 约束校验模块
│ └── callbacks/ # 进化回调模块
├── tests/ # 测试套件
├── eval_datasets/ # 评估数据
└── evolution_config.yaml # 默认配置文件