Skip to content
Closed
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
Empty file added router/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion router/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from fastapi.staticfiles import StaticFiles
from pathlib import Path
from urllib.parse import urlparse
from circuit_breaker import get_breaker
from router.circuit_breaker import get_breaker
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator, RootModel
from typing import Dict, Optional, Union

Expand Down
8 changes: 5 additions & 3 deletions scripts/benchmark_classifier.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
"""Benchmark gemma4-26a4b-routing classifier against labeled dataset."""
import os
import json, urllib.request, urllib.error, time, sys
import json, urllib.request, urllib.error, time
import concurrent.futures
import threading
from collections import defaultdict, Counter
from pathlib import Path

# Shared chat response parser (used by verification scripts too)
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from chat_helpers import parse_chat_response

# Load dataset
dataset_path = Path(__file__).resolve().parent.parent / "data" / "classified_dataset.json"
Expand Down
3 changes: 0 additions & 3 deletions scripts/benchmark_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
# Set CONFIG_PATH and ROUTER_API_KEY for import
os.environ["CONFIG_PATH"] = str(Path(__file__).resolve().parent.parent / "router" / "config.yaml")
os.environ["ROUTER_API_KEY"] = "local-token"
# Add the parent directory and the router directory to the path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "router"))

from router.main import estimate_prompt_tokens, METADATA_OVERHEAD

Expand Down
8 changes: 5 additions & 3 deletions scripts/classify_direct.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Direct classification of Hermes prompts using gemma4-26a4b-routing."""
import os
import json, urllib.request, time, sys
import json, urllib.request, time
from pathlib import Path

# Shared chat response parser (used by verification scripts too)
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from chat_helpers import parse_chat_response

PROMPT_TEMPLATE = """Classify the coding task complexity. Output ONLY the tier name.

Expand Down
6 changes: 4 additions & 2 deletions scripts/reclassify_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from collections import Counter

# Shared chat response parser (used by verification scripts too)
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from chat_helpers import parse_chat_response

TIERS = ['agent-simple-core','agent-medium-core','agent-complex-core','agent-reasoning-core','agent-advanced-core']

Expand Down
6 changes: 4 additions & 2 deletions scripts/retry_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
from collections import Counter

# Shared chat response parser (used by verification scripts too)
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from chat_helpers import parse_chat_response

PROMPT_TEMPLATE = """Classify the coding task complexity. Output ONLY the tier name.

Expand Down
8 changes: 4 additions & 4 deletions scripts/verification/verification_helpers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Shared verification helpers for cooldown and routing tests
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from ..chat_helpers import parse_chat_response
import os
import uuid
import time
Expand Down
4 changes: 0 additions & 4 deletions scripts/verification/verify_breaker.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env python3
"""Verification test for the agy circuit breaker."""

import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))

from router.circuit_breaker import get_breaker

b = get_breaker()
Expand Down
6 changes: 4 additions & 2 deletions scripts/verification/verify_canonical_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
WORKDIR = Path(__file__).resolve().parent.parent.parent

# Import shared chat response parser (also used by classifier scripts)
sys.path.insert(0, str(WORKDIR))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from ..chat_helpers import parse_chat_response


def load_env(dev: bool = False) -> dict:
Expand Down
6 changes: 4 additions & 2 deletions scripts/verification/verify_ollama_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
from pathlib import Path

WORKDIR = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(WORKDIR))
from scripts.chat_helpers import parse_chat_response
try:
from scripts.chat_helpers import parse_chat_response
except ImportError:
from ..chat_helpers import parse_chat_response

URL = "http://localhost:5000/v1/chat/completions"

Expand Down