Skip to content

Small consolidations: toolbox HTTP helpers, PII regex bug, cosine epsilon, graph checkpoint #147

Description

@johnnichev

Small consolidations (toolbox HTTP, PII regex, cosine epsilon)

A grab-bag of low-risk single-area cleanups:

  • Toolbox HTTP helpers_api_error is structurally identical in notion_tools.py:44-53 and discord_tools.py:44-53; _USER_AGENT is byte-identical in github_tools.py:23 / search_tools.py:22 (and stale — pinned selectools/0.21 while the package is 1.0, duplicated so it stays stale in two places); _DEFAULT_TIMEOUT=30 ×4. Share via a new toolbox/_http.py.
  • PII regex divergenceguardrails/pii.py:18-26 and evals/evaluators.py:424-431 duplicate PII patterns and have already diverged: the eval email pattern has a buggy [A-Z|a-z] character class containing a literal |. Share via a neutral selectools/_pii_patterns.py and fix the regex.
  • NumPy cosine similarity (M8) — rag/stores/memory.py:163-172 adds + 1e-8 epsilon; rag/stores/sqlite.py:201-225 does not (guards norm==0 via continue). Share a cosine_numpy(matrix, query) to resolve the behavioral difference. (Leave cache_semantic.py — deliberately NumPy-free.)
  • Graph interrupt-checkpoint block ×6 in orchestration/graph.py — extract _make_interrupt_checkpoint(...) only (these participate in BUG-04/05 correctness, so drift = bug). Do NOT merge the full arun/astream bodies.

Acceptance

  • Each box: the duplication is consolidated, the PII regex bug is fixed, the stale _USER_AGENT is corrected once; tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cleanupCode cleanup, refactoring, dead-code removalgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions