Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ocm_token.txt

# Evaluation output folder
eval_output*/
.template-params.override.env
32 changes: 0 additions & 32 deletions lightspeed-stack.template.yaml

This file was deleted.

14 changes: 13 additions & 1 deletion scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -euo pipefail
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
PROJECT_ROOT=$(dirname "$SCRIPT_DIR")

OVERRIDE_FILE=$PROJECT_ROOT/.template-params.override.env

if [[ ! -f "$PROJECT_ROOT/.env" ]]; then
echo "Missing the .env file that should contain your configuration."
echo "Would you like help creating the .env file interactively? (y/n)"
Expand All @@ -22,7 +24,17 @@ fi
source "$PROJECT_ROOT/.env"

mkdir -p "$PROJECT_ROOT/config"
cp "$PROJECT_ROOT/lightspeed-stack.template.yaml" "$PROJECT_ROOT/config/lightspeed-stack.yaml"

if [[ -f $OVERRIDE_FILE ]]; then
OVERRIDE_PARAMS="--param-file=$OVERRIDE_FILE"
fi

oc process --local \
-f $PROJECT_ROOT/template.yaml \
${OVERRIDE_PARAMS-} \
--param-file=$PROJECT_ROOT/template-params.dev.env | \
yq '.items[] | select(.kind == "ConfigMap" and .metadata.name == "lightspeed-stack-config").data."lightspeed-stack.yaml"' -r \
Comment on lines +28 to +36
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Override file loses precedence due to parameter-file order

oc process applies later --param-file arguments last, overriding earlier ones.
Placing ${OVERRIDE_PARAMS-} before template-params.dev.env means dev defaults will overwrite local overrides.

Swap the order (or add a dedicated -p per-param flag) so overrides truly win.

-  ${OVERRIDE_PARAMS-} \
-  --param-file=$PROJECT_ROOT/template-params.dev.env | \
+  --param-file=$PROJECT_ROOT/template-params.dev.env \
+  ${OVERRIDE_PARAMS-} | \
🤖 Prompt for AI Agents
In scripts/generate.sh around lines 28 to 36, the override parameter file is
specified before the default dev environment parameter file, causing the
defaults to overwrite the overrides. To fix this, reorder the `oc process`
command arguments so that `${OVERRIDE_PARAMS-}` comes after
`--param-file=$PROJECT_ROOT/template-params.dev.env`, ensuring the override
parameters take precedence as intended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that is the opposite of how it actually works.

> $PROJECT_ROOT/config/lightspeed-stack.yaml

yq -r '.objects[] | select(.metadata.name == "lightspeed-stack-config") | .data.system_prompt' "$PROJECT_ROOT/template.yaml" > "$PROJECT_ROOT/config/systemprompt.txt"

Expand Down
6 changes: 6 additions & 0 deletions template-params.dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
IMAGE_TAG=latest
SYSTEM_PROMPT_PATH=/tmp/systemprompt.txt
LLAMA_CLIENT_CONFIG_PATH=llama_stack_client_config.yaml
LIGHTSPEED_TRANSCRIPTS_DISABLED=false
LIGHTSPEED_FEEDBACK_DISABLED=false
DISABLE_QUERY_SYSTEM_PROMPT=false
29 changes: 19 additions & 10 deletions template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: assisted-chat
annotations:
description: "OpenShift template for assisted-chat service with lightspeed-stack"

parameters:
- name: IMAGE
value: "quay.io/lightspeed-core/lightspeed-stack"
Expand Down Expand Up @@ -93,13 +100,15 @@ parameters:
- name: SSO_BASE_URL
value: "https://sso.redhat.com/auth/realms/redhat-external"
description: "SSO Base URL"

apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: assisted-chat
annotations:
description: "OpenShift template for assisted-chat service with lightspeed-stack"
- name: SYSTEM_PROMPT_PATH
value: "/app-root/system_prompt"
description: "Path for a file containing the system prompt to use"
- name: LLAMA_CLIENT_CONFIG_PATH
value: "/app-root/llama_stack_client_config.yaml"
description: "Path for a file with llama stack client config"
- name: DISABLE_QUERY_SYSTEM_PROMPT
value: "true"
description: "Corresponds to the lightspeed config customization.disable_query_system_prompt"

objects:
- apiVersion: v1
Expand All @@ -123,7 +132,7 @@ objects:
access_log: ${LIGHTSPEED_SERVICE_ACCESS_LOG}
llama_stack:
use_as_library_client: true
library_client_config_path: "/app-root/llama_stack_client_config.yaml"
library_client_config_path: "${LLAMA_CLIENT_CONFIG_PATH}"
authentication:
module: jwk-token
jwk_config:
Expand All @@ -140,8 +149,8 @@ objects:
transcripts_disabled: ${LIGHTSPEED_TRANSCRIPTS_DISABLED}
transcripts_storage: "${STORAGE_MOUNT_PATH}/transcripts"
customization:
system_prompt_path: "/app-root/system_prompt"
disable_query_system_prompt: true
system_prompt_path: "${SYSTEM_PROMPT_PATH}"
disable_query_system_prompt: ${DISABLE_QUERY_SYSTEM_PROMPT}
inference:
default_model: ${LLAMA_STACK_2_0_FLASH_MODEL}
default_provider: ${LLAMA_STACK_INFERENCE_PROVIDER}
Expand Down