Some checks failed
- Integrate GPU scoring inline into reasoning/multi_path.py (auto-uses GPU when available) - Integrate GPU deduplication into multi_agent/consensus_engine.py - Add semantic_search() method to memory/semantic_graph.py with GPU acceleration - Integrate GPU training into self_improvement/training.py AutoTrainer - Fix all 758 ruff lint issues (whitespace, import sorting, unused imports, ambiguous vars, undefined names) - Fix all 40 mypy type errors across the codebase (no-any-return, union-attr, arg-type, etc.) - Fix deprecated ruff config keys (select/ignore -> [tool.ruff.lint]) - Add .dockerignore to exclude .venv/, tests/, docs/ from Docker builds - Add type hints and docstrings to verification/outcome.py - Fix E402 import ordering in witness_agent.py - Fix F821 undefined names in vector_pgvector.py and native.py - Fix E741 ambiguous variable names in reflective.py and recommender.py All 276 tests pass. 0 ruff errors. 0 mypy errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
22 lines
1.2 KiB
Python
22 lines
1.2 KiB
Python
from typing import Any
|
|
|
|
from fusionagi._logger import logger
|
|
from fusionagi.schemas.skill import Skill, SkillKind
|
|
|
|
|
|
class SkillInduction:
|
|
def __init__(self, min_occurrences: int = 2) -> None:
|
|
self._min_occurrences = min_occurrences
|
|
def propose_from_traces(self, traces: list[list[dict[str, Any]]], task_ids: list[str] | None = None) -> list[Skill]:
|
|
candidates: list[Skill] = []
|
|
task_ids = task_ids or [f"task_{i}" for i in range(len(traces))]
|
|
for i, trace in enumerate(traces):
|
|
if not trace:
|
|
continue
|
|
step_ids = [t.get("step_id", t.get("tool", "")) for t in trace[:10]]
|
|
steps = [{"id": s, "description": str(s)} for s in step_ids]
|
|
skill_id = f"induced_{task_ids[i] if i < len(task_ids) else i}_{hash(tuple(step_ids)) % 10**6}"
|
|
candidates.append(Skill(skill_id=skill_id, name=f"Induced routine {i}", description=f"From trace: {step_ids[:3]}", kind=SkillKind.WORKFLOW, steps=steps, tool_names=list({t.get("tool", "") for t in trace if t.get("tool")}), version=1))
|
|
logger.info("SkillInduction proposed", extra={"count": len(candidates)})
|
|
return candidates
|