From cb9f1d109d2360c2c58e57e3bfd3ac64692226b0 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Fri, 11 Jul 2025 15:51:57 -0700 Subject: [PATCH] add render file check --- .gitignore | 2 +- arch/validate_arch_config.sh | 15 +- demos/use_cases/ollama/arch_config.yaml | 3 +- .../arch_config_rendered.yaml | 29 ---- .../arch_config_full_reference_rendered.yaml | 148 ++++++++---------- 5 files changed, 83 insertions(+), 114 deletions(-) delete mode 100644 demos/use_cases/preference_based_routing/arch_config_rendered.yaml diff --git a/.gitignore b/.gitignore index d2f7c6bc..20eec0bd 100644 --- a/.gitignore +++ b/.gitignore @@ -104,7 +104,7 @@ venv.bak/ # MacOS Metadata *.DS_Store - +*.yaml_rendered # ========================================= diff --git a/arch/validate_arch_config.sh b/arch/validate_arch_config.sh index a3822e90..493d1b2f 100644 --- a/arch/validate_arch_config.sh +++ b/arch/validate_arch_config.sh @@ -3,11 +3,22 @@ failed_files=() for file in $(find . -name arch_config.yaml -o -name arch_config_full_reference.yaml); do - echo "Validating $file..." - if ! docker run --rm -v "$(pwd)/$file:/app/arch_config.yaml:ro" --entrypoint /bin/sh katanemo/archgw:latest -c "python config_generator.py" 2>&1 > /dev/null ; then + echo "Validating ${file}..." + touch $(pwd)/${file}_rendered + if ! docker run --rm -v "$(pwd)/${file}:/app/arch_config.yaml:ro" -v "$(pwd)/${file}_rendered:/app/arch_config_rendered.yaml:rw" --entrypoint /bin/sh katanemo/archgw:latest -c "python config_generator.py" 2>&1 > /dev/null ; then echo "Validation failed for $file" failed_files+=("$file") fi + RENDERED_CHECKED_IN_FILE=$(echo $file | sed 's/\.yaml$/_rendered.yaml/') + if [ -f "$RENDERED_CHECKED_IN_FILE" ]; then + echo "Checking rendered file against checked-in version..." + if ! diff -q "${file}_rendered" "$RENDERED_CHECKED_IN_FILE" > /dev/null; then + echo "Rendered file ${file}_rendered does not match checked-in version ${RENDERED_CHECKED_IN_FILE}" + failed_files+=("${file}_rendered") + else + echo "Rendered file matches checked-in version." + fi + fi done # Print summary of failed files diff --git a/demos/use_cases/ollama/arch_config.yaml b/demos/use_cases/ollama/arch_config.yaml index db824ad7..5f88b0a3 100644 --- a/demos/use_cases/ollama/arch_config.yaml +++ b/demos/use_cases/ollama/arch_config.yaml @@ -9,7 +9,8 @@ listeners: llm_providers: - - model: openai/llama3.2 + - model: my_llm_provider/llama3.2 + provider_interface: openai base_url: http://host.docker.internal:11434 default: true diff --git a/demos/use_cases/preference_based_routing/arch_config_rendered.yaml b/demos/use_cases/preference_based_routing/arch_config_rendered.yaml deleted file mode 100644 index 7e914893..00000000 --- a/demos/use_cases/preference_based_routing/arch_config_rendered.yaml +++ /dev/null @@ -1,29 +0,0 @@ -listeners: - egress_traffic: - address: 0.0.0.0 - message_format: openai - port: 12000 - timeout: 30s -llm_providers: -- access_key: $OPENAI_API_KEY - default: true - model: gpt-4o-mini - name: openai/gpt-4o-mini - provider_interface: openai -- access_key: $OPENAI_API_KEY - model: gpt-4o - name: openai/gpt-4o - provider_interface: openai - routing_preferences: - - description: generating new code snippets, functions, or boilerplate based on user prompts or requirements - name: code generation -- access_key: $OPENAI_API_KEY - model: gpt-4.1 - name: openai/gpt-4.1 - provider_interface: openai - routing_preferences: - - description: understand and explain existing code snippets, functions, or libraries - name: code understanding -tracing: - random_sampling: 100 -version: v0.1.0 diff --git a/docs/source/resources/includes/arch_config_full_reference_rendered.yaml b/docs/source/resources/includes/arch_config_full_reference_rendered.yaml index c567de7f..503f6a80 100644 --- a/docs/source/resources/includes/arch_config_full_reference_rendered.yaml +++ b/docs/source/resources/includes/arch_config_full_reference_rendered.yaml @@ -1,95 +1,81 @@ -version: v0.1 - -listeners: - ingress_traffic: - address: 0.0.0.0 - port: 10000 - message_format: openai - timeout: 5s - egress_traffic: - address: 0.0.0.0 - port: 12000 - message_format: openai - timeout: 5s - -# Arch creates a round-robin load balancing between different endpoints, managed via the cluster subsystem. endpoints: app_server: - # value could be ip address or a hostname with port - # this could also be a list of endpoints for load balancing - # for example endpoint: [ ip1:port, ip2:port ] - endpoint: 127.0.0.1:80 - # max time to wait for a connection to be established connect_timeout: 0.005s - - mistral_local: - endpoint: 127.0.0.1:8001 - + endpoint: 127.0.0.1 + port: 80 error_target: endpoint: error_target_1 - -# Centralized way to manage LLMs, manage keys, retry logic, failover and limits in a central way + port: 80 + mistral_local: + endpoint: 127.0.0.1 + port: 8001 +listeners: + egress_traffic: + address: 0.0.0.0 + message_format: openai + port: 12000 + timeout: 5s + ingress_traffic: + address: 0.0.0.0 + message_format: openai + port: 10000 + timeout: 5s llm_providers: - - name: openai/gpt-4o - provider_interface: openai - access_key: $OPENAI_API_KEY - model: gpt-4o - default: true - - - name: mistral/mistral-8x7b - provider_interface: mistral - access_key: $MISTRAL_API_KEY - model: mistral-8x7b - - - name: mistral/mistral-7b-instruct - provider_interface: mistral - model: mistral-7b-instruct - base_url: http://mistral_local - -# provides a way to override default settings for the arch system +- access_key: $OPENAI_API_KEY + default: true + model: gpt-4o + name: openai/gpt-4o + provider_interface: openai +- access_key: $MISTRAL_API_KEY + model: mistral-8x7b + name: mistral/mistral-8x7b + provider_interface: mistral +- base_url: http://mistral_local + endpoint: mistral_local + model: mistral-7b-instruct + name: mistral/mistral-7b-instruct + port: 80 + protocol: http + provider_interface: mistral overrides: - # By default Arch uses an NLI + embedding approach to match an incoming prompt to a prompt target. - # The intent matching threshold is kept at 0.80, you can override this behavior if you would like - prompt_target_intent_matching_threshold: 0.60 - -# default system prompt used by all prompt targets -system_prompt: You are a network assistant that just offers facts; not advice on manufacturers or purchasing decisions. - + prompt_target_intent_matching_threshold: 0.6 prompt_guards: input_guards: jailbreak: on_exception: - message: Looks like you're curious about my abilities, but I can only provide assistance within my programmed parameters. - + message: Looks like you're curious about my abilities, but I can only provide + assistance within my programmed parameters. prompt_targets: - - name: information_extraction - default: true - description: handel all scenarios that are question and answer in nature. Like summarization, information extraction, etc. - endpoint: - name: app_server - path: /agent/summary - http_method: POST - # Arch uses the default LLM and treats the response from the endpoint as the prompt to send to the LLM - auto_llm_dispatch_on_response: true - # override system prompt for this prompt target - system_prompt: You are a helpful information extraction assistant. Use the information that is provided to you. - - - name: reboot_network_device - description: Reboot a specific network device - endpoint: - name: app_server - path: /agent/action - parameters: - - name: device_id - type: str - description: Identifier of the network device to reboot. - required: true - - name: confirmation - type: bool - description: Confirmation flag to proceed with reboot. - default: false - enum: [true, false] - +- auto_llm_dispatch_on_response: true + default: true + description: handel all scenarios that are question and answer in nature. Like summarization, + information extraction, etc. + endpoint: + http_method: POST + name: app_server + path: /agent/summary + name: information_extraction + system_prompt: You are a helpful information extraction assistant. Use the information + that is provided to you. +- description: Reboot a specific network device + endpoint: + name: app_server + path: /agent/action + name: reboot_network_device + parameters: + - description: Identifier of the network device to reboot. + name: device_id + required: true + type: str + - default: false + description: Confirmation flag to proceed with reboot. + enum: + - true + - false + name: confirmation + type: bool +system_prompt: You are a network assistant that just offers facts; not advice on manufacturers + or purchasing decisions. tracing: - # sampling rate. Note by default Arch works on OpenTelemetry compatible tracing. sampling_rate: 0.1 +version: v0.1