fix: ensure production uses DB-configured model/provider from UI
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/build-3 Pipeline was successful
ci/woodpecker/push/build-2 Pipeline was successful
ci/woodpecker/push/build-1 Pipeline was successful
ci/woodpecker/push/finalize Pipeline was successful
Build and Push / lint-and-test (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Has been cancelled
Build and Push / build-dashboard (push) Has been cancelled
Build and Push / build-superset (push) Has been cancelled
Build and Push / integration-test (push) Has been cancelled
Build and Push / beta-gate (push) Has been cancelled
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/build-3 Pipeline was successful
ci/woodpecker/push/build-2 Pipeline was successful
ci/woodpecker/push/build-1 Pipeline was successful
ci/woodpecker/push/finalize Pipeline was successful
Build and Push / lint-and-test (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Has been cancelled
Build and Push / build-dashboard (push) Has been cancelled
Build and Push / build-superset (push) Has been cancelled
Build and Push / integration-test (push) Has been cancelled
Build and Push / beta-gate (push) Has been cancelled
- Migration 026: update seed defaults from ollama to vllm/AxionML - Migration 031: fix existing rows still on old ollama defaults - Helm values: set OLLAMA_BASE_URL to cluster ollama endpoint (was empty) - Extractor: guard against switching to ollama when base_url is empty - OllamaClient: validate base_url on construction to fail fast
This commit is contained in:
@@ -140,6 +140,11 @@ class OllamaClient:
|
||||
max_retries: int | None = None,
|
||||
http_client: httpx.AsyncClient | None = None,
|
||||
) -> None:
|
||||
if not config.base_url or not config.base_url.startswith(("http://", "https://")):
|
||||
raise ValueError(
|
||||
f"OllamaClient requires a valid base_url (got {config.base_url!r}). "
|
||||
"Set OLLAMA_BASE_URL environment variable."
|
||||
)
|
||||
self._config = config
|
||||
self._max_retries = max_retries if max_retries is not None else config.max_retries
|
||||
self._base_delay = config.retry_base_delay
|
||||
|
||||
+39
-23
@@ -486,17 +486,25 @@ async def main() -> None:
|
||||
model_changed = new_cfg.model != extractor_client._config.model
|
||||
|
||||
if provider_changed or model_changed:
|
||||
logger.info(
|
||||
"Extractor provider switch: old_provider=%s new_provider=%s "
|
||||
"model=%s variant=%s",
|
||||
old_provider, new_provider,
|
||||
new_resolved.model_name, new_resolved.variant_id,
|
||||
)
|
||||
await extractor_client.close()
|
||||
extractor_client = build_llm_client(
|
||||
new_resolved, config.ollama, config.vllm,
|
||||
)
|
||||
extractor_provider = new_provider
|
||||
# Guard: don't switch to ollama if base_url is empty
|
||||
if new_provider == "ollama" and not config.ollama.base_url:
|
||||
logger.warning(
|
||||
"DB resolved provider=ollama but OLLAMA_BASE_URL is empty — "
|
||||
"keeping current %s client. Fix the agent config in the UI.",
|
||||
extractor_provider,
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
"Extractor provider switch: old_provider=%s new_provider=%s "
|
||||
"model=%s variant=%s",
|
||||
old_provider, new_provider,
|
||||
new_resolved.model_name, new_resolved.variant_id,
|
||||
)
|
||||
await extractor_client.close()
|
||||
extractor_client = build_llm_client(
|
||||
new_resolved, config.ollama, config.vllm,
|
||||
)
|
||||
extractor_provider = new_provider
|
||||
else:
|
||||
# Same provider and model — just update config in-place
|
||||
extractor_client._config = new_cfg # type: ignore[assignment]
|
||||
@@ -517,18 +525,26 @@ async def main() -> None:
|
||||
cls_model_changed = new_cls_cfg.model != classifier_client._config.model
|
||||
|
||||
if cls_provider_changed or cls_model_changed:
|
||||
logger.info(
|
||||
"Classifier provider switch: old_provider=%s new_provider=%s "
|
||||
"model=%s variant=%s",
|
||||
old_cls_provider, new_cls_provider,
|
||||
new_cls_resolved.model_name, new_cls_resolved.variant_id,
|
||||
)
|
||||
if classifier_client is not extractor_client:
|
||||
await classifier_client.close()
|
||||
classifier_client = build_llm_client(
|
||||
new_cls_resolved, config.ollama, config.vllm,
|
||||
)
|
||||
classifier_provider = new_cls_provider
|
||||
# Guard: don't switch to ollama if base_url is empty
|
||||
if new_cls_provider == "ollama" and not config.ollama.base_url:
|
||||
logger.warning(
|
||||
"DB resolved classifier provider=ollama but OLLAMA_BASE_URL is empty — "
|
||||
"keeping current %s client. Fix the agent config in the UI.",
|
||||
classifier_provider,
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
"Classifier provider switch: old_provider=%s new_provider=%s "
|
||||
"model=%s variant=%s",
|
||||
old_cls_provider, new_cls_provider,
|
||||
new_cls_resolved.model_name, new_cls_resolved.variant_id,
|
||||
)
|
||||
if classifier_client is not extractor_client:
|
||||
await classifier_client.close()
|
||||
classifier_client = build_llm_client(
|
||||
new_cls_resolved, config.ollama, config.vllm,
|
||||
)
|
||||
classifier_provider = new_cls_provider
|
||||
elif classifier_client is extractor_client and new_cls_cfg.model != extractor_client._config.model:
|
||||
classifier_client = build_llm_client(
|
||||
new_cls_resolved, config.ollama, config.vllm,
|
||||
|
||||
Reference in New Issue
Block a user