Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions extractive/eval/extractive_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from rapidfuzz import fuzz

import re
import sys
from pathlib import Path

from shared.db_schema import SCHEMA_SQL as _SCHEMA_MIGRATION

Expand Down
1 change: 0 additions & 1 deletion extractive/pipeline/pdf_chunker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations
import re
from dataclasses import dataclass
from pathlib import Path

import pdfplumber

Expand Down
1 change: 0 additions & 1 deletion generative/agents/_litellm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
Vollständige Provider-Liste: https://docs.litellm.ai/docs/providers
"""
from __future__ import annotations
import sys
import time

import litellm
Expand Down
3 changes: 1 addition & 2 deletions generative/agents/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
import threading
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Optional

from generative.config import MODEL_OPUS, CACHE_DIR, BACKEND

# Re-Export für Backwards-Compat — Agenten importieren aus agents.base
from generative.agents.tracing import trace_event, trace_run_start, set_tracing_backend, flush_tracing # noqa: F401
from generative.agents.tracing import _RUN_ID # single source of truth for run ID
from generative.agents.tracing import _RUN_ID # noqa: F401 # re-export, extern genutzt (orchestrator, eval_quality)

# OTel-Tracer für Phoenix. Bleibt None bis orchestrator._setup_phoenix_tracing()
# ihn via set_llm_tracer() explizit setzt (nur bei ATOMIC_AGENT_TRACING=phoenix).
Expand Down
2 changes: 1 addition & 1 deletion generative/agents/context_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import yaml

from generative.config import VAULT, WISSEN, SCRIPTS_DIR # BA_DIR-Import entfernt (v31)
from generative.config import VAULT, SCRIPTS_DIR # BA_DIR-Import entfernt (v31)

# Vault-Ordner die NICHT als existing_concepts zählen
SKIP_DIRS = {"00-inbox", "98-system", "99-archive", "08-dashboards", ".obsidian", ".trash"}
Expand Down
1 change: 0 additions & 1 deletion generative/agents/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Seitenzahl, deutsche Sprache, Akronyme aufgelöst, aliases-Liste, kein Pass-Through.
"""
from __future__ import annotations
import json
import re

from generative.agents.base import call_claude_async
Expand Down
2 changes: 0 additions & 2 deletions generative/agents/langfuse_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
import base64
import json
import os
import time
import uuid
from datetime import datetime, timedelta
from typing import Any


class LangfuseBackend:
Expand Down
1 change: 0 additions & 1 deletion generative/agents/planner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Planner-Agent: TOC + Intro + Fazit + Relevanz-Profil → ConceptPlan."""
from __future__ import annotations

import re

# Generika-Blacklist (portiert aus extractive/gliner_planner.py, angepasst für LLM-Output).
# Fängt seltene LLM-"Ausrutscher" ab wenn trotz Prompt-Vorgabe abstrakte Einzel-Konzepte
Expand Down
1 change: 0 additions & 1 deletion generative/calibration/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from generative.eval_quality_v4 import ( # noqa: E402
_QUALITY_HISTORY as HISTORY_PATH,
eval_note,
print_summary,
save_result,
)
from generative.config import AGENT_VERSION # noqa: E402
Expand Down
1 change: 0 additions & 1 deletion generative/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import os
import sqlite3
import sys
from contextlib import contextmanager
from datetime import datetime
from pathlib import Path
Expand Down
1 change: 0 additions & 1 deletion generative/eval_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from __future__ import annotations
import argparse
import re
import sys
from pathlib import Path


Expand Down
3 changes: 1 addition & 2 deletions generative/eval_dashboard_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import argparse
import json
import sys
import webbrowser
from datetime import datetime
from http.server import BaseHTTPRequestHandler, HTTPServer
Expand Down Expand Up @@ -232,7 +231,7 @@ def _read_calibration_data(allowed_note_paths: set | None = None,
"avg_agree": avg_agree,
"has_labels": n_labeled > 0,
}
except Exception as e:
except Exception:
return {"rows": [], "n_eval": 0, "n_labeled": 0, "avg_agree": None, "has_labels": False}


Expand Down
2 changes: 0 additions & 2 deletions generative/eval_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path

from generative.config import CACHE_DIR

Expand Down
3 changes: 1 addition & 2 deletions generative/eval_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ def _page_num_from_str(page_str: str) -> int | None:
def _semantic_score(quote: str, page_text: str) -> float:
"""Sentence-Transformers Cosine-Similarity. 0.0 wenn Modell nicht geladen."""
try:
from generative.pipeline.embeddings import _model, cosine
import numpy as np
from generative.pipeline.embeddings import _model
model = _model()
if model is None:
return 0.0
Expand Down
3 changes: 1 addition & 2 deletions generative/eval_quality_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
sys.exit("rapidfuzz fehlt: pip install rapidfuzz")

from generative.agents import base
from generative.config import AGENT_VERSION, CACHE_DIR, EVAL_ADAPTIVE_K_HIGH, EVAL_ADAPTIVE_K_MID, MODEL_OPUS, MODEL_CONFIG, QUALITY_HISTORY
from generative.config import AGENT_VERSION, MODEL_OPUS, MODEL_CONFIG, QUALITY_HISTORY
from decision_engine import ClaimDecision, ClaimInput, DEFAULT_CONFIG, Label, determine_decision
from decision_engine.aggregation import aggregate as aggregate_decisions
from decision_engine.models import QualityFlag
Expand Down Expand Up @@ -558,7 +558,6 @@ def _aggregate(
# Atomic-Agent-spezifische Felder wie Wilson-CI, PDF-Chunk-Zahl und LLM-Usage an.
valid_claims = int(engine_metrics["valid_claims"])
parse_error_count = counts[PARSE_ERROR]
confirmed = counts[SUPPORTED_EXACT] + counts[SUPPORTED_PARAPHRASE]
hallucinated = counts[NOT_IN_CONTEXT] + counts[CONTRADICTED]
with_evidence = sum(1 for score in claim_scores if score["evidence"])
evidence_verified_count = sum(1 for score in claim_scores if score["evidence_verified"] is True)
Expand Down
1 change: 0 additions & 1 deletion generative/migrate_jsonl_to_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import argparse
import json
import sys
from pathlib import Path

from generative import db
Expand Down
1 change: 0 additions & 1 deletion generative/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def _span(name: str, **attrs):
CRITIC_AUTO_THRESHOLD,
ER_BODY_COSINE_THRESHOLD,
ER_TITLE_COSINE_THRESHOLD,
ER_BLOCKING_JACCARD,
ER_MAX_TOKEN_DIFF,
ER_HUB_GENERIC_TOKENS,
ENABLE_ENTITY_RESOLUTION,
Expand Down
1 change: 0 additions & 1 deletion generative/pipeline/acronym_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def extract_acronym_pairs(text: str) -> dict[str, str]:
- „Short Form (Long Form)" — typisch in Lehrbüchern, Glossaren
"""
pairs: dict[str, str] = {}
seen_orders: dict[str, str] = {} # Prävention von späteren falschen Re-Definitionen

for match in _PAT_LONG_PAREN_SHORT.finditer(text):
before = match.group(1).strip()
Expand Down
1 change: 0 additions & 1 deletion generative/pipeline/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from __future__ import annotations
import re
import threading
from functools import lru_cache

# Singleton-Modell — Lade-Zeit ~3s, danach pro Embedding ~10ms
_MODEL = None
Expand Down
2 changes: 1 addition & 1 deletion generative/pipeline/pdf_chunker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re
import subprocess
import sys
from dataclasses import dataclass, field
from dataclasses import dataclass
from pathlib import Path

from generative.config import CHUNK_WORDS, MIN_WORDS_PER_PAGE
Expand Down
3 changes: 1 addition & 2 deletions generative/pipeline/vault_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import yaml

from generative.config import VAULT, WISSEN, INBOX, LITERATURE_DIR, CRITIC_AUTO_THRESHOLD
from generative.config import VAULT, INBOX, LITERATURE_DIR, CRITIC_AUTO_THRESHOLD
from generative.schemas.atomic_note import AtomicNoteDraft


Expand Down Expand Up @@ -565,7 +565,6 @@ def find_existing_in_inbox(source_file: str, title: str,
if is_pristine_pipeline_note(text):
return f
return matches[0][0]
return None


def _read_source_field(note_path: Path) -> str | None:
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_acronym_fix.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Tests für Schwartz-Hearst-basierte Akronym-Erkennung + Body-Insertion."""
from __future__ import annotations
import sys
from pathlib import Path


from generative.pipeline.acronym_fix import (
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_chapter_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
split_by_chapters() als auch in drop_frontmatter_pages().
"""
from __future__ import annotations
import sys
from pathlib import Path


from generative.pipeline.pdf_chunker import (
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_chunk_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
extract_overview()-Output behalten (Planner-Recall-Decke).
"""
from __future__ import annotations
import sys
from pathlib import Path


import pytest
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Tests für den atomic-notes-Konsolen-Entry-Point (generative/cli.py)."""
from __future__ import annotations

import pytest

from generative import cli

Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_collect_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
`note_claim_agreement` paart stattdessen Mensch- und Pipeline-Label pro claim_idx.
"""
from __future__ import annotations
import sys
from pathlib import Path


from generative.calibration.collect import note_claim_agreement
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_collect_db_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from __future__ import annotations
import json
import sqlite3
import sys
from pathlib import Path


Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import importlib
import sys
from pathlib import Path

import pytest

Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_cost.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from unittest.mock import patch
from generative.config import compute_cost_per_call

Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_cross_draft_hub_suggest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
Seiteneffektfrei — schlägt nur vor, erzeugt keine Note.
"""
from __future__ import annotations
import sys
from pathlib import Path


from generative.schemas.atomic_note import AtomicNoteDraft
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_dashboard_avg_agree.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
(katastrophale Fehlkalibrierung) statt "–" (keine Daten).
"""
from __future__ import annotations
import sys
from pathlib import Path


from generative.eval_dashboard_server import _avg_agreement
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sqlite3
import tempfile
import os
import sys


def test_pipeline_run_has_cost_usd():
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_decision_engine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

import sys
from pathlib import Path


from decision_engine import ClaimDecision, ClaimInput, DEFAULT_CONFIG, Label, determine_decision
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_doctor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Tests für atomic-notes doctor (generative/doctor.py) — Preflight-Checks als pure Funktionen."""
from __future__ import annotations

from pathlib import Path

from generative import doctor

Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_dry_run_eval_scope.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import sys
from pathlib import Path


Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_er_stage1_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
(b) Hub-Generic-Blocklist: shorter darf nicht ⊆ ER_HUB_GENERIC_TOKENS sein
"""
from __future__ import annotations
import sys
from pathlib import Path


from generative.orchestrator import er_stage1_decision
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_figure_alt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"""
from __future__ import annotations

import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_figure_feasibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"""
from __future__ import annotations

import sys
from pathlib import Path


from generative.pipeline.pdf_chunker import Chunk
Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_inline_eval_toggle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

import sys
from pathlib import Path


from generative.orchestrator import inline_eval_enabled
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_overwrite_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
überschreiben (Datenverlust). content-hash-Guard: pristine Pipeline-Notes dürfen
idempotent überschrieben werden, editierte nicht.
"""
from pathlib import Path

from generative.schemas.atomic_note import AtomicNoteDraft

Expand Down
2 changes: 0 additions & 2 deletions generative/tests/test_pdf_chunker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"""
from __future__ import annotations
import re
import sys
from pathlib import Path


from generative.pipeline.pdf_chunker import drop_frontmatter_pages, page_range_of_text, concept_text_window
Expand Down
1 change: 0 additions & 1 deletion generative/tests/test_pdf_enrich.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
from pathlib import Path

def test_extract_text_returns_string(tmp_path):
"""extract_text() gibt String zurück (auch bei leerer PDF)."""
Expand Down
Loading
Loading