fix(ai): isolate heavy Ollama workloads from GCP alert lane
This commit is contained in:
@@ -16,27 +16,37 @@ from src.core.config import settings
|
||||
OllamaWorkloadType = Literal[
|
||||
"interactive",
|
||||
"healthcheck",
|
||||
"alert_fast",
|
||||
"batch",
|
||||
"embedding",
|
||||
"rag",
|
||||
"code_review",
|
||||
"shadow",
|
||||
"canary",
|
||||
"deep_rca",
|
||||
"image_analysis",
|
||||
"hermes",
|
||||
"local_required",
|
||||
"privacy_sensitive",
|
||||
"dr",
|
||||
]
|
||||
|
||||
_GCP_B_PREFERRED_WORKLOADS = {
|
||||
_GCP_A_PREFERRED_WORKLOADS = {
|
||||
"interactive",
|
||||
"healthcheck",
|
||||
"alert_fast",
|
||||
}
|
||||
|
||||
_LOCAL_PREFERRED_WORKLOADS = {
|
||||
"batch",
|
||||
"embedding",
|
||||
"rag",
|
||||
"code_review",
|
||||
"shadow",
|
||||
"canary",
|
||||
}
|
||||
|
||||
_LOCAL_PREFERRED_WORKLOADS = {
|
||||
"deep_rca",
|
||||
"image_analysis",
|
||||
"hermes",
|
||||
"local_required",
|
||||
"privacy_sensitive",
|
||||
"dr",
|
||||
@@ -68,20 +78,28 @@ def resolve_ollama_selection(
|
||||
secondary = cfg.OLLAMA_SECONDARY_URL
|
||||
fallback = cfg.OLLAMA_FALLBACK_URL
|
||||
|
||||
if workload_type in _GCP_B_PREFERRED_WORKLOADS and secondary:
|
||||
if workload_type in _LOCAL_PREFERRED_WORKLOADS:
|
||||
if fallback:
|
||||
return OllamaEndpointSelection(
|
||||
url=fallback,
|
||||
provider_name="ollama_local",
|
||||
workload_type=workload_type,
|
||||
reason="local_heavy_or_privacy_lane",
|
||||
)
|
||||
if secondary:
|
||||
return OllamaEndpointSelection(
|
||||
url=secondary,
|
||||
provider_name="ollama_gcp_b",
|
||||
workload_type=workload_type,
|
||||
reason="local_missing_gcp_b_fallback",
|
||||
)
|
||||
|
||||
if workload_type not in _GCP_A_PREFERRED_WORKLOADS and secondary:
|
||||
return OllamaEndpointSelection(
|
||||
url=secondary,
|
||||
provider_name="ollama_gcp_b",
|
||||
workload_type=workload_type,
|
||||
reason="gcp_b_batch_lane",
|
||||
)
|
||||
|
||||
if workload_type in _LOCAL_PREFERRED_WORKLOADS and fallback:
|
||||
return OllamaEndpointSelection(
|
||||
url=fallback,
|
||||
provider_name="ollama_local",
|
||||
workload_type=workload_type,
|
||||
reason="local_privacy_or_dr_lane",
|
||||
reason="gcp_b_default_non_alert_lane",
|
||||
)
|
||||
|
||||
return OllamaEndpointSelection(
|
||||
|
||||
Reference in New Issue
Block a user