From 1142ab875aa15653470c0ab9462a048cbeb01a86 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Wed, 16 Apr 2025 15:01:01 -0700 Subject: [PATCH] fix default target --- demos/acm_k8s/acm_service_put_policy/main.py | 22 +++++++++++++++++++ demos/acm_k8s/arch_config_openshift.yaml | 23 +++++++++----------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/demos/acm_k8s/acm_service_put_policy/main.py b/demos/acm_k8s/acm_service_put_policy/main.py index 3e3d636a..c709c946 100644 --- a/demos/acm_k8s/acm_service_put_policy/main.py +++ b/demos/acm_k8s/acm_service_put_policy/main.py @@ -105,3 +105,25 @@ async def create_policy(req: PolicyPut, res: Response): logger.info(f"Response: {resp_text}") return {"status: ": resp_text} + + +class DefaultTargetRequest(BaseModel): + messages: list = [] + + +@app.post("/default_target") +async def default_target(req: DefaultTargetRequest, res: Response): + logger.info(f"Received messages: {req.messages}") + resp = { + "choices": [ + { + "message": { + "role": "assistant", + "content": "I can help you with k8s policy creation, getting policy details, cluster details and node details. When creating a policy please provide the policy name, namespace, and remediation action.", + }, + } + ], + "model": "api_server", + } + logger.info(f"sending response: {json.dumps(resp)}") + return resp diff --git a/demos/acm_k8s/arch_config_openshift.yaml b/demos/acm_k8s/arch_config_openshift.yaml index d151a95e..0a054b9f 100644 --- a/demos/acm_k8s/arch_config_openshift.yaml +++ b/demos/acm_k8s/arch_config_openshift.yaml @@ -1,8 +1,9 @@ version: "0.1-beta" listeners: - prompt_gateway: + ingress_traffic: address: 0.0.0.0 + port: 10000 message_format: openai timeout: 30s @@ -111,19 +112,15 @@ prompt_targets: - name: default_target default: true description: This is the default target for all unmatched prompts. + endpoint: + name: local_proxy_service + path: /default_target + http_method: POST system_prompt: | - You are a helpful assistant that can help answer ACM queries. Following is a list of available commands user can ask. Based on question asked, tell me which command you want to execute. - - - name: listAllClusterDetails - description: Query your clusters for more details. - endpoint: - http_method: GET - name: acm_service - path: /apis/cluster.open-cluster-management.io/v1/managedclusters - system_prompt: | - You are a helpful assistant. You are given response in json. Only show name of the cluster and its status. - - auto_llm_dispatch_on_response: true + You are a helpful assistant! Summarize the user's request and provide a helpful response. + # if it is set to false arch will send response that it received from this prompt target to the user + # if true arch will forward the response to the default LLM + auto_llm_dispatch_on_response: false tracing: random_sampling: 100