diff --git a/.gitignore b/.gitignore index 3eed432..acf8a13 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ ocm_token.txt # Evaluation output folder eval_output*/ +.template-params.override.env diff --git a/lightspeed-stack.template.yaml b/lightspeed-stack.template.yaml deleted file mode 100644 index da7c35c..0000000 --- a/lightspeed-stack.template.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: assisted-chat -service: - host: 0.0.0.0 - port: 8090 - auth_enabled: false - workers: 1 - color_log: true - access_log: true -llama_stack: - use_as_library_client: true - library_client_config_path: "llama_stack_client_config.yaml" -mcp_servers: - - name: mcp::assisted - url: "http://assisted-service-mcp:8000/mcp" -user_data_collection: - feedback_disabled: false - feedback_storage: "/tmp/data/feedback" - transcripts_disabled: false - transcripts_storage: "/tmp/data/transcripts" -authentication: - module: jwk-token - jwk_config: - url: https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/certs - jwt_configuration: - user_id_claim: sub - username_claim: preferred_username -customization: - system_prompt_path: "/tmp/systemprompt.txt" - disable_query_system_prompt: false -inference: - default_model: gemini/gemini-2.0-flash - default_provider: gemini diff --git a/scripts/generate.sh b/scripts/generate.sh index 433a7ea..7191939 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -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)" @@ -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 \ + > $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" diff --git a/template-params.dev.env b/template-params.dev.env new file mode 100644 index 0000000..9c6ae9c --- /dev/null +++ b/template-params.dev.env @@ -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 diff --git a/template.yaml b/template.yaml index 360659b..b89deac 100644 --- a/template.yaml +++ b/template.yaml @@ -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" @@ -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 @@ -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: @@ -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}