Skip to content

Commit 7274622

Browse files
committed
Add explicit docs for consuming OKP
1 parent 84faf9f commit 7274622

1 file changed

Lines changed: 213 additions & 0 deletions

File tree

docs/okp_guide.md

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
# OKP Deployment and Configuration Guide
2+
3+
This document explains how to deploy the Offline Knowledge Portal (OKP) as a RAG source and configure Lightspeed Stack and Llama Stack to use it. You will:
4+
5+
* Configure Lightspeed Stack for OKP (inline or tool RAG)
6+
* Run the configuration enrichment step
7+
* Deploy and verify the OKP Solr service
8+
* Install dependencies and launch Lightspeed Stack
9+
* Confirm the end-to-end stack with a sample query
10+
11+
For general RAG concepts, BYOK vector stores, and manual Llama Stack configuration, see the [RAG Configuration Guide](rag_guide.md).
12+
13+
---
14+
15+
## Table of Contents
16+
17+
* [Introduction](#introduction)
18+
* [Prerequisites](#prerequisites)
19+
* [Step 1: Configure Lightspeed Stack for OKP](#step-1-configure-lightspeed-stack-for-okp)
20+
* [Step 2: Run Configuration Enrichment](#step-2-run-configuration-enrichment)
21+
* [Step 3: Launch OKP](#step-3-launch-okp)
22+
* [Step 4: Install Dependencies and Launch Lightspeed Stack](#step-4-install-dependencies-and-launch-lightspeed-stack)
23+
* [Step 5: Verify the Stack](#step-5-verify-the-stack)
24+
* [OKP Configuration Reference](#okp-configuration-reference)
25+
* [References](#references)
26+
27+
---
28+
29+
## Introduction
30+
31+
OKP (Offline Knowledge Portal) provides a Solr-backed RAG source that Lightspeed Stack can use for both **Inline RAG** (context injected before the LLM request) and **Tool RAG** (context retrieved on demand via the `file_search` tool). This guide walks through deploying the OKP container, enriching your Llama Stack config from Lightspeed Stack settings, and validating that queries return referenced chunks.
32+
33+
---
34+
35+
## Prerequisites
36+
37+
* Lightspeed Stack repository cloned and ready to run
38+
* [lightspeed-providers](https://github.com/lightspeed-core/lightspeed-providers) repository cloned
39+
* A base Llama Stack config file (e.g. `run.yaml`) that defines inference and other providers you need
40+
* [Podman](https://podman.io/) (or Docker) to run the OKP image
41+
* [uv](https://docs.astral.sh/uv/) for Python dependency management
42+
* An OpenAI API key (for inference when using OpenAI in your run config)
43+
44+
---
45+
46+
## Step 1: Launch OKP
47+
48+
> **Warning:** The image referenced below is a **prototype**. The official OKP RAG image is expected in **late March / early April** of 2026.
49+
50+
Start the OKP RAG service with Podman:
51+
52+
```bash
53+
podman run --rm -d -p 8983:8080 images.paas.redhat.com/offline-kbase/rhokp-rag:mar-9-2026
54+
```
55+
56+
> **Note:** Remove `-d` to run in the foreground.
57+
58+
* The service listens on **port 8983** on the host (mapped from 8080 in the container).
59+
* Confirm it is running by opening in a browser or with `curl`:
60+
61+
```bash
62+
curl -s http://localhost:8983
63+
```
64+
65+
Or visit: **http://localhost:8983**
66+
67+
Ensure the LlamaStack `run_enriched_new.yaml` file is configured to use this OKP endpoint (the enrichment step typically adds the correct Solr/OKP URL; if you need a different host/port, adjust the `solr_url` config value accordingly).
68+
69+
---
70+
71+
## Step 2: Setup llamamstack config environment variables
72+
73+
Set the required environment variables. The external providers path must point to the `external_providers` content inside the [lightspeed-providers](https://github.com/lightspeed-core/lightspeed-providers/tree/main/lightspeed_stack_providers/) repository:
74+
75+
```bash
76+
export EXTERNAL_PROVIDERS_DIR=../lightspeed-providers/resources/external_providers
77+
export OPENAI_API_KEY=<your-openai-api-key>
78+
```
79+
80+
Adjust `EXTERNAL_PROVIDERS_DIR` if your lightspeed-providers repo is in a different location relative to your lightspeed-stack directory.
81+
82+
---
83+
84+
## Step 3: Install Lightspeed Stack Dependencies
85+
86+
Then install dependencies and custom providers:
87+
88+
```bash
89+
uv sync --group dev --group llslibdev
90+
uv pip install -e ../lightspeed-providers # Path to lightspeed-providers repo
91+
```
92+
93+
* **`uv sync`**: Installs project and dev/llslibdev groups so that the app and tooling run correctly.
94+
* **`uv pip install -e ../lightspeed-providers`**: Installs the lightspeed stack providers from the local clone of the repository. Adjust the directory path as needed.
95+
96+
> **Note:** Running `uv sync` will remove the lightspeeed-providers dependency insatlled by the `uv pip install` command, so you will need to rerun the `uv pip install` command if you rerun `uv sync`.
97+
98+
---
99+
100+
## Step 4: Configure Lightspeed Stack
101+
102+
### Enable OKP in Lightspeed Stack
103+
Edit your Lightspeed Stack config file (e.g. `lightspeed-stack.yaml`) and add the following top-level sections so that OKP is used for either inline or tool RAG:
104+
105+
Inline RAG:
106+
```yaml
107+
# RAG configuration
108+
rag:
109+
inline:
110+
- okp
111+
okp:
112+
offline: true
113+
chunk_filter_query: "is_chunk:true"
114+
```
115+
116+
Tool RAG:
117+
```yaml
118+
# RAG configuration
119+
rag:
120+
tool:
121+
- okp
122+
okp:
123+
offline: true
124+
chunk_filter_query: "is_chunk:true"
125+
```
126+
127+
* **`rag.inline`** and **`rag.tool`**: Enable OKP as the RAG source for inline context injection and for the RAG tool. Tool rag means the LLM will be provided a search tool it can choose to invoke to find relevant content and augment the user prompt. The tool may or may not be invoked. Inline means a rag search and prompt augmentation will always occur.
128+
* **`okp.offline`**: When `true`, source URLs use `parent_id` (offline/Mimir-style). When `false`, use `reference_url` (online).
129+
* **`okp.chunk_filter_query`**: Solr filter query applied to every OKP search (e.g. `"is_chunk:true"` to restrict to chunk documents). You can extend this with Solr boolean syntax (see [RAG Guide - Query Filtering](rag_guide.md)).
130+
131+
### Configure Lightspeed Stack for library mode
132+
133+
For the simplest local development, configure `lightspeed-stack.yaml` to consume Llama Stack in library mode:
134+
135+
```yaml
136+
llama_stack:
137+
...
138+
use_as_library_client: true
139+
library_client_config_path: run_enriched_new.yaml
140+
# Comment these lines out if present
141+
# url: http://lama-stack:87321
142+
# api_key: xyzzy
143+
...
144+
```
145+
146+
---
147+
148+
## Step 5: Run Configuration Enrichment
149+
150+
Enrich your base Llama Stack config with OKP (and any BYOK) settings from `lightspeed-stack.yaml` using the configuration script:
151+
152+
```bash
153+
uv run src/llama_stack_configuration.py -c lightspeed-stack.yaml -i run.yaml -o run_enriched_new.yaml
154+
```
155+
156+
* **`-c`**: Lightspeed Stack config (e.g. `lightspeed-stack.yaml`)
157+
* **`-i`**: Input Llama Stack config (e.g. `run.yaml`)
158+
* **`-o`**: Output enriched config (e.g. `run_enriched_new.yaml`)
159+
160+
Use the **output file** (e.g. `run_enriched_new.yaml`) when starting Llama Stack / Lightspeed Stack so that OKP vector IO and related resources are registered.
161+
162+
> [!TIP]
163+
> Re-run this command whenever you change RAG or OKP settings in `lightspeed-stack.yaml` so that the enriched run file stays in sync.
164+
165+
---
166+
167+
## Step 6: Launch Lightspeed Stack
168+
169+
Then launch Lightspeed Stack using your **enriched** Llama Stack config (e.g. `run_enriched_new.yaml`) and your Lightspeed Stack config, following your usual run instructions (e.g. pointing to the enriched run file and the correct port).
170+
171+
```bash
172+
make run
173+
```
174+
175+
---
176+
177+
## Step 7: Verify the Stack
178+
179+
Confirm that the full stack (Lightspeed Stack + Llama Stack + OKP) is working by sending a query and checking that the response includes referenced chunks from OKP:
180+
181+
```bash
182+
curl -sX POST http://localhost:8080/v1/query \
183+
-H "Content-Type: application/json" \
184+
-d '{"query": "configure remote desktop using gnome"}' | jq .
185+
```
186+
187+
* Adjust the URL and port if your Lightspeed Stack API is exposed elsewhere.
188+
* In the JSON response, look for `rag_chunks` that indicate OKP/Solr results were retrieved.
189+
190+
Example response excerpt:
191+
```json
192+
"rag_chunks": [
193+
{
194+
"content": "You can connect from a Red Hat Enterprise Linux client to a remote desktop server by using the\n**Connections**\napplication. The connection depends on the remote server configuration.\n**Prerequisites**\n- Desktop sharing or remote login is enabled on the server. For more information, see [Enabling desktop sharing on the server by using GNOME](#enabling-desktop-sharing-on-the-server-by-using-gnome) or [Configuring GNOME remote login](#configuring-gnome-remote-login) .\n- For desktop sharing, a user is logged in to the GNOME graphical session on the server.\n- The `gnome-connections` package is installed on the client.\n**Procedure**\n1. On the client, launch the **Connections** application.\n2. Click the + button in the top bar to open a new connection.\n4. Enter the IP address of the server.\n5. Choose the connection type based on the operating system you want to connect to: Remote Desktop Protocol (RDP) Use RDP for connecting to Windows and RHEL 10 servers. Virtual Network Computing (VNC) Use VNC for connecting to servers with RHEL 9 and previous versions.\n6. Click Connect .\n**Verification**\n1. On the client, check that you can see the shared server desktop.\n2. On the server, a screen sharing indicator appears on the right side of the top panel: You can control screen sharing in the **System** menu of the server.",
195+
"source": "okp",
196+
"score": 826.40784,
197+
"attributes": {
198+
"doc_url": "https://mimir.corp.redhat.com/documentation/en-us/red_hat_enterprise_linux/10/html-single/administering_rhel_by_using_the_gnome_desktop_environment/index",
199+
"document_id": "/documentation/en-us/red_hat_enterprise_linux/10/html-single/administering_rhel_by_using_the_gnome_desktop_environment/index"
200+
}
201+
}
202+
],
203+
```
204+
205+
> **Note:** The first time you query the system the response may take additional time because it must first download the necessary embedding model to perform the vector search.
206+
207+
If you see no RAG context, verify:
208+
209+
1. OKP is up at http://localhost:8983
210+
2. You started Lightspeed Stack with the **enriched** run file from Step 2
211+
3. `lightspeed-stack.yaml` has `okp` under `rag.inline` and/or `rag.tool` as in Step 1
212+
213+
---

0 commit comments

Comments
 (0)