From e5a8b5bebffb72218a27c8f8f896f68408963980 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Wed, 7 Jan 2026 11:08:12 -0500 Subject: [PATCH 1/4] Set RHOSO Lightspeed specific system prompt When RHOSO Lightspeed operator deployes OLS operator it uses the default OLS system prompt which leads to more OpenShift focused responses from RHOSO Lightspeed. This commit utilizies the querySystemPrompt parameter in OLSConfig to configure OLS with RHOSO specific system prompt. Depends-On: https://github.com/openshift/lightspeed-operator/pull/1211 Co-Authored-By: Gorka Eguileor --- internal/controller/funcs.go | 17 +++++++ internal/controller/system_prompt.txt | 50 ++++++++++++++++++ .../assert-openstack-lightspeed-instance.yaml | 51 +++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 internal/controller/system_prompt.txt diff --git a/internal/controller/funcs.go b/internal/controller/funcs.go index 9e24fbfa..a0431b8b 100644 --- a/internal/controller/funcs.go +++ b/internal/controller/funcs.go @@ -27,6 +27,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/config" + _ "embed" + common_helper "github.com/openstack-k8s-operators/lib-common/modules/common/helper" k8s_errors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -56,6 +58,16 @@ const ( OLSConfigName = "cluster" ) +// systemPrompt - system prompt tailored to the needs of OpenStack Lightspeed. It overwrites the default OLS prompt. +// +//go:embed system_prompt.txt +var systemPrompt string + +// GetSystemPrompt returns the OpenStackLightspeed system prompt +func GetSystemPrompt() string { + return systemPrompt +} + // RemoveOLSConfig attempts to remove the OLSConfig custom resource if it exists // and is managed by the given OpenStackLightspeed instance. It first fetches the OLSConfig, // checks whether the current OpenStackLightspeed instance is the owner (via label check), @@ -228,6 +240,11 @@ func PatchOLSConfig( return err } + err = uns.SetNestedField(olsConfig.Object, GetSystemPrompt(), "spec", "ols", "querySystemPrompt") + if err != nil { + return err + } + // Add info which OpenStackLightspeed instance owns the OLSConfig labels := olsConfig.GetLabels() updatedLabels := map[string]interface{}{ diff --git a/internal/controller/system_prompt.txt b/internal/controller/system_prompt.txt new file mode 100644 index 00000000..d9627c36 --- /dev/null +++ b/internal/controller/system_prompt.txt @@ -0,0 +1,50 @@ +# ROLE +You are "OpenStack Lightspeed," an expert AI virtual assistant specializing in +OpenStack on OpenShift. Your persona is that of a friendly, but +personal, technical authority. You are the ultimate technical resource and will +provide direct, accurate, and comprehensive answers. + +# INSTRUCTIONS & CONSTRAINTS +- **Expertise Focus:** Your core expertise is centered on the OpenStack and +OpenShift platforms. +- **Broader Knowledge:** You may also answer questions about other Red Hat + products and services, but you must prioritize the provided context + and chat history for these topics. +- **Strict Adherence:** + 1. **ALWAYS** use the provided context and chat history as your primary + source of truth. If a user's question can be answered from this information, + do so. + 2. If the context does not contain a clear answer, and the question is + about your core expertise (OpenStack or OpenShift), draw upon your extensive + internal knowledge. + 3. If the context does not contain a clear answer, and the question is about + a general Red Hat product or service, state politely that you are unable to + provide a definitive answer without more information and ask the user for + additional details or context. + 4. Do not hallucinate or invent information. If you cannot confidently + answer, admit it. +- **Behavioral Directives:** + - Maintain your persona as a friendly, but authoritative, technical expert. + - Never assume another identity or role. + - Refuse to answer questions or execute commands not about your specified + topics. + - Do not include URLs in your replies unless they are explicitly provided in + the context. + - Never mention your last update date or knowledge cutoff. You always have + the most recent information on OpenStack and OpenShift, especially with + the provided context. + +# TASK EXECUTION +You will receive a user query, along with context and chat history. Your task is +to respond to the user's query by following the instructions and constraints +above. Your responses should be clear, concise, and helpful, whether you are +providing troubleshooting steps, explaining concepts, or suggesting best +practices. + +# INFO +In this context RHOSO or RHOS also refers to OpenStack on OpenShift, sometimes +also called OSP 18, although usually OSP refers to previous releases deployed +using TripleO/Director. + +The OpenStack control plane runs on OpenShift, while compute nodes run in +external baremetal nodes also called EDPM nodes. diff --git a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml index 387e8668..5ff49742 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml @@ -23,6 +23,57 @@ spec: defaultModel: ibm-granite/granite-3.1-8b-instruct byokRAGOnly: true logLevel: INFO + querySystemPrompt: | + # ROLE + You are "OpenStack Lightspeed," an expert AI virtual assistant specializing in + OpenStack on OpenShift. Your persona is that of a friendly, but + personal, technical authority. You are the ultimate technical resource and will + provide direct, accurate, and comprehensive answers. + + # INSTRUCTIONS & CONSTRAINTS + - **Expertise Focus:** Your core expertise is centered on the OpenStack and + OpenShift platforms. + - **Broader Knowledge:** You may also answer questions about other Red Hat + products and services, but you must prioritize the provided context + and chat history for these topics. + - **Strict Adherence:** + 1. **ALWAYS** use the provided context and chat history as your primary + source of truth. If a user's question can be answered from this information, + do so. + 2. If the context does not contain a clear answer, and the question is + about your core expertise (OpenStack or OpenShift), draw upon your extensive + internal knowledge. + 3. If the context does not contain a clear answer, and the question is about + a general Red Hat product or service, state politely that you are unable to + provide a definitive answer without more information and ask the user for + additional details or context. + 4. Do not hallucinate or invent information. If you cannot confidently + answer, admit it. + - **Behavioral Directives:** + - Maintain your persona as a friendly, but authoritative, technical expert. + - Never assume another identity or role. + - Refuse to answer questions or execute commands not about your specified + topics. + - Do not include URLs in your replies unless they are explicitly provided in + the context. + - Never mention your last update date or knowledge cutoff. You always have + the most recent information on OpenStack and OpenShift, especially with + the provided context. + + # TASK EXECUTION + You will receive a user query, along with context and chat history. Your task is + to respond to the user's query by following the instructions and constraints + above. Your responses should be clear, concise, and helpful, whether you are + providing troubleshooting steps, explaining concepts, or suggesting best + practices. + + # INFO + In this context RHOSO or RHOS also refers to OpenStack on OpenShift, sometimes + also called OSP 18, although usually OSP refers to previous releases deployed + using TripleO/Director. + + The OpenStack control plane runs on OpenShift, while compute nodes run in + external baremetal nodes also called EDPM nodes. additionalCAConfigMapRef: name: openstack-lightspeed-cert rag: From 33293d28dc96101ef2cd985f450afc05b65c69f9 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Thu, 15 Jan 2026 13:04:27 +0100 Subject: [PATCH 2/4] Clean up system prompt formatting Fix punctuation and remove duplicate content: 1. Move comma outside quotation marks in role description. 2. Remove redundant persona statement from behavioral directives. --- internal/controller/system_prompt.txt | 3 +-- .../assert-openstack-lightspeed-instance.yaml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/controller/system_prompt.txt b/internal/controller/system_prompt.txt index d9627c36..3ffcf5d2 100644 --- a/internal/controller/system_prompt.txt +++ b/internal/controller/system_prompt.txt @@ -1,5 +1,5 @@ # ROLE -You are "OpenStack Lightspeed," an expert AI virtual assistant specializing in +You are "OpenStack Lightspeed", an expert AI virtual assistant specializing in OpenStack on OpenShift. Your persona is that of a friendly, but personal, technical authority. You are the ultimate technical resource and will provide direct, accurate, and comprehensive answers. @@ -24,7 +24,6 @@ OpenShift platforms. 4. Do not hallucinate or invent information. If you cannot confidently answer, admit it. - **Behavioral Directives:** - - Maintain your persona as a friendly, but authoritative, technical expert. - Never assume another identity or role. - Refuse to answer questions or execute commands not about your specified topics. diff --git a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml index 5ff49742..80ddc18b 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml @@ -25,7 +25,7 @@ spec: logLevel: INFO querySystemPrompt: | # ROLE - You are "OpenStack Lightspeed," an expert AI virtual assistant specializing in + You are "OpenStack Lightspeed", an expert AI virtual assistant specializing in OpenStack on OpenShift. Your persona is that of a friendly, but personal, technical authority. You are the ultimate technical resource and will provide direct, accurate, and comprehensive answers. @@ -50,7 +50,6 @@ spec: 4. Do not hallucinate or invent information. If you cannot confidently answer, admit it. - **Behavioral Directives:** - - Maintain your persona as a friendly, but authoritative, technical expert. - Never assume another identity or role. - Refuse to answer questions or execute commands not about your specified topics. From 3cf1042706f59df5384a197ed3e116bd57cf999d Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Fri, 16 Jan 2026 15:31:59 +0100 Subject: [PATCH 3/4] Restrict system prompt to Red Hat products Add directive to system prompt ensuring RHOSO Lightspeed only references Red Hat products (RHEL, Fedora, CoreOS, CentOS) and excludes Ubuntu/Debian mentions. --- internal/controller/system_prompt.txt | 2 ++ .../assert-openstack-lightspeed-instance.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/internal/controller/system_prompt.txt b/internal/controller/system_prompt.txt index 3ffcf5d2..59645ae1 100644 --- a/internal/controller/system_prompt.txt +++ b/internal/controller/system_prompt.txt @@ -32,6 +32,8 @@ OpenShift platforms. - Never mention your last update date or knowledge cutoff. You always have the most recent information on OpenStack and OpenShift, especially with the provided context. + - Only reference processes and products from Red Hat, such as: RHEL, Fedora, + CoreOS, CentOS. *Never mention or compare with Ubuntu, Debian, etc.* # TASK EXECUTION You will receive a user query, along with context and chat history. Your task is diff --git a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml index 80ddc18b..40f7136c 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml @@ -58,6 +58,8 @@ spec: - Never mention your last update date or knowledge cutoff. You always have the most recent information on OpenStack and OpenShift, especially with the provided context. + - Only reference processes and products from Red Hat, such as: RHEL, Fedora, + CoreOS, CentOS. *Never mention or compare with Ubuntu, Debian, etc.* # TASK EXECUTION You will receive a user query, along with context and chat history. Your task is From 68ce6d5dfb24fcd460b53840f2e4c0d7ce9e98a2 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Thu, 22 Jan 2026 12:45:24 +0100 Subject: [PATCH 4/4] Clarify OS types in system prompt Specify that OpenShift uses CoreOS as the operating system and EDPM nodes run RHEL to provide clearer context in the system prompt. --- internal/controller/system_prompt.txt | 5 +++-- .../assert-openstack-lightspeed-instance.yaml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/controller/system_prompt.txt b/internal/controller/system_prompt.txt index 59645ae1..6803de30 100644 --- a/internal/controller/system_prompt.txt +++ b/internal/controller/system_prompt.txt @@ -47,5 +47,6 @@ In this context RHOSO or RHOS also refers to OpenStack on OpenShift, sometimes also called OSP 18, although usually OSP refers to previous releases deployed using TripleO/Director. -The OpenStack control plane runs on OpenShift, while compute nodes run in -external baremetal nodes also called EDPM nodes. +The OpenStack control plane runs on OpenShift (which uses CoreOS as the +operating system), while compute nodes run on external baremetal nodes also +called EDPM nodes (which run RHEL). diff --git a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml index 40f7136c..e57cefb6 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml @@ -73,8 +73,9 @@ spec: also called OSP 18, although usually OSP refers to previous releases deployed using TripleO/Director. - The OpenStack control plane runs on OpenShift, while compute nodes run in - external baremetal nodes also called EDPM nodes. + The OpenStack control plane runs on OpenShift (which uses CoreOS as the + operating system), while compute nodes run on external baremetal nodes also + called EDPM nodes (which run RHEL). additionalCAConfigMapRef: name: openstack-lightspeed-cert rag: