From 5e93212bad9bd71f2a415601431d34b3b5ea2322 Mon Sep 17 00:00:00 2001 From: Andrej Simurka Date: Mon, 31 Aug 2026 09:44:23 +0200 Subject: [PATCH] rename llama_stack modules and paths to ogx --- AGENTS.md | 6 ++-- Makefile | 8 +++--- deploy/{llama-stack => ogx}/README.md | 8 +++--- .../{llama-stack => ogx}/test.containerfile | 6 ++-- docker-compose.yaml | 6 ++-- docs/devel_doc/container_orchestration.md | 20 ++++++------- docs/user_doc/deployment_guide.md | 2 +- ...-stack-entrypoint.sh => ogx-entrypoint.sh} | 4 +-- ...lama_stack_tutorial.sh => ogx_tutorial.sh} | 6 ++-- src/README.md | 2 +- src/app/main.py | 2 +- src/client/ogx.py | 8 +++--- src/constants.py | 2 +- src/data/__init__.py | 2 +- src/data/default_run.yaml | 2 +- src/lightspeed_stack.py | 2 +- ..._configuration.py => ogx_configuration.py} | 4 +-- .../question_validity/_capability.py | 2 +- .../llamastack/__init__.py | 6 ---- .../{llamastack => ogx}/README.md | 2 +- src/pydantic_ai_lightspeed/ogx/__init__.py | 6 ++++ .../{llamastack => ogx}/_model.py | 2 +- .../{llamastack => ogx}/_provider.py | 2 +- .../{llamastack => ogx}/_transport.py | 0 src/utils/README.md | 2 +- ...{llama_stack_version.py => ogx_version.py} | 0 src/utils/pydantic_ai_helpers.py | 2 +- .../manifests/lightspeed/ogx-openai.yaml | 16 ++++++----- .../rhoai/manifests/lightspeed/ogx-prow.yaml | 2 +- tests/e2e-prow/rhoai/pipeline.sh | 4 +-- .../test_container_lifecycle.py | 2 +- tests/integration/test_unified_synthesis.py | 2 +- tests/unit/README.md | 6 ++-- tests/unit/models/config/README.md | 2 +- ...iguration.py => test_ogx_configuration.py} | 0 .../llamastack/README.md | 18 ------------ .../llamastack/__init__.py | 1 - .../unit/pydantic_ai_lightspeed/ogx/README.md | 18 ++++++++++++ .../pydantic_ai_lightspeed/ogx/__init__.py | 1 + .../{llamastack => ogx}/test_model.py | 16 +++++------ .../{llamastack => ogx}/test_provider.py | 6 ++-- .../{llamastack => ogx}/test_transport.py | 26 ++++++++--------- ...iguration.py => test_ogx_configuration.py} | 18 ++++++------ ...k_synthesize.py => test_ogx_synthesize.py} | 28 +++++++------------ tests/unit/utils/README.md | 2 +- ...a_stack_version.py => test_ogx_version.py} | 6 ++-- 46 files changed, 140 insertions(+), 148 deletions(-) rename deploy/{llama-stack => ogx}/README.md (89%) rename deploy/{llama-stack => ogx}/test.containerfile (88%) rename scripts/{llama-stack-entrypoint.sh => ogx-entrypoint.sh} (92%) rename scripts/{llama_stack_tutorial.sh => ogx_tutorial.sh} (98%) rename src/{llama_stack_configuration.py => ogx_configuration.py} (99%) delete mode 100644 src/pydantic_ai_lightspeed/llamastack/__init__.py rename src/pydantic_ai_lightspeed/{llamastack => ogx}/README.md (79%) create mode 100644 src/pydantic_ai_lightspeed/ogx/__init__.py rename src/pydantic_ai_lightspeed/{llamastack => ogx}/_model.py (99%) rename src/pydantic_ai_lightspeed/{llamastack => ogx}/_provider.py (99%) rename src/pydantic_ai_lightspeed/{llamastack => ogx}/_transport.py (100%) rename src/utils/{llama_stack_version.py => ogx_version.py} (100%) rename tests/unit/models/config/{test_llama_stack_configuration.py => test_ogx_configuration.py} (100%) delete mode 100644 tests/unit/pydantic_ai_lightspeed/llamastack/README.md delete mode 100644 tests/unit/pydantic_ai_lightspeed/llamastack/__init__.py create mode 100644 tests/unit/pydantic_ai_lightspeed/ogx/README.md create mode 100644 tests/unit/pydantic_ai_lightspeed/ogx/__init__.py rename tests/unit/pydantic_ai_lightspeed/{llamastack => ogx}/test_model.py (98%) rename tests/unit/pydantic_ai_lightspeed/{llamastack => ogx}/test_provider.py (98%) rename tests/unit/pydantic_ai_lightspeed/{llamastack => ogx}/test_transport.py (93%) rename tests/unit/{test_llama_stack_configuration.py => test_ogx_configuration.py} (99%) rename tests/unit/{test_llama_stack_synthesize.py => test_ogx_synthesize.py} (98%) rename tests/unit/utils/{test_llama_stack_version.py => test_ogx_version.py} (96%) diff --git a/AGENTS.md b/AGENTS.md index ca045439a..0019f41e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -203,7 +203,7 @@ src/ │   │   └── redaction/ # PII redaction capability for Pydantic AI agents │   │   ├── capability.py # Pydantic AI capability for PII redaction of model messages │   │   └── core.py # Core redaction logic for PII detection and replacement -│   └── llamastack/ # Pydantic AI provider for OGX +│   └── ogx/ # Pydantic AI provider for OGX │   ├── _model.py # Custom OpenAI Responses model that works around OGX streaming quirks │   ├── _provider.py # OGX provider implementation for Pydantic AI │   └── _transport.py # httpx transport that routes OpenAI-compatible requests through an OGX library client @@ -224,7 +224,7 @@ src/ │   ├── degraded_mode.py # Degraded mode state tracking │   ├── endpoints.py # Utility functions for endpoint handlers │   ├── json_schema_updater.py # Function to transform a JSON Schema-like dictionary into an OpenAPI-compatible schema -│   ├── llama_stack_version.py # Check if the OGX version is supported by the LCS +│   ├── ogx_version.py # Check if the OGX version is supported by the LCS │   ├── markdown_repair.py # Utilities for repairing truncated markdown content │   ├── mcp_auth_headers.py # Utilities for resolving MCP server authorization headers │   ├── mcp_headers.py # MCP headers handling @@ -250,7 +250,7 @@ src/ │   └── vector_search.py # Vector search utilities for query endpoints ├── sentry.py # Sentry error tracking initialization and configuration ├── lightspeed_stack.py # Entry point to the Lightspeed Core Stack REST API service -├── llama_stack_configuration.py # OGX configuration enrichment and synthesis +├── ogx_configuration.py # OGX configuration enrichment and synthesis ├── log.py # Log utilities ├── client.py # OGX client wrapper (Singleton) ├── configuration.py # Config management (Singleton) diff --git a/Makefile b/Makefile index fac2207ca..fa1da69a7 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ build-ogx-image: remove-ogx-container ## Build OGX container image echo "ERROR: No container runtime found. Install podman or docker."; \ exit 1; \ fi - $(CONTAINER_RUNTIME) build -f deploy/llama-stack/test.containerfile -t $(OGX_IMAGE) . + $(CONTAINER_RUNTIME) build -f deploy/ogx/test.containerfile -t $(OGX_IMAGE) . stop-ogx-container: ## Gracefully stop OGX container @if [ -n "$(CONTAINER_RUNTIME)" ] && $(CONTAINER_RUNTIME) inspect $(OGX_CONTAINER_NAME) >/dev/null 2>&1; then \ @@ -84,8 +84,8 @@ start-ogx-container: build-ogx-image ## Start OGX container --health-start-period 20s \ -v $(PWD)/$(OGX_CONFIG):/opt/app-root/run.yaml:z \ -v $(PWD)/$(CONFIG):/opt/app-root/lightspeed-stack.yaml:ro,z \ - -v $(PWD)/scripts/llama-stack-entrypoint.sh:/opt/app-root/enrich-entrypoint.sh:ro,z \ - -v $(PWD)/src/llama_stack_configuration.py:/opt/app-root/llama_stack_configuration.py:ro,z \ + -v $(PWD)/scripts/ogx-entrypoint.sh:/opt/app-root/enrich-entrypoint.sh:ro,z \ + -v $(PWD)/src/ogx_configuration.py:/opt/app-root/ogx_configuration.py:ro,z \ -e OPENAI_API_KEY \ -e BRAVE_SEARCH_API_KEY \ -e TAVILY_SEARCH_API_KEY \ @@ -143,7 +143,7 @@ clean-ogx: remove-ogx-container ## Remove container and image fi run-ogx-local: ## Start OGX with enriched config (for local service mode) - uv run src/llama_stack_configuration.py -c $(CONFIG) -i $(OGX_CONFIG) -o $(OGX_CONFIG) && \ + uv run src/ogx_configuration.py -c $(CONFIG) -i $(OGX_CONFIG) -o $(OGX_CONFIG) && \ uv run ogx stack run $(OGX_CONFIG) test-unit: ## Run the unit tests diff --git a/deploy/llama-stack/README.md b/deploy/ogx/README.md similarity index 89% rename from deploy/llama-stack/README.md rename to deploy/ogx/README.md index b164810f0..5554a1aca 100644 --- a/deploy/llama-stack/README.md +++ b/deploy/ogx/README.md @@ -5,13 +5,13 @@ Llama Stack distribution itself, the image bundles the pieces needed to generate its run configuration at container start: -- `/opt/app-root/llama_stack_configuration.py` — the config-generation - script (copied from `src/llama_stack_configuration.py`). +- `/opt/app-root/ogx_configuration.py` — the config-generation + script (copied from `src/ogx_configuration.py`). - `/opt/app-root/data/default_run.yaml` — the shipped default baseline (copied from `src/data/`), resolved by the script as `./data/` relative to its own location. - `/opt/app-root/enrich-entrypoint.sh` — the entrypoint (copied from - `scripts/llama-stack-entrypoint.sh`). + `scripts/ogx-entrypoint.sh`). ## Startup modes @@ -36,7 +36,7 @@ services: llama-stack: build: context: . - dockerfile: deploy/llama-stack/test.containerfile + dockerfile: deploy/ogx/test.containerfile ports: - "8321:8321" volumes: diff --git a/deploy/llama-stack/test.containerfile b/deploy/ogx/test.containerfile similarity index 88% rename from deploy/llama-stack/test.containerfile rename to deploy/ogx/test.containerfile index f09be1d2e..f9e9f3d78 100644 --- a/deploy/llama-stack/test.containerfile +++ b/deploy/ogx/test.containerfile @@ -42,12 +42,12 @@ RUN mkdir -p /opt/app-root/src/.llama/storage \ # Copy the config-generation script for runtime synthesis (unified mode) or # enrichment (legacy mode), plus the shipped default baseline it resolves as # ./data/default_run.yaml relative to its own location (load_default_baseline) -COPY src/llama_stack_configuration.py /opt/app-root/llama_stack_configuration.py +COPY src/ogx_configuration.py /opt/app-root/ogx_configuration.py COPY src/data /opt/app-root/data -COPY scripts/llama-stack-entrypoint.sh /opt/app-root/enrich-entrypoint.sh +COPY scripts/ogx-entrypoint.sh /opt/app-root/enrich-entrypoint.sh RUN chmod +x /opt/app-root/enrich-entrypoint.sh && \ chown -R 1001:0 /opt/app-root/enrich-entrypoint.sh \ - /opt/app-root/llama_stack_configuration.py /opt/app-root/data + /opt/app-root/ogx_configuration.py /opt/app-root/data # Switch back to the original user USER 1001 diff --git a/docker-compose.yaml b/docker-compose.yaml index 74cc165e3..b9b293533 100755 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,7 +3,7 @@ services: llama-stack: build: context: . - dockerfile: deploy/llama-stack/test.containerfile + dockerfile: deploy/ogx/test.containerfile platform: linux/amd64 container_name: llama-stack ports: @@ -18,8 +18,8 @@ services: # from lightspeed-stack.yaml and this mount is ignored - ./run.yaml:/opt/app-root/run.yaml:z # Host copies so `docker compose up` picks up script changes without rebuilding OGX - - ./scripts/llama-stack-entrypoint.sh:/opt/app-root/enrich-entrypoint.sh:ro,z - - ./src/llama_stack_configuration.py:/opt/app-root/llama_stack_configuration.py:ro,z + - ./scripts/ogx-entrypoint.sh:/opt/app-root/enrich-entrypoint.sh:ro,z + - ./src/ogx_configuration.py:/opt/app-root/ogx_configuration.py:ro,z - ./src/data:/opt/app-root/data:ro,z - ${GCP_KEYS_PATH:-./tmp/.gcp-keys-dummy}:/opt/app-root/.gcp-keys:ro - ./lightspeed-stack.yaml:/opt/app-root/lightspeed-stack.yaml:ro,z diff --git a/docs/devel_doc/container_orchestration.md b/docs/devel_doc/container_orchestration.md index 2c6209aad..48c6f6385 100644 --- a/docs/devel_doc/container_orchestration.md +++ b/docs/devel_doc/container_orchestration.md @@ -83,7 +83,7 @@ When you run `make run`, the following happens: make build-llama-stack-image ``` -- Builds from `deploy/llama-stack/test.containerfile` +- Builds from `deploy/ogx/test.containerfile` - Tags as `lightspeed-llama-stack:local` (customizable via `LLAMA_STACK_IMAGE`) - Only rebuilds if the image doesn't exist or source files changed - Removes any existing container before building (ensures clean build) @@ -459,7 +459,7 @@ Container logs: 3. **Test config enrichment:** ```bash # Run enrichment script manually to check for errors - uv run src/llama_stack_configuration.py \ + uv run src/ogx_configuration.py \ -c lightspeed-stack.yaml \ -i run.yaml \ -o /tmp/enriched-run.yaml @@ -649,7 +649,7 @@ This grants read-only access to UID 1001 (container user) without changing base **macOS note:** macOS uses BSD ACLs and cannot assign numeric UID-based ACLs to non-existent host users. If you are testing locally on macOS, you must temporarily use `chmod 644` to allow the container access, but **be aware that this makes the credentials file world-readable on your host machine.** Alternately, ensure your local user matches the container's execution environment. **Why this happens:** -This is expected container behavior. The container runs as a non-root user (UID 1001) for security - see `USER 1001` in `deploy/llama-stack/test.containerfile`. Files with `600` permissions are only accessible to their owner, and the container's UID differs from your host UID. +This is expected container behavior. The container runs as a non-root user (UID 1001) for security - see `USER 1001` in `deploy/ogx/test.containerfile`. Files with `600` permissions are only accessible to their owner, and the container's UID differs from your host UID. **Production recommendation:** For production deployments, avoid mounting credential files entirely. Instead use: @@ -683,9 +683,9 @@ When the OGX container starts, it automatically enriches the `run.yaml` file wit #### How It Works -1. **Entrypoint script** (`scripts/llama-stack-entrypoint.sh`) is mounted at `/opt/app-root/enrich-entrypoint.sh` -2. **Script runs** `/opt/app-root/.venv/bin/python3 /opt/app-root/llama_stack_configuration.py` -3. **Enrichment logic** (`src/llama_stack_configuration.py`) reads both configs and merges them +1. **Entrypoint script** (`scripts/ogx-entrypoint.sh`) is mounted at `/opt/app-root/enrich-entrypoint.sh` +2. **Script runs** `/opt/app-root/.venv/bin/python3 /opt/app-root/ogx_configuration.py` +3. **Enrichment logic** (`src/ogx_configuration.py`) reads both configs and merges them 4. **Output** is written to `/tmp/enriched-run.yaml` inside the container 5. **OGX starts** with the enriched config @@ -699,7 +699,7 @@ When the OGX container starts, it automatically enriches the `run.yaml` file wit ```bash # Run enrichment locally to see output -uv run src/llama_stack_configuration.py \ +uv run src/ogx_configuration.py \ -c lightspeed-stack.yaml \ -i run.yaml \ -o enriched-run.yaml @@ -716,8 +716,8 @@ The container uses these volume mounts: |-----------|----------------|------|---------| | `$(PWD)/run.yaml` | `/opt/app-root/run.yaml` | rw | OGX config (enriched version written here) | | `$(PWD)/lightspeed-stack.yaml` | `/opt/app-root/lightspeed-stack.yaml` | ro | LCORE config (read for enrichment) | -| `$(PWD)/scripts/llama-stack-entrypoint.sh` | `/opt/app-root/enrich-entrypoint.sh` | ro | Entrypoint script with enrichment logic | -| `$(PWD)/src/llama_stack_configuration.py` | `/opt/app-root/llama_stack_configuration.py` | ro | Python enrichment script | +| `$(PWD)/scripts/ogx-entrypoint.sh` | `/opt/app-root/enrich-entrypoint.sh` | ro | Entrypoint script with enrichment logic | +| `$(PWD)/src/ogx_configuration.py` | `/opt/app-root/ogx_configuration.py` | ro | Python enrichment script | **SELinux labels:** - `:z`: Relabels for sharing between host and container (read-write) @@ -734,7 +734,7 @@ If you need more control than the Makefile provides, you can manage the containe #### Build the Image ```bash -podman build -f deploy/llama-stack/test.containerfile -t my-llama-stack:custom . +podman build -f deploy/ogx/test.containerfile -t my-llama-stack:custom . ``` #### Run the Container diff --git a/docs/user_doc/deployment_guide.md b/docs/user_doc/deployment_guide.md index b01b1d6eb..42aa10f01 100644 --- a/docs/user_doc/deployment_guide.md +++ b/docs/user_doc/deployment_guide.md @@ -170,7 +170,7 @@ and `library_client_config_path` must not be set (unified and legacy inputs are mutually exclusive). The reference profiles are sanity-checked by the unit suite -(`tests/unit/test_llama_stack_synthesize.py`), so they stay loadable as the +(`tests/unit/test_ogx_synthesize.py`), so they stay loadable as the synthesizer evolves. diff --git a/scripts/llama-stack-entrypoint.sh b/scripts/ogx-entrypoint.sh similarity index 92% rename from scripts/llama-stack-entrypoint.sh rename to scripts/ogx-entrypoint.sh index 229876e9e..600f18a9a 100755 --- a/scripts/llama-stack-entrypoint.sh +++ b/scripts/ogx-entrypoint.sh @@ -2,7 +2,7 @@ # Entrypoint for OGX container. # # Generates the run configuration from the mounted lightspeed-stack.yaml and -# starts OGX. The Python CLI (llama_stack_configuration.py) auto-detects the +# starts OGX. The Python CLI (ogx_configuration.py) auto-detects the # configuration shape: # - unified mode: the lightspeed config carries a synthesis input (a # non-empty inference.providers or vector_store.providers, or a @@ -23,7 +23,7 @@ LIGHTSPEED_CONFIG="${LIGHTSPEED_CONFIG:-/opt/app-root/lightspeed-stack.yaml}" if [ -f "$LIGHTSPEED_CONFIG" ]; then echo "Generating llama-stack config from $LIGHTSPEED_CONFIG (mode auto-detected)..." GENERATION_FAILED=0 - /opt/app-root/.venv/bin/python3 /opt/app-root/llama_stack_configuration.py \ + /opt/app-root/.venv/bin/python3 /opt/app-root/ogx_configuration.py \ -c "$LIGHTSPEED_CONFIG" \ -i "$INPUT_CONFIG" \ -o "$GENERATED_CONFIG" 2>&1 || GENERATION_FAILED=1 diff --git a/scripts/llama_stack_tutorial.sh b/scripts/ogx_tutorial.sh similarity index 98% rename from scripts/llama_stack_tutorial.sh rename to scripts/ogx_tutorial.sh index 855ac7cd6..d3a3aaa6c 100755 --- a/scripts/llama_stack_tutorial.sh +++ b/scripts/ogx_tutorial.sh @@ -319,9 +319,9 @@ Next Steps: 4. Experiment with different models and tools Resources: -- This tutorial script: ./llama_stack_tutorial.sh -- Run without pauses: ./llama_stack_tutorial.sh --no-wait -- Python version: ./llama_stack_tutorial.py (requires: uv run python3) +- This tutorial script: ./ogx_tutorial.sh +- Run without pauses: ./ogx_tutorial.sh --no-wait +- Python version: ./ogx_tutorial.py (requires: uv run python3) - Interactive docs: http://localhost:8321/docs Happy exploring! 🚀 diff --git a/src/README.md b/src/README.md index 3274e9f63..e5b29fee7 100644 --- a/src/README.md +++ b/src/README.md @@ -16,7 +16,7 @@ Constants used in business logic. Entry point to the Lightspeed Core Stack REST API service. -## [llama_stack_configuration.py](llama_stack_configuration.py) +## [ogx_configuration.py](ogx_configuration.py) OGX configuration enrichment and synthesis. diff --git a/src/app/main.py b/src/app/main.py index ac3607b8d..1807bffa5 100644 --- a/src/app/main.py +++ b/src/app/main.py @@ -27,7 +27,7 @@ from models.api.responses.error import InternalServerErrorResponse from observability.sentry import initialize_sentry from utils.degraded_mode import DegradedModeTracker -from utils.llama_stack_version import check_ogx_version +from utils.ogx_version import check_ogx_version logger = get_logger(__name__) diff --git a/src/client/ogx.py b/src/client/ogx.py index 4a40be3de..28eade192 100644 --- a/src/client/ogx.py +++ b/src/client/ogx.py @@ -15,16 +15,16 @@ import constants from authorization.azure_token_manager import AzureEntraIDManager from configuration import configuration -from llama_stack_configuration import ( +from log import get_logger, setup_logging +from models.api.responses.error import ServiceUnavailableResponse +from models.config import OgxConfiguration +from ogx_configuration import ( YamlDumper, enrich_azure_entra_id_inference, enrich_byok_rag, enrich_solr, synthesize_to_file, ) -from log import get_logger, setup_logging -from models.api.responses.error import ServiceUnavailableResponse -from models.config import OgxConfiguration from utils.model_list import parse_model_list_response from utils.types import Singleton diff --git a/src/constants.py b/src/constants.py index f213e9f1f..baebfeeb4 100644 --- a/src/constants.py +++ b/src/constants.py @@ -202,7 +202,7 @@ CACHE_TYPE_NOOP: Final[str] = "noop" # BYOK RAG -# Backends that have enrichment support in llama_stack_configuration.py +# Backends that have enrichment support in ogx_configuration.py SUPPORTED_RAG_BACKENDS: Final[frozenset[str]] = frozenset({"faiss", "pgvector"}) # Default RAG backend for bring-your-own-knowledge RAG configurations diff --git a/src/data/__init__.py b/src/data/__init__.py index a0d809c2b..de7196548 100644 --- a/src/data/__init__.py +++ b/src/data/__init__.py @@ -2,7 +2,7 @@ Currently holds ``default_run.yaml``, the built-in baseline OGX configuration used by unified-mode synthesis (see -``llama_stack_configuration.load_default_baseline``). Making this directory a +``ogx_configuration.load_default_baseline``). Making this directory a package ensures the data file is included in built wheels and resolvable both in editable installs and from site-packages. """ diff --git a/src/data/default_run.yaml b/src/data/default_run.yaml index 94bd537ba..c52bd894f 100644 --- a/src/data/default_run.yaml +++ b/src/data/default_run.yaml @@ -2,7 +2,7 @@ # # This file is the starting point when a unified `lightspeed-stack.yaml` # selects `llama_stack.config.baseline: default` (the default) and does not -# point at a `profile:`. The synthesizer (src/llama_stack_configuration.py) +# point at a `profile:`. The synthesizer (src/ogx_configuration.py) # layers enrichment, high-level `inference.providers`, and `native_override` # on top of this baseline to produce the final run.yaml handed to OGX. # diff --git a/src/lightspeed_stack.py b/src/lightspeed_stack.py index 3aafddd22..e6d37397e 100644 --- a/src/lightspeed_stack.py +++ b/src/lightspeed_stack.py @@ -10,8 +10,8 @@ import constants from configuration import configuration from constants import LIGHTSPEED_STACK_LOG_LEVEL_ENV_VAR -from llama_stack_configuration import migrate_config_dumb from log import get_logger, setup_logging +from ogx_configuration import migrate_config_dumb from runners.quota_scheduler import start_quota_scheduler from runners.uvicorn import start_uvicorn from utils.dumpers import config_dumper, models_dumper diff --git a/src/llama_stack_configuration.py b/src/ogx_configuration.py similarity index 99% rename from src/llama_stack_configuration.py rename to src/ogx_configuration.py index 26e995b01..ee279407f 100644 --- a/src/llama_stack_configuration.py +++ b/src/ogx_configuration.py @@ -1,8 +1,8 @@ """OGX configuration enrichment and synthesis. This module can be used in two ways: -1. As a script: `python llama_stack_configuration.py -c config.yaml` -2. As a module: `from llama_stack_configuration import generate_configuration` +1. As a script: `python ogx_configuration.py -c config.yaml` +2. As a module: `from ogx_configuration import generate_configuration` Two related responsibilities live here: diff --git a/src/pydantic_ai_lightspeed/capabilities/question_validity/_capability.py b/src/pydantic_ai_lightspeed/capabilities/question_validity/_capability.py index 9fdd9f3d7..43e1232a9 100644 --- a/src/pydantic_ai_lightspeed/capabilities/question_validity/_capability.py +++ b/src/pydantic_ai_lightspeed/capabilities/question_validity/_capability.py @@ -40,7 +40,7 @@ QuestionValidityConfig, ) from pydantic_ai_lightspeed.capabilities.base import AbstractSafetyCapability -from pydantic_ai_lightspeed.llamastack import OgxResponsesModel +from pydantic_ai_lightspeed.ogx import OgxResponsesModel from utils.conversations import append_turn_to_conversation logger = get_logger(__name__) diff --git a/src/pydantic_ai_lightspeed/llamastack/__init__.py b/src/pydantic_ai_lightspeed/llamastack/__init__.py deleted file mode 100644 index e3b697198..000000000 --- a/src/pydantic_ai_lightspeed/llamastack/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Pydantic AI provider for OGX.""" - -from pydantic_ai_lightspeed.llamastack._model import OgxResponsesModel -from pydantic_ai_lightspeed.llamastack._provider import OgxProvider - -__all__ = ["OgxProvider", "OgxResponsesModel"] diff --git a/src/pydantic_ai_lightspeed/llamastack/README.md b/src/pydantic_ai_lightspeed/ogx/README.md similarity index 79% rename from src/pydantic_ai_lightspeed/llamastack/README.md rename to src/pydantic_ai_lightspeed/ogx/README.md index e6e316cc5..137620558 100644 --- a/src/pydantic_ai_lightspeed/llamastack/README.md +++ b/src/pydantic_ai_lightspeed/ogx/README.md @@ -1,4 +1,4 @@ -# List of source files stored in `src/pydantic_ai_lightspeed/llamastack` directory +# List of source files stored in `src/pydantic_ai_lightspeed/ogx` directory ## [__init__.py](__init__.py) diff --git a/src/pydantic_ai_lightspeed/ogx/__init__.py b/src/pydantic_ai_lightspeed/ogx/__init__.py new file mode 100644 index 000000000..aff18e3ae --- /dev/null +++ b/src/pydantic_ai_lightspeed/ogx/__init__.py @@ -0,0 +1,6 @@ +"""Pydantic AI provider for OGX.""" + +from pydantic_ai_lightspeed.ogx._model import OgxResponsesModel +from pydantic_ai_lightspeed.ogx._provider import OgxProvider + +__all__ = ["OgxProvider", "OgxResponsesModel"] diff --git a/src/pydantic_ai_lightspeed/llamastack/_model.py b/src/pydantic_ai_lightspeed/ogx/_model.py similarity index 99% rename from src/pydantic_ai_lightspeed/llamastack/_model.py rename to src/pydantic_ai_lightspeed/ogx/_model.py index 80a608a3f..f83ee0096 100644 --- a/src/pydantic_ai_lightspeed/llamastack/_model.py +++ b/src/pydantic_ai_lightspeed/ogx/_model.py @@ -48,7 +48,7 @@ from log import get_logger from models.common.responses.responses_api_params import ResponsesApiParams -from pydantic_ai_lightspeed.llamastack._provider import OgxProvider +from pydantic_ai_lightspeed.ogx._provider import OgxProvider logger = get_logger(__name__) diff --git a/src/pydantic_ai_lightspeed/llamastack/_provider.py b/src/pydantic_ai_lightspeed/ogx/_provider.py similarity index 99% rename from src/pydantic_ai_lightspeed/llamastack/_provider.py rename to src/pydantic_ai_lightspeed/ogx/_provider.py index 65de2628f..35816845f 100644 --- a/src/pydantic_ai_lightspeed/llamastack/_provider.py +++ b/src/pydantic_ai_lightspeed/ogx/_provider.py @@ -14,7 +14,7 @@ from pydantic_ai.profiles.openai import openai_model_profile from pydantic_ai.providers import Provider -from pydantic_ai_lightspeed.llamastack._transport import ( +from pydantic_ai_lightspeed.ogx._transport import ( OgxLibraryTransport, wrap_http_client_with_provider_data, ) diff --git a/src/pydantic_ai_lightspeed/llamastack/_transport.py b/src/pydantic_ai_lightspeed/ogx/_transport.py similarity index 100% rename from src/pydantic_ai_lightspeed/llamastack/_transport.py rename to src/pydantic_ai_lightspeed/ogx/_transport.py diff --git a/src/utils/README.md b/src/utils/README.md index 4e0748fb2..0efedb069 100644 --- a/src/utils/README.md +++ b/src/utils/README.md @@ -48,7 +48,7 @@ Input sanitization to detect and block obfuscated prompt injection attempts. Function to transform a JSON Schema-like dictionary into an OpenAPI-compatible schema. -## [llama_stack_version.py](llama_stack_version.py) +## [ogx_version.py](ogx_version.py) Check if the OGX version is supported by the LCS. diff --git a/src/utils/llama_stack_version.py b/src/utils/ogx_version.py similarity index 100% rename from src/utils/llama_stack_version.py rename to src/utils/ogx_version.py diff --git a/src/utils/pydantic_ai_helpers.py b/src/utils/pydantic_ai_helpers.py index 2c2940737..9139bb053 100644 --- a/src/utils/pydantic_ai_helpers.py +++ b/src/utils/pydantic_ai_helpers.py @@ -23,7 +23,7 @@ ) from pydantic_ai_lightspeed.capabilities import QuestionValidity from pydantic_ai_lightspeed.capabilities.redaction import PiiRedactionCapability -from pydantic_ai_lightspeed.llamastack import OgxResponsesModel +from pydantic_ai_lightspeed.ogx import OgxResponsesModel from utils.shields import get_shields_for_request _AGENT_SKILLS_PROVIDER_ID: Final[str] = "agent-skills" diff --git a/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-openai.yaml b/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-openai.yaml index 109d35142..20ec60a8b 100644 --- a/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-openai.yaml +++ b/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-openai.yaml @@ -1,5 +1,5 @@ # OGX from source on UBI: init clones repo + seeds FAISS, main restores seed then uses -# scripts/llama-stack-entrypoint.sh (same enrich/start path as GitHub Actions docker-compose). +# scripts/ogx-entrypoint.sh (same enrich/start path as GitHub Actions docker-compose). # Needs ConfigMaps: llama-stack-config (run.yaml), rag-data (kv_store.db.gz), lightspeed-stack-config; # optional OGX-source for repo_url / repo_revision. # @@ -45,7 +45,9 @@ spec: # reduces per-restart time from ~6-15 min to ~30-90 s (just RAG seed refresh + chown). if [[ -d /opt/app-root/.venv ]] \ && /opt/app-root/.venv/bin/python --version >/dev/null 2>&1 \ - && [[ -d /opt/app-root/src ]]; then + && [[ -d /opt/app-root/src ]] \ + && [[ -f /opt/app-root/scripts/ogx-entrypoint.sh ]] \ + && [[ -f /opt/app-root/src/ogx_configuration.py ]]; then echo "PVC cache hit: app-root already provisioned — skipping full install" mkdir -p /opt/app-root/.e2e-rag-seed /opt/app-root/.e2e-rag-work /opt/app-root/src/.ogx /opt/app-root/src/.llama/storage/files if [[ -f /rag-seed/kv_store.db.gz ]]; then @@ -57,8 +59,8 @@ spec: fi cp -f /opt/app-root/.e2e-rag-seed/kv_store.db /opt/app-root/.e2e-rag-work/kv_store.db fi - cp -f /opt/app-root/scripts/llama-stack-entrypoint.sh /opt/app-root/enrich-entrypoint.sh - cp -f /opt/app-root/src/llama_stack_configuration.py /opt/app-root/llama_stack_configuration.py + cp -f /opt/app-root/scripts/ogx-entrypoint.sh /opt/app-root/enrich-entrypoint.sh + cp -f /opt/app-root/src/ogx_configuration.py /opt/app-root/ogx_configuration.py chmod 755 /opt/app-root/enrich-entrypoint.sh chmod -R 775 /opt/app-root && chown -R 1001:0 /opt/app-root echo "PVC fast-path complete" @@ -92,8 +94,8 @@ spec: exit 1 fi cp -f /opt/app-root/.e2e-rag-seed/kv_store.db /opt/app-root/.e2e-rag-work/kv_store.db - cp -f /opt/app-root/scripts/llama-stack-entrypoint.sh /opt/app-root/enrich-entrypoint.sh - cp -f /opt/app-root/src/llama_stack_configuration.py /opt/app-root/llama_stack_configuration.py + cp -f /opt/app-root/scripts/ogx-entrypoint.sh /opt/app-root/enrich-entrypoint.sh + cp -f /opt/app-root/src/ogx_configuration.py /opt/app-root/ogx_configuration.py chmod 755 /opt/app-root/enrich-entrypoint.sh chmod -R 775 /opt/app-root && chown -R 1001:0 /opt/app-root volumeMounts: @@ -139,7 +141,7 @@ spec: value: "/opt/app-root/src" - name: HOME value: "/opt/app-root/src" - # Match GitHub Actions docker-compose + llama-stack-entrypoint.sh: + # Match GitHub Actions docker-compose + ogx-entrypoint.sh: # registry/SQL under /tmp (writable); FAISS BYOK reads restored fixture outside ~/.llama # so OGX migrate_legacy_config_dir() cannot move it away on startup. - name: OGX_CONFIG_DIR diff --git a/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-prow.yaml b/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-prow.yaml index cd08a4e7e..d7950e57b 100644 --- a/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-prow.yaml +++ b/tests/e2e-prow/rhoai/manifests/lightspeed/ogx-prow.yaml @@ -157,7 +157,7 @@ spec: if [[ -f "$LIGHTSPEED_CONFIG" ]]; then echo "Enriching llama-stack config..." ENRICHMENT_FAILED=0 - /opt/app-root/.venv/bin/python3 /opt/app-root/src/llama_stack_configuration.py \ + /opt/app-root/.venv/bin/python3 /opt/app-root/src/ogx_configuration.py \ -c "$LIGHTSPEED_CONFIG" \ -i "$INPUT_CONFIG" \ -o "$ENRICHED_CONFIG" 2>&1 || ENRICHMENT_FAILED=1 diff --git a/tests/e2e-prow/rhoai/pipeline.sh b/tests/e2e-prow/rhoai/pipeline.sh index 3af958f03..fab42c8ae 100755 --- a/tests/e2e-prow/rhoai/pipeline.sh +++ b/tests/e2e-prow/rhoai/pipeline.sh @@ -229,9 +229,9 @@ oc new-build --name=llama-stack-e2e \ --to="llama-stack-e2e:latest" \ -n "$NAMESPACE" 2>/dev/null || echo "BuildConfig llama-stack-e2e already exists" -# Patch BuildConfig to use deploy/llama-stack/test.containerfile instead of Dockerfile +# Patch BuildConfig to use deploy/ogx/test.containerfile instead of Dockerfile oc patch bc llama-stack-e2e -n "$NAMESPACE" --type=json \ - -p '[{"op":"replace","path":"/spec/strategy/dockerStrategy/dockerfilePath","value":"deploy/llama-stack/test.containerfile"}]' 2>/dev/null || true + -p '[{"op":"replace","path":"/spec/strategy/dockerStrategy/dockerfilePath","value":"deploy/ogx/test.containerfile"}]' 2>/dev/null || true # Build from repo root oc start-build llama-stack-e2e \ diff --git a/tests/integration/container_lifecycle/test_container_lifecycle.py b/tests/integration/container_lifecycle/test_container_lifecycle.py index 3d63e8700..e93ed01c5 100644 --- a/tests/integration/container_lifecycle/test_container_lifecycle.py +++ b/tests/integration/container_lifecycle/test_container_lifecycle.py @@ -21,7 +21,7 @@ "/opt/app-root/run.yaml", "/opt/app-root/lightspeed-stack.yaml", "/opt/app-root/enrich-entrypoint.sh", - "/opt/app-root/llama_stack_configuration.py", + "/opt/app-root/ogx_configuration.py", ] DEFAULT_TIMEOUT = 60 NETWORK_BINDING_MAX_ATTEMPTS = 5 diff --git a/tests/integration/test_unified_synthesis.py b/tests/integration/test_unified_synthesis.py index 7f3e03338..28a7d5d5a 100644 --- a/tests/integration/test_unified_synthesis.py +++ b/tests/integration/test_unified_synthesis.py @@ -24,7 +24,7 @@ from pydantic import ValidationError from configuration import configuration -from llama_stack_configuration import ( +from ogx_configuration import ( CONDITIONAL_OPENAI_PROVIDER_ID, generate_configuration, load_default_baseline, diff --git a/tests/unit/README.md b/tests/unit/README.md index c0b1c1523..691a2585e 100644 --- a/tests/unit/README.md +++ b/tests/unit/README.md @@ -24,11 +24,11 @@ Unit tests for the degraded mode tracker. Unit tests for functions defined in src/lightspeed_stack.py. -## [test_llama_stack_configuration.py](test_llama_stack_configuration.py) +## [test_ogx_configuration.py](test_ogx_configuration.py) -Unit tests for src/llama_stack_configuration.py. +Unit tests for src/ogx_configuration.py. -## [test_llama_stack_synthesize.py](test_llama_stack_synthesize.py) +## [test_ogx_synthesize.py](test_ogx_synthesize.py) Unit tests for unified-mode OGX configuration synthesis (LCORE-2336). diff --git a/tests/unit/models/config/README.md b/tests/unit/models/config/README.md index c1dba472e..c60c41ee9 100644 --- a/tests/unit/models/config/README.md +++ b/tests/unit/models/config/README.md @@ -56,7 +56,7 @@ Unit tests for InferenceConfiguration model. Unit tests for JwtRoleRule model. -## [test_llama_stack_configuration.py](test_llama_stack_configuration.py) +## [test_ogx_configuration.py](test_ogx_configuration.py) Unit tests for OgxConfiguration model. diff --git a/tests/unit/models/config/test_llama_stack_configuration.py b/tests/unit/models/config/test_ogx_configuration.py similarity index 100% rename from tests/unit/models/config/test_llama_stack_configuration.py rename to tests/unit/models/config/test_ogx_configuration.py diff --git a/tests/unit/pydantic_ai_lightspeed/llamastack/README.md b/tests/unit/pydantic_ai_lightspeed/llamastack/README.md deleted file mode 100644 index 4aedd4cd6..000000000 --- a/tests/unit/pydantic_ai_lightspeed/llamastack/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# List of source files stored in `tests/unit/pydantic_ai_lightspeed/llamastack` directory - -## [__init__.py](__init__.py) - -Unit tests for pydantic_ai_lightspeed.llamastack sub-package. - -## [test_model.py](test_model.py) - -Unit tests for pydantic_ai_lightspeed.llamastack._model module. - -## [test_provider.py](test_provider.py) - -Unit tests for pydantic_ai_lightspeed.llamastack._provider module. - -## [test_transport.py](test_transport.py) - -Unit tests for pydantic_ai_lightspeed.llamastack._transport module. - diff --git a/tests/unit/pydantic_ai_lightspeed/llamastack/__init__.py b/tests/unit/pydantic_ai_lightspeed/llamastack/__init__.py deleted file mode 100644 index 7989511f7..000000000 --- a/tests/unit/pydantic_ai_lightspeed/llamastack/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Unit tests for pydantic_ai_lightspeed.llamastack sub-package.""" diff --git a/tests/unit/pydantic_ai_lightspeed/ogx/README.md b/tests/unit/pydantic_ai_lightspeed/ogx/README.md new file mode 100644 index 000000000..f62f2f8c1 --- /dev/null +++ b/tests/unit/pydantic_ai_lightspeed/ogx/README.md @@ -0,0 +1,18 @@ +# List of source files stored in `tests/unit/pydantic_ai_lightspeed/ogx` directory + +## [__init__.py](__init__.py) + +Unit tests for pydantic_ai_lightspeed.ogx sub-package. + +## [test_model.py](test_model.py) + +Unit tests for pydantic_ai_lightspeed.ogx._model module. + +## [test_provider.py](test_provider.py) + +Unit tests for pydantic_ai_lightspeed.ogx._provider module. + +## [test_transport.py](test_transport.py) + +Unit tests for pydantic_ai_lightspeed.ogx._transport module. + diff --git a/tests/unit/pydantic_ai_lightspeed/ogx/__init__.py b/tests/unit/pydantic_ai_lightspeed/ogx/__init__.py new file mode 100644 index 000000000..c15101905 --- /dev/null +++ b/tests/unit/pydantic_ai_lightspeed/ogx/__init__.py @@ -0,0 +1 @@ +"""Unit tests for pydantic_ai_lightspeed.ogx sub-package.""" diff --git a/tests/unit/pydantic_ai_lightspeed/llamastack/test_model.py b/tests/unit/pydantic_ai_lightspeed/ogx/test_model.py similarity index 98% rename from tests/unit/pydantic_ai_lightspeed/llamastack/test_model.py rename to tests/unit/pydantic_ai_lightspeed/ogx/test_model.py index 3773c37d9..d70e98d71 100644 --- a/tests/unit/pydantic_ai_lightspeed/llamastack/test_model.py +++ b/tests/unit/pydantic_ai_lightspeed/ogx/test_model.py @@ -1,4 +1,4 @@ -"""Unit tests for pydantic_ai_lightspeed.llamastack._model module.""" +"""Unit tests for pydantic_ai_lightspeed.ogx._model module.""" # pylint: disable=protected-access,too-few-public-methods @@ -19,7 +19,7 @@ from pytest_mock import MockerFixture from models.common.responses.responses_api_params import ResponsesApiParams -from pydantic_ai_lightspeed.llamastack._model import ( +from pydantic_ai_lightspeed.ogx._model import ( _LLS_RESPONSES_EXTRA_FIELDS, OgxResponsesModel, _FilteredResponseStream, @@ -209,7 +209,7 @@ def test_with_responses_params(self, mocker: MockerFixture) -> None: """Test that responses_params is converted and forwarded.""" mock_provider = mocker.Mock() mocker.patch( - "pydantic_ai_lightspeed.llamastack._model.OgxProvider.from_ogx_client", + "pydantic_ai_lightspeed.ogx._model.OgxProvider.from_ogx_client", return_value=mock_provider, ) mock_init = mocker.patch.object( @@ -232,7 +232,7 @@ def test_with_model_settings(self, mocker: MockerFixture) -> None: """Test that model_settings is forwarded directly.""" mock_provider = mocker.Mock() mocker.patch( - "pydantic_ai_lightspeed.llamastack._model.OgxProvider.from_ogx_client", + "pydantic_ai_lightspeed.ogx._model.OgxProvider.from_ogx_client", return_value=mock_provider, ) mock_init = mocker.patch.object( @@ -256,7 +256,7 @@ def test_with_neither(self, mocker: MockerFixture) -> None: """Test that settings is None when neither param is provided.""" mock_provider = mocker.Mock() mocker.patch( - "pydantic_ai_lightspeed.llamastack._model.OgxProvider.from_ogx_client", + "pydantic_ai_lightspeed.ogx._model.OgxProvider.from_ogx_client", return_value=mock_provider, ) mock_init = mocker.patch.object( @@ -276,7 +276,7 @@ def test_with_neither(self, mocker: MockerFixture) -> None: def test_both_raises_value_error(self, mocker: MockerFixture) -> None: """Test that providing both raises ValueError.""" mocker.patch( - "pydantic_ai_lightspeed.llamastack._model.OgxProvider.from_ogx_client", + "pydantic_ai_lightspeed.ogx._model.OgxProvider.from_ogx_client", return_value=mocker.Mock(), ) @@ -555,9 +555,7 @@ def model_fixture(self, mocker: MockerFixture) -> OgxResponsesModel: model._provider = mocker.Mock() model._provider.name = "test-provider" model._provider.base_url = "http://localhost" - mocker.patch( - "pydantic_ai_lightspeed.llamastack._model.check_allow_model_requests" - ) + mocker.patch("pydantic_ai_lightspeed.ogx._model.check_allow_model_requests") mocker.patch.object( type(model), "profile", diff --git a/tests/unit/pydantic_ai_lightspeed/llamastack/test_provider.py b/tests/unit/pydantic_ai_lightspeed/ogx/test_provider.py similarity index 98% rename from tests/unit/pydantic_ai_lightspeed/llamastack/test_provider.py rename to tests/unit/pydantic_ai_lightspeed/ogx/test_provider.py index 67b385a95..869ef036a 100644 --- a/tests/unit/pydantic_ai_lightspeed/llamastack/test_provider.py +++ b/tests/unit/pydantic_ai_lightspeed/ogx/test_provider.py @@ -1,4 +1,4 @@ -"""Unit tests for pydantic_ai_lightspeed.llamastack._provider module.""" +"""Unit tests for pydantic_ai_lightspeed.ogx._provider module.""" # pylint: disable=protected-access @@ -9,11 +9,11 @@ from openai import AsyncOpenAI from pytest_mock import MockerFixture -from pydantic_ai_lightspeed.llamastack._provider import ( +from pydantic_ai_lightspeed.ogx._provider import ( DEFAULT_BASE_URL, OgxProvider, ) -from pydantic_ai_lightspeed.llamastack._transport import OgxServerTransport +from pydantic_ai_lightspeed.ogx._transport import OgxServerTransport class TestOgxProviderProperties: diff --git a/tests/unit/pydantic_ai_lightspeed/llamastack/test_transport.py b/tests/unit/pydantic_ai_lightspeed/ogx/test_transport.py similarity index 93% rename from tests/unit/pydantic_ai_lightspeed/llamastack/test_transport.py rename to tests/unit/pydantic_ai_lightspeed/ogx/test_transport.py index f9e4855b8..a8b248cf3 100644 --- a/tests/unit/pydantic_ai_lightspeed/llamastack/test_transport.py +++ b/tests/unit/pydantic_ai_lightspeed/ogx/test_transport.py @@ -1,4 +1,4 @@ -"""Unit tests for pydantic_ai_lightspeed.llamastack._transport module.""" +"""Unit tests for pydantic_ai_lightspeed.ogx._transport module.""" # pylint: disable=protected-access @@ -10,7 +10,7 @@ import pytest from pytest_mock import MockerFixture -from pydantic_ai_lightspeed.llamastack._transport import ( +from pydantic_ai_lightspeed.ogx._transport import ( OgxLibraryTransport, OgxServerTransport, _AsyncByteStream, @@ -216,7 +216,7 @@ async def test_non_streaming_request( mock_func = mocker.AsyncMock(return_value={"id": "resp-1", "choices": []}) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) @@ -246,7 +246,7 @@ async def mock_stream_result() -> AsyncGenerator[dict[str, int], None]: mock_func = mocker.AsyncMock(return_value=mock_stream_result()) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) @@ -265,7 +265,7 @@ async def test_empty_body_request( mock_func = mocker.AsyncMock(return_value=[]) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) @@ -292,13 +292,13 @@ async def test_provider_data_header_injection(self, mocker: MockerFixture) -> No mock_func = mocker.AsyncMock(return_value={"id": "resp-1"}) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) client._convert_body = mocker.Mock(side_effect=lambda f, b: b) mock_ctx = mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.request_provider_data_context" + "pydantic_ai_lightspeed.ogx._transport.request_provider_data_context" ) await transport.handle_async_request(request) @@ -327,13 +327,13 @@ async def test_provider_data_header_not_injected_when_present( mock_func = mocker.AsyncMock(return_value={"id": "resp-1"}) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) client._convert_body = mocker.Mock(side_effect=lambda f, b: b) mock_ctx = mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.request_provider_data_context" + "pydantic_ai_lightspeed.ogx._transport.request_provider_data_context" ) await transport.handle_async_request(request) @@ -359,7 +359,7 @@ async def test_merges_path_params( mock_func = mocker.AsyncMock(return_value={"id": "model-1"}) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {"model_id": "test-model"}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) @@ -379,7 +379,7 @@ async def test_delete_returns_no_content( mock_func = mocker.AsyncMock(return_value=None) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) @@ -400,7 +400,7 @@ async def test_delete_with_result_returns_ok( mock_func = mocker.AsyncMock(return_value={"deleted": True}) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) @@ -433,7 +433,7 @@ async def mock_stream() -> AsyncGenerator[dict[str, str], None]: mock_func = mocker.AsyncMock(return_value=mock_stream()) mocker.patch( - "pydantic_ai_lightspeed.llamastack._transport.find_matching_route", + "pydantic_ai_lightspeed.ogx._transport.find_matching_route", return_value=(mock_func, {}, None, None), ) transport._client._convert_body = mocker.Mock(side_effect=lambda f, b: b) diff --git a/tests/unit/test_llama_stack_configuration.py b/tests/unit/test_ogx_configuration.py similarity index 99% rename from tests/unit/test_llama_stack_configuration.py rename to tests/unit/test_ogx_configuration.py index 947a076e5..19be9278f 100644 --- a/tests/unit/test_llama_stack_configuration.py +++ b/tests/unit/test_ogx_configuration.py @@ -1,4 +1,4 @@ -"""Unit tests for src/llama_stack_configuration.py.""" +"""Unit tests for src/ogx_configuration.py.""" # pylint: disable=too-many-lines @@ -8,7 +8,14 @@ import pytest import yaml -from llama_stack_configuration import ( +from models.config import ( + Configuration, + InferenceConfiguration, + OgxConfiguration, + ServiceConfiguration, + UserDataCollection, +) +from ogx_configuration import ( _build_vector_io_config, construct_models_section, construct_storage_backends_section, @@ -21,13 +28,6 @@ enrich_vector_store, generate_configuration, ) -from models.config import ( - Configuration, - InferenceConfiguration, - OgxConfiguration, - ServiceConfiguration, - UserDataCollection, -) # ============================================================================= # Test enrich_azure_entra_id_inference diff --git a/tests/unit/test_llama_stack_synthesize.py b/tests/unit/test_ogx_synthesize.py similarity index 98% rename from tests/unit/test_llama_stack_synthesize.py rename to tests/unit/test_ogx_synthesize.py index e94efa828..f58593b44 100644 --- a/tests/unit/test_llama_stack_synthesize.py +++ b/tests/unit/test_ogx_synthesize.py @@ -1,7 +1,7 @@ """Unit tests for unified-mode OGX configuration synthesis (LCORE-2336). Covers the synthesizer pipeline and its helpers in -``src/llama_stack_configuration.py``: baseline loading, deep-merge semantics, +``src/ogx_configuration.py``: baseline loading, deep-merge semantics, high-level inference expansion, the full synthesis pipeline, and the write-to-file step (persistent path, mode 0600). """ @@ -19,7 +19,8 @@ import yaml from ogx.core.stack import replace_env_vars -from llama_stack_configuration import ( +from models.config import UnifiedInferenceProvider +from ogx_configuration import ( CONDITIONAL_OPENAI_PROVIDER_ID, PROVIDER_TYPE_MAP, apply_high_level_inference, @@ -32,7 +33,6 @@ synthesize_configuration, synthesize_to_file, ) -from models.config import UnifiedInferenceProvider OPENAI_CONDITIONAL_PROVIDER_ID = CONDITIONAL_OPENAI_PROVIDER_ID OPENAI_CONDITIONAL_API_KEY = "${env.OPENAI_API_KEY:=}" @@ -315,7 +315,7 @@ def test_apply_high_level_inference_replaces_existing_provider_id( } } inference = {"providers": [{"type": "openai", "api_key_env": "NEW_KEY"}]} - with caplog.at_level("INFO", logger="lightspeed_stack.llama_stack_configuration"): + with caplog.at_level("INFO", logger="lightspeed_stack.ogx_configuration"): apply_high_level_inference(ls_config, inference) ids = [p["provider_id"] for p in ls_config["providers"]["inference"]] assert ids == ["openai", "other"] # replaced in place, not duplicated @@ -415,7 +415,7 @@ def test_apply_high_level_inference_duplicate_id_last_wins( }, ] } - with caplog.at_level("INFO", logger="lightspeed_stack.llama_stack_configuration"): + with caplog.at_level("INFO", logger="lightspeed_stack.ogx_configuration"): apply_high_level_inference(ls_config, inference) entries = ls_config["providers"]["inference"] assert len(entries) == 1 @@ -765,9 +765,7 @@ def test_synthesize_default_path_keeps_conditional_openai( lcs: dict[str, Any], caplog: pytest.LogCaptureFixture ) -> None: """default or omitted baseline keeps the OpenAI row and warns naming byo-llm.""" - with caplog.at_level( - "WARNING", logger="lightspeed_stack.llama_stack_configuration" - ): + with caplog.at_level("WARNING", logger="lightspeed_stack.ogx_configuration"): result = synthesize_configuration(lcs) warnings = _byo_llm_deprecation_warnings(caplog) assert len(warnings) == 1 @@ -782,9 +780,7 @@ def test_synthesize_default_path_keeps_conditional_openai( def test_synthesize_byo_llm_strips_openai(caplog: pytest.LogCaptureFixture) -> None: """byo-llm drops the OpenAI row, keeps the embedder, and does not warn.""" lcs = {"ogx": {"config": {"baseline": "byo-llm"}}} - with caplog.at_level( - "WARNING", logger="lightspeed_stack.llama_stack_configuration" - ): + with caplog.at_level("WARNING", logger="lightspeed_stack.ogx_configuration"): result = synthesize_configuration(lcs) assert _byo_llm_deprecation_warnings(caplog) == [] assert _openai_inference_entries(result) == [] @@ -845,9 +841,7 @@ def test_synthesize_empty_baseline_does_not_strip_openai( } } } - with caplog.at_level( - "WARNING", logger="lightspeed_stack.llama_stack_configuration" - ): + with caplog.at_level("WARNING", logger="lightspeed_stack.ogx_configuration"): result = synthesize_configuration(lcs) assert _byo_llm_deprecation_warnings(caplog) == [] assert result == {"version": 2, "apis": ["inference"]} @@ -880,9 +874,7 @@ def test_synthesize_profile_ignores_byo_llm( } } } - with caplog.at_level( - "WARNING", logger="lightspeed_stack.llama_stack_configuration" - ): + with caplog.at_level("WARNING", logger="lightspeed_stack.ogx_configuration"): result = synthesize_configuration(lcs, config_file_dir=str(tmp_path)) assert _byo_llm_deprecation_warnings(caplog) == [] assert result["marker"] == "from-profile" @@ -1128,7 +1120,7 @@ def test_has_synthesis_input_detection() -> None: def _run_main(monkeypatch: pytest.MonkeyPatch, argv: list[str]) -> None: """Invoke the module CLI with the given arguments.""" - monkeypatch.setattr(sys, "argv", ["llama_stack_configuration.py", *argv]) + monkeypatch.setattr(sys, "argv", ["ogx_configuration.py", *argv]) main() diff --git a/tests/unit/utils/README.md b/tests/unit/utils/README.md index a1e2d51c1..34683e80d 100644 --- a/tests/unit/utils/README.md +++ b/tests/unit/utils/README.md @@ -44,7 +44,7 @@ Unit tests for utils/input_sanitization.py. Unit tests for utils/json_schema_updater module. -## [test_llama_stack_version.py](test_llama_stack_version.py) +## [test_ogx_version.py](test_ogx_version.py) Unit tests for utility function to check OGX version. diff --git a/tests/unit/utils/test_llama_stack_version.py b/tests/unit/utils/test_ogx_version.py similarity index 96% rename from tests/unit/utils/test_llama_stack_version.py rename to tests/unit/utils/test_ogx_version.py index fcf9a4bef..a6c110883 100644 --- a/tests/unit/utils/test_llama_stack_version.py +++ b/tests/unit/utils/test_ogx_version.py @@ -13,7 +13,7 @@ MAXIMAL_SUPPORTED_OGX_VERSION, MINIMAL_SUPPORTED_OGX_VERSION, ) -from utils.llama_stack_version import ( +from utils.ogx_version import ( InvalidOgxVersionException, check_ogx_version, ) @@ -124,7 +124,7 @@ async def test_check_ogx_version_retries_on_connection_error( ) -> None: """Test that check_ogx_version retries on APIConnectionError.""" mock_client = mocker.AsyncMock() - mock_sleep = mocker.patch("utils.llama_stack_version.asyncio.sleep") + mock_sleep = mocker.patch("utils.ogx_version.asyncio.sleep") # Fail twice with connection error, then succeed mock_client.inspect.version.side_effect = [ @@ -145,7 +145,7 @@ async def test_check_ogx_version_raises_after_max_retries( ) -> None: """Test that check_ogx_version raises after all retries are exhausted.""" mock_client = mocker.AsyncMock() - mock_sleep = mocker.patch("utils.llama_stack_version.asyncio.sleep") + mock_sleep = mocker.patch("utils.ogx_version.asyncio.sleep") mock_client.inspect.version.side_effect = APIConnectionError( request=mocker.MagicMock()