Skip to content

Commit c01baf8

Browse files
authored
Merge pull request #994 from raptorsun/aipcc-wheel
konflux: use wheels from RHOAI index
2 parents 05cbff0 + 5812aa0 commit c01baf8

18 files changed

Lines changed: 1188 additions & 8157 deletions

.tekton/lightspeed-stack-pull-request.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@ spec:
4949
"type": "pip",
5050
"path": ".",
5151
"requirements_files": [
52-
"requirements.x86_64.txt",
53-
"requirements.aarch64.txt",
54-
"requirements.hermetic.txt",
55-
"requirements.torch.txt"
52+
"requirements.hashes.wheel.txt",
53+
"requirements.hashes.source.txt",
54+
"requirements.hermetic.txt"
5655
],
5756
"requirements_build_files": ["requirements-build.txt"],
5857
"binary": {
59-
"packages": "torch,faiss-cpu,uv,pip,jiter,tiktoken,numpy,scipy,pandas,pillow,scikit_learn,pyarrow,cryptography,fastuuid,hf_xet,maturin,pydantic_core,rpds_py,safetensors,tokenizers",
58+
"packages": "accelerate,aiohappyeyeballs,aiohttp,aiosignal,aiosqlite,annotated-doc,annotated-types,anyio,asyncpg,attrs,autoevals,cachetools,cffi,charset-normalizer,chevron,click,cryptography,datasets,dill,distro,dnspython,durationpy,faiss-cpu,fire,frozenlist,fsspec,googleapis-common-protos,greenlet,grpcio,h11,hf-xet,httpcore,httpx,httpx-sse,huggingface-hub,idna,jinja2,jiter,joblib,jsonschema-specifications,llama-stack-client,lxml,markdown-it-py,markupsafe,mdurl,mpmath,multidict,networkx,nltk,numpy,oauthlib,opentelemetry-api,opentelemetry-exporter-otlp,opentelemetry-exporter-otlp-proto-common,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-exporter-otlp-proto-http,opentelemetry-instrumentation,opentelemetry-proto,opentelemetry-sdk,opentelemetry-semantic-conventions,packaging,pandas,pillow,ply,polyleven,prompt-toolkit,propcache,proto-plus,psycopg2-binary,pyaml,pyarrow,pyasn1,pyasn1-modules,pycparser,pydantic,pydantic-core,pydantic-settings,pygments,pyjwt,python-dateutil,python-dotenv,python-multipart,pytz,pyyaml,referencing,regex,requests,requests-oauthlib,rich,rpds-py,rsa,safetensors,scikit-learn,scipy,sentence-transformers,setuptools,six,sniffio,sqlalchemy,starlette,sympy,threadpoolctl,tiktoken,tokenizers,torch,tqdm,transformers,triton,typing-extensions,typing-inspection,tzdata,urllib3,wcwidth,websocket-client,wrapt,xxhash,yarl,zipp,uv,pip,maturin",
6059
"os": "linux",
6160
"arch": "x86_64,aarch64",
6261
"py_version": "312"

.tekton/lightspeed-stack-push.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ spec:
4141
"type": "pip",
4242
"path": ".",
4343
"requirements_files": [
44-
"requirements.x86_64.txt",
45-
"requirements.aarch64.txt",
46-
"requirements.hermetic.txt",
47-
"requirements.torch.txt"
44+
"requirements.hashes.wheel.txt",
45+
"requirements.hashes.source.txt",
46+
"requirements.hermetic.txt"
4847
],
4948
"requirements_build_files": ["requirements-build.txt"],
5049
"binary": {
51-
"packages": "torch,faiss-cpu,uv,pip,jiter,tiktoken,numpy,scipy,pandas,pillow,scikit_learn,pyarrow,cryptography,fastuuid,hf_xet,maturin,pydantic_core,rpds_py,safetensors,tokenizers",
50+
"packages": "accelerate,aiohappyeyeballs,aiohttp,aiosignal,aiosqlite,annotated-doc,annotated-types,anyio,asyncpg,attrs,autoevals,cachetools,cffi,charset-normalizer,chevron,click,cryptography,datasets,dill,distro,dnspython,durationpy,faiss-cpu,fire,frozenlist,fsspec,googleapis-common-protos,greenlet,grpcio,h11,hf-xet,httpcore,httpx,httpx-sse,huggingface-hub,idna,jinja2,jiter,joblib,jsonschema-specifications,llama-stack-client,lxml,markdown-it-py,markupsafe,mdurl,mpmath,multidict,networkx,nltk,numpy,oauthlib,opentelemetry-api,opentelemetry-exporter-otlp,opentelemetry-exporter-otlp-proto-common,opentelemetry-exporter-otlp-proto-grpc,opentelemetry-exporter-otlp-proto-http,opentelemetry-instrumentation,opentelemetry-proto,opentelemetry-sdk,opentelemetry-semantic-conventions,packaging,pandas,pillow,ply,polyleven,prompt-toolkit,propcache,proto-plus,psycopg2-binary,pyaml,pyarrow,pyasn1,pyasn1-modules,pycparser,pydantic,pydantic-core,pydantic-settings,pygments,pyjwt,python-dateutil,python-dotenv,python-multipart,pytz,pyyaml,referencing,regex,requests,requests-oauthlib,rich,rpds-py,rsa,safetensors,scikit-learn,scipy,sentence-transformers,setuptools,six,sniffio,sqlalchemy,starlette,sympy,threadpoolctl,tiktoken,tokenizers,torch,tqdm,transformers,triton,typing-extensions,typing-inspection,tzdata,urllib3,wcwidth,websocket-client,wrapt,xxhash,yarl,zipp,uv,pip,maturin",
5251
"os": "linux",
5352
"arch": "x86_64,aarch64",
5453
"py_version": "312"

Containerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ ARG APP_ROOT=/app-root
55
ARG LSC_SOURCE_DIR=.
66

77
# UV_PYTHON_DOWNLOADS=0 : Disable Python interpreter downloads and use the system interpreter.
8+
# MATURIN_NO_INSTALL_RUST=1 : Disable installation of Rust dependencies by Maturin.
89
ENV UV_COMPILE_BYTECODE=0 \
910
UV_LINK_MODE=copy \
10-
UV_PYTHON_DOWNLOADS=0
11+
UV_PYTHON_DOWNLOADS=0 \
12+
MATURIN_NO_INSTALL_RUST=1
1113

1214
WORKDIR /app-root
1315

1416
USER root
1517

1618
# Install gcc - required by polyleven python package on aarch64
1719
# (dependency of autoevals, no pre-built binary wheels for linux on aarch64)
18-
RUN dnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs gcc
20+
# cmake and cargo are required by fastuuid, maturin
21+
RUN dnf install -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs gcc cmake cargo
1922

2023
# Install uv package manager
2124
RUN pip3.12 install "uv>=0.8.15"
@@ -34,7 +37,8 @@ RUN if [ -f /cachi2/cachi2.env ]; then \
3437
. /cachi2/cachi2.env && \
3538
uv venv --seed --no-index --find-links ${PIP_FIND_LINKS} && \
3639
. .venv/bin/activate && \
37-
pip install --no-index --find-links ${PIP_FIND_LINKS} -r requirements.$(uname -m).txt -r requirements.torch.txt; \
40+
pip install --no-cache-dir --ignore-installed --no-index --find-links ${PIP_FIND_LINKS} --no-deps -r requirements.hashes.wheel.txt -r requirements.hashes.source.txt && \
41+
pip check; \
3842
else \
3943
uv sync --locked --no-dev --group llslibdev; \
4044
fi

Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PATH_TO_PLANTUML := ~/bin
77
PYTHON_REGISTRY = pypi
88

99
# PyTorch version
10-
TORCH_VERSION := 2.7.1
10+
TORCH_VERSION := 2.9.0
1111

1212

1313
run: ## Run the service locally
@@ -111,14 +111,7 @@ upload-distribution-archives: ## Upload distribution archives into Python regist
111111
uv run python -m twine upload --repository ${PYTHON_REGISTRY} dist/*
112112

113113
konflux-requirements: ## generate hermetic requirements.*.txt file for konflux build
114-
uv pip compile pyproject.toml -o requirements.x86_64.txt --generate-hashes --group llslibdev --python-platform x86_64-unknown-linux-gnu --torch-backend cpu --python-version 3.12 --refresh
115-
uv pip compile pyproject.toml -o requirements.aarch64.txt --generate-hashes --group llslibdev --python-platform aarch64-unknown-linux-gnu --torch-backend cpu --python-version 3.12 --refresh
116-
./scripts/remove_torch_deps.sh requirements.x86_64.txt
117-
./scripts/remove_torch_deps.sh requirements.aarch64.txt
118-
echo "torch==${TORCH_VERSION}" | uv pip compile - -o requirements.torch.txt --generate-hashes --python-version 3.12 --torch-backend cpu --emit-index-url --no-deps --index-url https://download.pytorch.org/whl/cpu --refresh
119-
uv run pybuild-deps compile --output-file=requirements-build.txt \
120-
<(grep -v "^faiss-cpu" requirements.hermetic.txt) \
121-
<(grep -Eo "^[a-zA-Z0-9][-a-zA-Z0-9._]*==[^ ]+" requirements.x86_64.txt | grep -v "^faiss-cpu")
114+
./scripts/konflux_requirements.sh
122115

123116
help: ## Show this help screen
124117
@echo 'Usage: make <OPTIONS> ... <TARGETS>'

README.md

Lines changed: 80 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,85 +16,93 @@ The service includes comprehensive user data collection capabilities for various
1616
<!-- vim-markdown-toc GFM -->
1717

1818
* [lightspeed-stack](#lightspeed-stack)
19-
* [About The Project](#about-the-project)
19+
* [About The Project](#about-the-project)
2020
* [Architecture](#architecture)
2121
* [Prerequisites](#prerequisites)
2222
* [Installation](#installation)
2323
* [Run LCS locally](#run-lcs-locally)
2424
* [Configuration](#configuration)
25-
* [LLM Compatibility](#llm-compatibility)
26-
* [Set LLM provider and model](#set-llm-provider-and-model)
27-
* [Selecting provider and model](#selecting-provider-and-model)
28-
* [Provider and model selection in REST API request](#provider-and-model-selection-in-rest-api-request)
29-
* [Default provider and model](#default-provider-and-model)
30-
* [Supported providers](#supported-providers)
31-
* [Integration with Llama Stack](#integration-with-llama-stack)
32-
* [Llama Stack as separate server](#llama-stack-as-separate-server)
33-
* [MCP Server and Tool Configuration](#mcp-server-and-tool-configuration)
34-
* [Configuring MCP Servers](#configuring-mcp-servers)
35-
* [Configuring MCP Headers](#configuring-mcp-headers)
36-
* [Llama Stack project and configuration](#llama-stack-project-and-configuration)
37-
* [Check connection to Llama Stack](#check-connection-to-llama-stack)
38-
* [Llama Stack as client library](#llama-stack-as-client-library)
39-
* [Llama Stack version check](#llama-stack-version-check)
40-
* [User data collection](#user-data-collection)
41-
* [System prompt](#system-prompt)
42-
* [System Prompt Path](#system-prompt-path)
43-
* [System Prompt Literal](#system-prompt-literal)
44-
* [Custom Profile](#custom-profile)
45-
* [Control model/provider overrides via authorization](#control-modelprovider-overrides-via-authorization)
46-
* [Safety Shields](#safety-shields)
47-
* [Authentication](#authentication)
48-
* [CORS](#cors)
49-
* [Default values](#default-values)
50-
* [Allow credentials](#allow-credentials)
25+
* [LLM Compatibility](#llm-compatibility)
26+
* [Set LLM provider and model](#set-llm-provider-and-model)
27+
* [Selecting provider and model](#selecting-provider-and-model)
28+
* [Provider and model selection in REST API request](#provider-and-model-selection-in-rest-api-request)
29+
* [Default provider and model](#default-provider-and-model)
30+
* [Supported providers](#supported-providers)
31+
* [Integration with Llama Stack](#integration-with-llama-stack)
32+
* [Llama Stack as separate server](#llama-stack-as-separate-server)
33+
* [MCP Server and Tool Configuration](#mcp-server-and-tool-configuration)
34+
* [Configuring MCP Servers](#configuring-mcp-servers)
35+
* [Configuring MCP Server Authentication](#configuring-mcp-server-authentication)
36+
* [1. Static Tokens from Files (Recommended for Service Credentials)](#1-static-tokens-from-files-recommended-for-service-credentials)
37+
* [2. Kubernetes Service Account Tokens (For K8s Deployments)](#2-kubernetes-service-account-tokens-for-k8s-deployments)
38+
* [3. Client-Provided Tokens (For Per-User Authentication)](#3-client-provided-tokens-for-per-user-authentication)
39+
* [Combining Authentication Methods](#combining-authentication-methods)
40+
* [Authentication Method Comparison](#authentication-method-comparison)
41+
* [Important: Automatic Server Skipping](#important-automatic-server-skipping)
42+
* [Llama Stack project and configuration](#llama-stack-project-and-configuration)
43+
* [Check connection to Llama Stack](#check-connection-to-llama-stack)
44+
* [Llama Stack as client library](#llama-stack-as-client-library)
45+
* [Llama Stack version check](#llama-stack-version-check)
46+
* [User data collection](#user-data-collection)
47+
* [System prompt](#system-prompt)
48+
* [System Prompt Path](#system-prompt-path)
49+
* [System Prompt Literal](#system-prompt-literal)
50+
* [Custom Profile](#custom-profile)
51+
* [Control model/provider overrides via authorization](#control-modelprovider-overrides-via-authorization)
52+
* [Safety Shields](#safety-shields)
53+
* [Authentication](#authentication)
54+
* [CORS](#cors)
55+
* [Default values](#default-values)
56+
* [Allow credentials](#allow-credentials)
5157
* [RAG Configuration](#rag-configuration)
52-
* [Example configurations for inference](#example-configurations-for-inference)
58+
* [Example configurations for inference](#example-configurations-for-inference)
5359
* [Usage](#usage)
54-
* [Make targets](#make-targets)
55-
* [Running Linux container image](#running-linux-container-image)
56-
* [Building Container Images](#building-container-images)
57-
* [Llama-Stack as Separate Service (Server Mode)](#llama-stack-as-separate-service-server-mode)
58-
* [macOS (arm64)](#macos-arm64)
59-
* [Llama-Stack as Library (Library Mode)](#llama-stack-as-library-library-mode)
60-
* [macOS](#macos)
61-
* [Verify it's running properly](#verify-its-running-properly)
62-
* [Custom Container Image](#custom-container-image)
60+
* [Make targets](#make-targets)
61+
* [Running Linux container image](#running-linux-container-image)
62+
* [Building Container Images](#building-container-images)
63+
* [Llama-Stack as Separate Service (Server Mode)](#llama-stack-as-separate-service-server-mode)
64+
* [macOS (arm64)](#macos-arm64)
65+
* [Llama-Stack as Library (Library Mode)](#llama-stack-as-library-library-mode)
66+
* [macOS](#macos)
67+
* [Verify it's running properly](#verify-its-running-properly)
68+
* [Custom Container Image](#custom-container-image)
6369
* [Endpoints](#endpoints)
64-
* [OpenAPI specification](#openapi-specification)
65-
* [Readiness Endpoint](#readiness-endpoint)
66-
* [Liveness Endpoint](#liveness-endpoint)
70+
* [OpenAPI specification](#openapi-specification)
71+
* [Readiness Endpoint](#readiness-endpoint)
72+
* [Liveness Endpoint](#liveness-endpoint)
6773
* [Database structure](#database-structure)
6874
* [Publish the service as Python package on PyPI](#publish-the-service-as-python-package-on-pypi)
69-
* [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
70-
* [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
71-
* [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
75+
* [Generate distribution archives to be uploaded into Python registry](#generate-distribution-archives-to-be-uploaded-into-python-registry)
76+
* [Upload distribution archives into selected Python registry](#upload-distribution-archives-into-selected-python-registry)
77+
* [Packages on PyPI and Test PyPI](#packages-on-pypi-and-test-pypi)
7278
* [Contributing](#contributing)
7379
* [Testing](#testing)
7480
* [License](#license)
7581
* [Additional tools](#additional-tools)
76-
* [Utility to generate OpenAPI schema](#utility-to-generate-openapi-schema)
77-
* [Path](#path)
78-
* [Usage](#usage-1)
79-
* [Makefile target to generate OpenAPI specification](#makefile-target-to-generate-openapi-specification)
80-
* [Utility to generate documentation from source code](#utility-to-generate-documentation-from-source-code)
81-
* [Path](#path-1)
82-
* [Usage](#usage-2)
82+
* [Utility to generate OpenAPI schema](#utility-to-generate-openapi-schema)
83+
* [Path](#path)
84+
* [Usage](#usage-1)
85+
* [Makefile target to generate OpenAPI specification](#makefile-target-to-generate-openapi-specification)
86+
* [Utility to generate documentation from source code](#utility-to-generate-documentation-from-source-code)
87+
* [Path](#path-1)
88+
* [Usage](#usage-2)
8389
* [Data Export Integration](#data-export-integration)
84-
* [Quick Integration](#quick-integration)
85-
* [Documentation](#documentation)
90+
* [Quick Integration](#quick-integration)
91+
* [Documentation](#documentation)
8692
* [Project structure](#project-structure)
87-
* [Configuration classes](#configuration-classes)
88-
* [REST API](#rest-api)
89-
* [Sequence diagrams](#sequence-diagrams)
90-
* [Query endpoint REST API handler](#query-endpoint-rest-api-handler)
91-
* [Streaming query endpoint REST API handler](#streaming-query-endpoint-rest-api-handler)
92-
* [Versioning](#versioning)
93+
* [Configuration classes](#configuration-classes)
94+
* [REST API](#rest-api)
95+
* [Sequence diagrams](#sequence-diagrams)
96+
* [Query endpoint REST API handler](#query-endpoint-rest-api-handler)
97+
* [Streaming query endpoint REST API handler](#streaming-query-endpoint-rest-api-handler)
98+
* [Versioning](#versioning)
99+
* [Development Tools](#development-tools)
100+
* [MCP Mock Server](#mcp-mock-server)
93101
* [Konflux](#konflux)
94-
* [Updating Dependencies for Hermetic Builds](#updating-dependencies-for-hermetic-builds)
95-
* [When to Update Dependency Files](#when-to-update-dependency-files)
96-
* [Updating Python Dependencies](#updating-python-dependencies)
97-
* [Updating RPM Dependencies](#updating-rpm-dependencies)
102+
* [Updating Dependencies for Hermetic Builds](#updating-dependencies-for-hermetic-builds)
103+
* [When to Update Dependency Files](#when-to-update-dependency-files)
104+
* [Updating Python Dependencies](#updating-python-dependencies)
105+
* [Updating RPM Dependencies](#updating-rpm-dependencies)
98106

99107
<!-- vim-markdown-toc -->
100108

@@ -421,13 +429,13 @@ mcp_servers:
421429
url: "http://weather-api:8080"
422430
authorization_headers:
423431
X-API-Key: "/var/secrets/weather-api-key"
424-
432+
425433
# Kubernetes auth for internal services
426434
- name: "internal-db"
427435
url: "http://db-mcp.cluster.local:8080"
428436
authorization_headers:
429437
Authorization: "kubernetes"
430-
438+
431439
# Mixed: static API key + per-user token
432440
- name: "multi-tenant-service"
433441
url: "http://multi-tenant:8080"
@@ -1176,10 +1184,14 @@ Update these files when you:
11761184
make konflux-requirements
11771185
```
11781186
1179-
This generates three platform-specific requirements files:
1180-
- `requirements.x86_64.txt` - x86_64 packages (excludes torch)
1181-
- `requirements.aarch64.txt` - ARM64 packages (excludes torch)
1182-
- `requirements.torch.txt` - CPU variant of torch (shared by both platforms)
1187+
This compiles Python dependencies from `pyproject.toml` using `uv`, splits packages by their source index (PyPI vs Red Hat's internal registry), and generates hermetic requirements files with pinned versions and hashes for Konflux builds.
1188+
1189+
**Files produced:**
1190+
- `requirements.hashes.source.txt` – PyPI packages with hashes
1191+
- `requirements.hashes.wheel.txt` – Red Hat registry packages with hashes
1192+
- `requirements-build.txt` – Build-time dependencies for source packages
1193+
1194+
The script also updates the Tekton pipeline configurations (`.tekton/lightspeed-stack-*.yaml`) with the list of pre-built wheel packages.
11831195

11841196
### Updating RPM Dependencies
11851197

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ llslibdev = [
167167
"opentelemetry-exporter-otlp>=1.34.1",
168168
# API tool_runtime: inline::rag-runtime
169169
"transformers>=4.34.0",
170-
"numpy==2.2.6",
170+
"numpy==2.3.5",
171171
# API tool_runtime: remote::model-context-protocol
172172
"mcp>=1.9.4",
173173
# API post_training: inline::huggingface
174-
"torch==2.7.1",
174+
"torch==2.9.0",
175175
"trl>=0.18.2",
176176
"peft>=0.15.2",
177177
# Other

0 commit comments

Comments
 (0)