Compare commits
No commits in common. "45417068aed11636789379c75ac862937268c3d7" and "e14d2c62da611bd6ef4a244b816cb2f16c95e8d9" have entirely different histories.
45417068ae
...
e14d2c62da
@ -26,7 +26,7 @@ python3 -m venv /home/bigt/AI/llm/venv
|
|||||||
cat > /home/bigt/AI/llm/.env << 'EOF'
|
cat > /home/bigt/AI/llm/.env << 'EOF'
|
||||||
# Sidecar configuration
|
# Sidecar configuration
|
||||||
MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml
|
MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml
|
||||||
SIDECAR_PORT=8080
|
SIDECAR_PORT=8081
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 5. Enable and start the service
|
# 5. Enable and start the service
|
||||||
@ -57,7 +57,7 @@ curl http://10.0.4.100:9001/v1/models
|
|||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
|----------|---------|-------------|
|
|----------|---------|-------------|
|
||||||
| `MANIFEST_PATH` | `/home/bigt/AI/llm/manifest.yaml` | Path to the YAML manifest file |
|
| `MANIFEST_PATH` | `/home/bigt/AI/llm/manifest.yaml` | Path to the YAML manifest file |
|
||||||
| `SIDECAR_PORT` | `8080` | Port the sidecar listens on |
|
| `SIDECAR_PORT` | `8081` | Port the sidecar listens on |
|
||||||
|
|
||||||
### Manifest Format
|
### Manifest Format
|
||||||
|
|
||||||
|
|||||||
@ -10,11 +10,11 @@ WorkingDirectory=/home/bigt/AI/llm
|
|||||||
# Environment
|
# Environment
|
||||||
EnvironmentFile=-/home/bigt/AI/llm/.env
|
EnvironmentFile=-/home/bigt/AI/llm/.env
|
||||||
Environment=MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml
|
Environment=MANIFEST_PATH=/home/bigt/AI/llm/manifest.yaml
|
||||||
Environment=SIDECAR_PORT=8080
|
Environment=SIDECAR_PORT=8081
|
||||||
Environment=PATH=/home/bigt/AI/llm/venv/bin:/usr/local/bin:/usr/bin:/bin
|
Environment=PATH=/home/bigt/AI/llm/venv/bin:/usr/local/bin:/usr/bin:/bin
|
||||||
|
|
||||||
# Use the sidecar's venv — install deps via deploy/README.md
|
# Use the sidecar's venv — install deps via deploy/README.md
|
||||||
ExecStart=/home/bigt/AI/llm/venv/bin/uvicorn sidecar.app:app --host 0.0.0.0 --port 8080
|
ExecStart=/home/bigt/AI/llm/venv/bin/uvicorn sidecar.app:app --host 0.0.0.0 --port 8081
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|
||||||
|
|||||||
2
main.py
2
main.py
@ -13,7 +13,7 @@ from dotenv import load_dotenv
|
|||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# ─── Configuration ───────────────────────────────────────────────────────────
|
# ─── Configuration ───────────────────────────────────────────────────────────
|
||||||
SIDECAR_URL = os.getenv("SIDECAR_URL", "http://10.0.4.11:8080")
|
SIDECAR_URL = os.getenv("SIDECAR_URL", "http://10.0.4.11:8081")
|
||||||
MAIN_PC_BASE = os.getenv("MAIN_PC_URL", "http://10.0.4.11:8080/v1").removesuffix("/v1")
|
MAIN_PC_BASE = os.getenv("MAIN_PC_URL", "http://10.0.4.11:8080/v1").removesuffix("/v1")
|
||||||
FALLBACK_SLM_URL = os.getenv("FALLBACK_SLM_URL", "http://10.0.4.200:8080/v1").removesuffix("/v1")
|
FALLBACK_SLM_URL = os.getenv("FALLBACK_SLM_URL", "http://10.0.4.200:8080/v1").removesuffix("/v1")
|
||||||
OPENROUTER_API_KEY=os.getenv("OPENROUTER_API_KEY", "")
|
OPENROUTER_API_KEY=os.getenv("OPENROUTER_API_KEY", "")
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from sidecar.manifest import load_manifest
|
|||||||
|
|
||||||
# Configuration from environment
|
# Configuration from environment
|
||||||
MANIFEST_PATH = os.getenv("MANIFEST_PATH", "/home/bigt/AI/llm/manifest.yaml")
|
MANIFEST_PATH = os.getenv("MANIFEST_PATH", "/home/bigt/AI/llm/manifest.yaml")
|
||||||
SIDECAR_PORT = int(os.getenv("SIDECAR_PORT", "8080"))
|
SIDECAR_PORT = int(os.getenv("SIDECAR_PORT", "8081"))
|
||||||
LLAMA_SERVER_PORT = 8080
|
LLAMA_SERVER_PORT = 8080
|
||||||
|
|
||||||
# Global state
|
# Global state
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from unittest.mock import patch
|
|||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def patch_router_urls():
|
def patch_router_urls():
|
||||||
"""Patch router URLs for all tests in this package."""
|
"""Patch router URLs for all tests in this package."""
|
||||||
with patch("main.SIDECAR_URL", "http://localhost:8080"), \
|
with patch("main.SIDECAR_URL", "http://localhost:8081"), \
|
||||||
patch("main.MAIN_PC_BASE", "http://localhost:8080"), \
|
patch("main.MAIN_PC_BASE", "http://localhost:8080"), \
|
||||||
patch("main.FALLBACK_SLM_URL", "http://localhost:9999"), \
|
patch("main.FALLBACK_SLM_URL", "http://localhost:9999"), \
|
||||||
patch("main.OPENROUTER_API_KEY", "test-key"), \
|
patch("main.OPENROUTER_API_KEY", "test-key"), \
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class TestOpenRouterFallback:
|
|||||||
async def run_test():
|
async def run_test():
|
||||||
with respx.mock:
|
with respx.mock:
|
||||||
# Sidecar is down
|
# Sidecar is down
|
||||||
respx.get("http://localhost:8080/models/status").mock(
|
respx.get("http://localhost:8081/models/status").mock(
|
||||||
side_effect=Exception("connection refused")
|
side_effect=Exception("connection refused")
|
||||||
)
|
)
|
||||||
# OpenRouter works
|
# OpenRouter works
|
||||||
@ -84,7 +84,7 @@ class TestDeprecatedHeaderRemoved:
|
|||||||
"""Router does not route based on x-intelligence-level: High."""
|
"""Router does not route based on x-intelligence-level: High."""
|
||||||
async def run_test():
|
async def run_test():
|
||||||
with respx.mock:
|
with respx.mock:
|
||||||
respx.get("http://localhost:8080/models/status").mock(
|
respx.get("http://localhost:8081/models/status").mock(
|
||||||
return_value=Response(200, json={"active_profile": "qwen-3-8b", "llama_server_running": True})
|
return_value=Response(200, json={"active_profile": "qwen-3-8b", "llama_server_running": True})
|
||||||
)
|
)
|
||||||
# Should route to Main PC regardless of header
|
# Should route to Main PC regardless of header
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class TestFallbackChain:
|
|||||||
async def run_test():
|
async def run_test():
|
||||||
with respx.mock:
|
with respx.mock:
|
||||||
# Sidecar is down — triggers fallback chain
|
# Sidecar is down — triggers fallback chain
|
||||||
respx.get("http://localhost:8080/models/status").mock(
|
respx.get("http://localhost:8081/models/status").mock(
|
||||||
return_value=Response(503, json={"status": "error", "message": "not ready"})
|
return_value=Response(503, json={"status": "error", "message": "not ready"})
|
||||||
)
|
)
|
||||||
# OpenRouter fails with network error
|
# OpenRouter fails with network error
|
||||||
@ -50,7 +50,7 @@ class TestFallbackChain:
|
|||||||
async def run_test():
|
async def run_test():
|
||||||
with respx.mock:
|
with respx.mock:
|
||||||
# Sidecar down
|
# Sidecar down
|
||||||
respx.get("http://localhost:8080/models/status").mock(
|
respx.get("http://localhost:8081/models/status").mock(
|
||||||
side_effect=Exception("connection refused")
|
side_effect=Exception("connection refused")
|
||||||
)
|
)
|
||||||
# OpenRouter down
|
# OpenRouter down
|
||||||
@ -76,7 +76,7 @@ class TestFallbackChain:
|
|||||||
async def run_test():
|
async def run_test():
|
||||||
with respx.mock:
|
with respx.mock:
|
||||||
# Sidecar down, OpenRouter down
|
# Sidecar down, OpenRouter down
|
||||||
respx.get("http://localhost:8080/models/status").mock(
|
respx.get("http://localhost:8081/models/status").mock(
|
||||||
side_effect=Exception("connection refused")
|
side_effect=Exception("connection refused")
|
||||||
)
|
)
|
||||||
respx.post("https://openrouter.ai/v1/chat/completions").mock(
|
respx.post("https://openrouter.ai/v1/chat/completions").mock(
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from httpx import Response, ASGITransport, AsyncClient
|
|||||||
|
|
||||||
from main import app as router_app
|
from main import app as router_app
|
||||||
|
|
||||||
SIDECAR_URL = "http://localhost:8080"
|
SIDECAR_URL = "http://localhost:8081"
|
||||||
MAIN_PC_URL = "http://localhost:8080"
|
MAIN_PC_URL = "http://localhost:8080"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from httpx import Response, ASGITransport, AsyncClient
|
|||||||
|
|
||||||
from main import app as router_app
|
from main import app as router_app
|
||||||
|
|
||||||
SIDECAR_URL = "http://localhost:8080"
|
SIDECAR_URL = "http://localhost:8081"
|
||||||
MAIN_PC_URL = "http://localhost:8080"
|
MAIN_PC_URL = "http://localhost:8080"
|
||||||
FALLBACK_URL = "http://localhost:9999"
|
FALLBACK_URL = "http://localhost:9999"
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from httpx import Response, ASGITransport, AsyncClient
|
|||||||
|
|
||||||
from main import app as router_app
|
from main import app as router_app
|
||||||
|
|
||||||
SIDECAR_URL = "http://localhost:8080"
|
SIDECAR_URL = "http://localhost:8081"
|
||||||
MAIN_PC_URL = "http://localhost:8080"
|
MAIN_PC_URL = "http://localhost:8080"
|
||||||
FALLBACK_URL = "http://localhost:9999"
|
FALLBACK_URL = "http://localhost:9999"
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ from httpx import Response, ASGITransport, AsyncClient
|
|||||||
|
|
||||||
from main import app as router_app
|
from main import app as router_app
|
||||||
|
|
||||||
SIDECAR_URL = "http://localhost:8080"
|
SIDECAR_URL = "http://localhost:8081"
|
||||||
|
|
||||||
|
|
||||||
def test_v1_models_returns_profiles_from_sidecar():
|
def test_v1_models_returns_profiles_from_sidecar():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user