diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index ebf1d6da..ae1cbfe8 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -1,40 +1,97 @@ name: Publish Docker image +env: + DOCKER_IMAGE: katanemo/archgw + on: - release: - types: [published] + push: + branches: + - main jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - attestations: write - id-token: write + # Build ARM64 image on native ARM64 runner + build-arm64: + runs-on: [linux-arm64] steps: - - name: Check out the repo + - name: Checkout Repository uses: actions/checkout@v4 - name: Log in to Docker Hub - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + uses: docker/metadata-action@v5 with: - images: katanemo/archgw + images: ${{ env.DOCKER_IMAGE }} + tags: | + type=raw,value=latest # Force the tag to be "latest" - - name: Build and push Docker image - id: push - uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + - name: Build and Push ARM64 Image + uses: docker/build-push-action@v5 with: context: . file: ./arch/Dockerfile + platforms: linux/arm64 push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }}-arm64 + + # Build AMD64 image on GitHub's AMD64 runner + build-amd64: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.DOCKER_IMAGE }} + tags: | + type=raw,value=latest # Force the tag to be "latest" + + - name: Build and Push AMD64 Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./arch/Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }}-amd64 + + + # Combine ARM64 and AMD64 images into a multi-arch manifest + create-manifest: + runs-on: ubuntu-latest + needs: [build-arm64, build-amd64] # Wait for both builds + steps: + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.DOCKER_IMAGE }} + tags: | + type=raw,value=latest # Force the tag to be "latest" + + - name: Create Multi-Arch Manifest + run: | + # Combine the architecture-specific images into a "latest" manifest + docker buildx imagetools create -t ${{ steps.meta.outputs.tags }} \ + ${{ env.DOCKER_IMAGE }}:latest-arm64 \ + ${{ env.DOCKER_IMAGE }}:latest-amd64 diff --git a/.github/workflows/e2e_archgw.yml b/.github/workflows/e2e_archgw.yml index 46643de1..84ccff68 100644 --- a/.github/workflows/e2e_archgw.yml +++ b/.github/workflows/e2e_archgw.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test: + e2e_archgw_tests: runs-on: ubuntu-latest-m defaults: run: diff --git a/.github/workflows/e2e_model_server.yml b/.github/workflows/e2e_model_server.yml index 6d749942..3985fc5a 100644 --- a/.github/workflows/e2e_model_server.yml +++ b/.github/workflows/e2e_model_server.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test: + e2e_model_server_tests: runs-on: ubuntu-latest-m defaults: run: diff --git a/.github/workflows/e2e_test_demos.yml b/.github/workflows/e2e_test_demos.yml index dc4255c2..0dfe3dd7 100644 --- a/.github/workflows/e2e_test_demos.yml +++ b/.github/workflows/e2e_test_demos.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test: + e2e_demo_tests: runs-on: ubuntu-latest-m steps: @@ -37,7 +37,7 @@ jobs: source venv/bin/activate cd model_server/ && echo "installing model server" && poetry install cd ../arch/tools && echo "installing archgw cli" && poetry install - cd ../../demos/test_runner && echo "installing test dependencies" && poetry install + cd ../../demos/shared/test_runner && echo "installing test dependencies" && poetry install - name: run demo tests env: @@ -45,4 +45,4 @@ jobs: MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} run: | source venv/bin/activate - cd demos/test_runner && sh run_demo_tests.sh + cd demos/shared/test_runner && sh run_demo_tests.sh diff --git a/.github/workflows/e2e_tests.yml b/.github/workflows/e2e_tests.yml index 370988fe..f894b713 100644 --- a/.github/workflows/e2e_tests.yml +++ b/.github/workflows/e2e_tests.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test: + e2e_tests: runs-on: ubuntu-latest steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e577bbf..5aa68ad3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,9 +25,7 @@ repos: name: cargo-test language: system types: [file, rust] - # --lib is to only test the library, since when integration tests are made, - # they will be in a seperate tests directory - entry: bash -c "cd crates/llm_gateway && cargo test --lib" + entry: bash -c "cd crates && cargo test --lib" - repo: https://github.com/psf/black rev: 23.1.0 diff --git a/README.md b/README.md index 921d309f..e3a6a8ba 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,43 @@ -Focus on what matters most. Arch is an **intelligent proxy server designed for prompts** - to help you protect, observe, and build agentic apps by simply connecting (existing) APIs. +
+ Arch Logo +
+
-Built by the contributors of [Envoy Proxy](https://www.envoyproxy.io/) with the belief that: - ->Prompts are nuanced and opaque user requests, which require the same capabilities as traditional HTTP requests including secure handling, intelligent routing, robust observability, and integration with backend (API) systems for personalization – outside core business logic.* - -![alt text](docs/source/_static/img/arch-logo.png) -Arch - Build fast, hyper-personalized agents with intelligent infra | Product Hunt +_Arch is an intelligent (edge and LLM) proxy designed for agentic applications - to help you protect, observe, and build agentic tasks by simply connecting (existing) APIs._ +[Quickstart](#Quickstart) • +[Demos](#Demos) • +[Build agentic apps with Arch](#Build-AI-Agent-with-Arch-Gateway) • +[Use Arch as an LLM router](#Use-Arch-Gateway-as-LLM-Router) • +[Documentation](https://docs.archgw.com) • +[Contact](#Contact) [![pre-commit](https://github.com/katanemo/arch/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/katanemo/arch/actions/workflows/pre-commit.yml) [![rust tests (prompt and llm gateway)](https://github.com/katanemo/arch/actions/workflows/rust_tests.yml/badge.svg)](https://github.com/katanemo/arch/actions/workflows/rust_tests.yml) [![e2e tests](https://github.com/katanemo/arch/actions/workflows/e2e_tests.yml/badge.svg)](https://github.com/katanemo/arch/actions/workflows/e2e_tests.yml) [![Build and Deploy Documentation](https://github.com/katanemo/arch/actions/workflows/static.yml/badge.svg)](https://github.com/katanemo/arch/actions/workflows/static.yml) +
+ +# Overview +Arch - Build fast, hyper-personalized agents with intelligent infra | Product Hunt -Arch is engineered with purpose-built LLMs to handle critical but undifferentiated tasks related to the handling and processing of prompts. This includes detecting and rejecting [jailbreak](https://github.com/verazuo/jailbreak_llms) attempts, intelligent task routing for improved accuracy, mapping user request into "backend" functions, and managing the observability of prompts and LLM API calls in a centralized way. +Arch Gateway was built by the contributors of [Envoy Proxy](https://www.envoyproxy.io/) with the belief that: +>Prompts are nuanced and opaque user requests, which require the same capabilities as traditional HTTP requests including secure handling, intelligent routing, robust observability, and integration with backend (API) systems for personalization – outside core business logic.* + + +Arch is engineered with purpose-built LLMs to handle critical but pesky tasks related to the handling and processing of prompts. This includes detecting and rejecting [jailbreak](https://github.com/verazuo/jailbreak_llms) attempts, intent-based routing for improved task accuracy, mapping user request into "backend" functions, and managing the observability of prompts and LLM API calls in a centralized way. **Core Features**: - - Built on [Envoy](https://envoyproxy.io): Arch runs alongside application servers as a separate containerized process, and builds on top of Envoy's proven HTTP management and scalability features to handle ingress and egress traffic related to prompts and LLMs. - - Task Routing & Fast Function Calling. Engineered with purpose-built [LLMs](https://huggingface.co/collections/katanemo/arch-function-66f209a693ea8df14317ad68) to handle fast, cost-effective, and accurate prompt-based tasks like function/API calling, and parameter extraction from prompts to build more task-accurate agentic applications. - - Prompt [Guard](https://huggingface.co/collections/katanemo/arch-guard-6702bdc08b889e4bce8f446d): Arch centralizes guardrails to prevent jailbreak attempts and ensure safe user interactions without writing a single line of code. - - Routing & Traffic Management: Arch centralizes calls to LLMs used by your applications, offering smart retries, automatic cutover, and resilient upstream connections for continuous availability. - - Observability: Arch uses the W3C Trace Context standard to enable complete request tracing across applications, ensuring compatibility with observability tools, and provides metrics to monitor latency, token usage, and error rates, helping optimize AI application performance. -**High-Level Network Flow**: + - **Intent-based prompt routing & fast ⚡ function-calling via APIs**. Engineered with purpose-built [LLMs](https://huggingface.co/collections/katanemo/arch-function-66f209a693ea8df14317ad68) to handle fast, cost-effective, and accurate prompt-based tasks like function/API calling, and parameter extraction from prompts to build more task-accurate agentic applications. + - **Prompt [Guard](https://huggingface.co/collections/katanemo/arch-guard-6702bdc08b889e4bce8f446d)**: Arch centralizes guardrails to prevent jailbreak attempts and ensure safe user interactions without writing a single line of code. + - **LLM Routing & Traffic Management**: Arch centralizes calls to LLMs used by your applications, offering smart retries, automatic cutover, and resilient upstream connections for continuous availability. + - **Observability**: Arch uses the W3C Trace Context standard to enable complete request tracing across applications, ensuring compatibility with observability tools, and provides metrics to monitor latency, token usage, and error rates, helping optimize AI application performance. + - **Built on [Envoy](https://envoyproxy.io)**: Arch runs alongside application servers as a separate containerized process, and builds on top of Envoy's proven HTTP management and scalability features to handle ingress and egress traffic related to prompts and LLMs. + +**High-Level Sequence Diagram**: ![alt text](docs/source/_static/img/arch_network_diagram_high_level.png) **Jump to our [docs](https://docs.archgw.com)** to learn how you can use Arch to improve the speed, security and personalization of your GenAI apps. @@ -36,9 +49,9 @@ Arch is engineered with purpose-built LLMs to handle critical but undifferentiat To get in touch with us, please join our [discord server](https://discord.gg/pGZf2gcwEc). We will be monitoring that actively and offering support there. ## Demos -* [Weather Forecast](demos/weather_forecast/README.md) - Walk through of the core function calling capabilities of arch gateway using weather forecasting service -* [Insurance Agent](demos/insurance_agent/README.md) - Build a full insurance agent with Arch -* [Network Agent](demos/network_agent/README.md) - Build a networking co-pilot/agent agent with Arch +* [Sample App: Weather Forecast Agent](demos/samples_python/weather_forecast/README.md) - A sample agentic weather forecasting app that highlights core function calling capabilities of Arch. +* [Sample App: Network Operator Agent](demos/samples_python/network_switch_operator_agent/README.md) - A simple network device switch operator agent that can retrive device statistics and reboot them. +* [User Case: Connecting to SaaS APIs](demos/use_cases/spotify_bearer_auth) - Connect 3rd party SaaS APIs to your agentic chat experience. ## Quickstart @@ -60,7 +73,7 @@ Arch's CLI allows you to manage and interact with the Arch gateway efficiently. ```console $ python -m venv venv $ source venv/bin/activate # On Windows, use: venv\Scripts\activate -$ pip install archgw==0.2.0 +$ pip install archgw==0.2.1 ``` ### Build AI Agent with Arch Gateway diff --git a/arch/arch_config_schema.yaml b/arch/arch_config_schema.yaml index 3f73e886..1b32b730 100644 --- a/arch/arch_config_schema.yaml +++ b/arch/arch_config_schema.yaml @@ -68,6 +68,8 @@ properties: enum: - http - https + http_host: + type: string additionalProperties: false required: - name @@ -77,6 +79,8 @@ properties: properties: prompt_target_intent_matching_threshold: type: number + optimize_context_window: + type: boolean system_prompt: type: string prompt_targets: @@ -133,6 +137,10 @@ properties: enum: - GET - POST + http_headers: + type: object + additionalProperties: + type: string additionalProperties: false required: - name diff --git a/arch/docker-compose.dev.yaml b/arch/docker-compose.dev.yaml index 04edd8db..0b52d057 100644 --- a/arch/docker-compose.dev.yaml +++ b/arch/docker-compose.dev.yaml @@ -8,7 +8,7 @@ services: - "12000:12000" - "19901:9901" volumes: - - ${ARCH_CONFIG_FILE:-../demos/weather_forecast/arch_config.yaml}:/app/arch_config.yaml + - ${ARCH_CONFIG_FILE:-../demos/samples_python/weather_forecast/arch_config.yaml}:/app/arch_config.yaml - /etc/ssl/cert.pem:/etc/ssl/cert.pem - ./envoy.template.yaml:/app/envoy.template.yaml - ./arch_config_schema.yaml:/app/arch_config_schema.yaml diff --git a/arch/envoy.template.yaml b/arch/envoy.template.yaml index 4017d889..0040b57b 100644 --- a/arch/envoy.template.yaml +++ b/arch/envoy.template.yaml @@ -570,7 +570,11 @@ static_resources: socket_address: address: {{ local_llm_provider.endpoint }} port_value: {{ local_llm_provider.port }} + {% if local_llm_provider.http_host %} + hostname: {{ local_llm_provider.http_host }} + {% else %} hostname: {{ local_llm_provider.endpoint }} + {% endif %} {% if local_llm_provider.protocol == "https" %} transport_socket: name: envoy.transport_sockets.tls diff --git a/arch/tools/README.md b/arch/tools/README.md index 9a2c6e14..a4722c4a 100644 --- a/arch/tools/README.md +++ b/arch/tools/README.md @@ -19,7 +19,7 @@ source venv/bin/activate ### Step 3: Run the build script ```bash -pip install archgw==0.2.0 +pip install archgw==0.2.1 ``` ## Uninstall Instructions: archgw CLI diff --git a/arch/tools/cli/config_generator.py b/arch/tools/cli/config_generator.py index e535894b..447585fb 100644 --- a/arch/tools/cli/config_generator.py +++ b/arch/tools/cli/config_generator.py @@ -16,6 +16,20 @@ ARCH_CONFIG_SCHEMA_FILE = os.getenv( ) +def get_endpoint_and_port(endpoint, protocol): + endpoint_tokens = endpoint.split(":") + if len(endpoint_tokens) > 1: + endpoint = endpoint_tokens[0] + port = int(endpoint_tokens[1]) + return endpoint, port + else: + if protocol == "http": + port = 80 + else: + port = 443 + return endpoint, port + + def validate_and_render_schema(): env = Environment(loader=FileSystemLoader("./")) template = env.get_template("envoy.template.yaml") @@ -42,9 +56,11 @@ def validate_and_render_schema(): for name, endpoint_details in endpoints.items(): inferred_clusters[name] = endpoint_details endpoint = inferred_clusters[name]["endpoint"] - if len(endpoint.split(":")) > 1: - inferred_clusters[name]["endpoint"] = endpoint.split(":")[0] - inferred_clusters[name]["port"] = int(endpoint.split(":")[1]) + protocol = inferred_clusters[name].get("protocol", "http") + ( + inferred_clusters[name]["endpoint"], + inferred_clusters[name]["port"], + ) = get_endpoint_and_port(endpoint, protocol) print("defined clusters from arch_config.yaml: ", json.dumps(inferred_clusters)) @@ -77,9 +93,10 @@ def validate_and_render_schema(): if llm_provider.get("endpoint", None): endpoint = llm_provider["endpoint"] - if len(endpoint.split(":")) > 1: - llm_provider["endpoint"] = endpoint.split(":")[0] - llm_provider["port"] = int(endpoint.split(":")[1]) + protocol = llm_provider.get("protocol", "http") + llm_provider["endpoint"], llm_provider["port"] = get_endpoint_and_port( + endpoint, protocol + ) llms_with_endpoint.append(llm_provider) config_yaml["llm_providers"] = updated_llm_providers diff --git a/arch/tools/cli/utils.py b/arch/tools/cli/utils.py index 8e8b234d..cc6ac20b 100644 --- a/arch/tools/cli/utils.py +++ b/arch/tools/cli/utils.py @@ -89,6 +89,18 @@ def get_llm_provider_access_keys(arch_config_file): if acess_key is not None: access_key_list.append(acess_key) + for prompt_target in arch_config_yaml.get("prompt_targets", []): + for k, v in prompt_target.get("endpoint", {}).get("http_headers", {}).items(): + if k.lower() == "authorization": + print( + f"found auth header: {k} for prompt_target: {prompt_target.get('name')}/{prompt_target.get('endpoint').get('name')}" + ) + auth_tokens = v.split(" ") + if len(auth_tokens) > 1: + access_key_list.append(auth_tokens[1]) + else: + access_key_list.append(v) + return access_key_list diff --git a/arch/tools/poetry.lock b/arch/tools/poetry.lock index 21f2772c..d5a45050 100644 --- a/arch/tools/poetry.lock +++ b/arch/tools/poetry.lock @@ -2,7 +2,7 @@ [[package]] name = "archgw_modelserver" -version = "0.2.0" +version = "0.2.1" description = "A model server for serving models" optional = false python-versions = "*" @@ -15,13 +15,13 @@ url = "../../model_server" [[package]] name = "attrs" -version = "24.3.0" +version = "25.1.0" description = "Classes Without Boilerplate" optional = false python-versions = ">=3.8" files = [ - {file = "attrs-24.3.0-py3-none-any.whl", hash = "sha256:ac96cd038792094f438ad1f6ff80837353805ac950cd2aa0e0625ef19850c308"}, - {file = "attrs-24.3.0.tar.gz", hash = "sha256:8f5c07333d543103541ba7be0e2ce16eeee8130cb0b3f9238ab904ce1e85baff"}, + {file = "attrs-25.1.0-py3-none-any.whl", hash = "sha256:c75a69e28a550a7e93789579c22aa26b0f5b83b75dc4e08fe092980051e1090a"}, + {file = "attrs-25.1.0.tar.gz", hash = "sha256:1c97078a80c814273a76b2a298a932eb681c87415c11dee0a6921de7f1b02c3e"}, ] [package.extras] @@ -34,13 +34,13 @@ tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] [[package]] name = "certifi" -version = "2024.12.14" +version = "2025.1.31" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"}, - {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, + {file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"}, + {file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"}, ] [[package]] @@ -370,13 +370,13 @@ files = [ [[package]] name = "referencing" -version = "0.36.1" +version = "0.36.2" description = "JSON Referencing + Python" optional = false python-versions = ">=3.9" files = [ - {file = "referencing-0.36.1-py3-none-any.whl", hash = "sha256:363d9c65f080d0d70bc41c721dce3c7f3e77fc09f269cd5c8813da18069a6794"}, - {file = "referencing-0.36.1.tar.gz", hash = "sha256:ca2e6492769e3602957e9b831b94211599d2aade9477f5d44110d2530cf9aade"}, + {file = "referencing-0.36.2-py3-none-any.whl", hash = "sha256:e8699adbbf8b5c7de96d8ffa0eb5c158b3beafce084968e2ea8bb08c6794dcd0"}, + {file = "referencing-0.36.2.tar.gz", hash = "sha256:df2e89862cd09deabbdba16944cc3f10feb6b3e6f18e902f7cc25609a34775aa"}, ] [package.dependencies] @@ -568,4 +568,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "59543baf4d462d4830e7228ba9eda8ae865416fdabd8ede129492ac45f1926f2" +content-hash = "6b29791896ec1680e2c841ac42e835c1bada672b056d8208ab24388f70f9badb" diff --git a/arch/tools/pyproject.toml b/arch/tools/pyproject.toml index 28b3b3ab..7ed79a36 100644 --- a/arch/tools/pyproject.toml +++ b/arch/tools/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "archgw" -version = "0.2.0" +version = "0.2.1" description = "Python-based CLI tool to manage Arch Gateway." authors = ["Katanemo Labs, Inc."] packages = [ @@ -10,7 +10,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" -archgw_modelserver = "^0.2.0" +archgw_modelserver = "^0.2.1" click = "^8.1.7" jinja2 = "^3.1.4" jsonschema = "^4.23.0" diff --git a/crates/Cargo.lock b/crates/Cargo.lock index 98157733..b585ef6e 100644 --- a/crates/Cargo.lock +++ b/crates/Cargo.lock @@ -234,6 +234,8 @@ dependencies = [ "serde_yaml", "thiserror", "tiktoken-rs", + "url", + "urlencoding", ] [[package]] @@ -477,6 +479,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "duration-string" version = "0.3.0" @@ -557,6 +570,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures" version = "0.3.31" @@ -782,12 +804,151 @@ dependencies = [ "itoa", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "id-arena" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.6.0" @@ -883,6 +1044,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "llm_gateway" version = "0.1.0" @@ -1028,6 +1195,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1547,6 +1720,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "target-lexicon" version = "0.12.16" @@ -1606,6 +1790,16 @@ dependencies = [ "rustc-hash", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "toml" version = "0.8.19" @@ -1676,6 +1870,35 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" version = "1.11.0" @@ -2189,12 +2412,48 @@ dependencies = [ "wasmparser 0.212.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "yansi" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -2216,6 +2475,49 @@ dependencies = [ "syn 2.0.79", ] +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "zstd" version = "0.13.2" diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index 84aa636c..d8c35140 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -16,6 +16,8 @@ tiktoken-rs = "0.5.9" rand = "0.8.5" serde_json = "1.0" hex = "0.4.3" +urlencoding = "2.1.3" +url = "2.5.4" [dev-dependencies] pretty_assertions = "1.4.1" diff --git a/crates/common/src/configuration.rs b/crates/common/src/configuration.rs index fbafe7b9..069695ba 100644 --- a/crates/common/src/configuration.rs +++ b/crates/common/src/configuration.rs @@ -25,6 +25,7 @@ pub struct Configuration { #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct Overrides { pub prompt_target_intent_matching_threshold: Option, + pub optimize_context_window: Option, } #[derive(Debug, Clone, Serialize, Deserialize, Default)] @@ -242,6 +243,7 @@ pub struct EndpointDetails { pub path: Option, #[serde(rename = "http_method")] pub method: Option, + pub http_headers: Option>, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/crates/common/src/path.rs b/crates/common/src/path.rs index 3bf2aed5..f11cb7b9 100644 --- a/crates/common/src/path.rs +++ b/crates/common/src/path.rs @@ -1,21 +1,30 @@ -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; +use url::Url; +use urlencoding; + +use crate::configuration::Parameter; pub fn replace_params_in_path( path: &str, - params: &HashMap, -) -> Result { - let mut result = String::new(); - let mut in_param = false; + tool_params: &HashMap, + prompt_target_params: &[Parameter], +) -> Result<(String, String, HashMap), String> { + let mut query_string_replaced = String::new(); let mut current_param = String::new(); + let mut vars_replaced = HashSet::new(); + let mut params: HashMap = HashMap::new(); + let mut in_param = false; for c in path.chars() { if c == '{' { in_param = true; } else if c == '}' { in_param = false; let param_name = current_param.clone(); - if let Some(value) = params.get(¶m_name) { - result.push_str(value); + if let Some(value) = tool_params.get(¶m_name) { + let value = urlencoding::encode(value); + query_string_replaced.push_str(value.into_owned().as_str()); + vars_replaced.insert(param_name.clone()); } else { return Err(format!("Missing value for parameter `{}`", param_name)); } @@ -23,31 +32,106 @@ pub fn replace_params_in_path( } else if in_param { current_param.push(c); } else { - result.push(c); + query_string_replaced.push(c); } } - Ok(result) + // add the remaining params in path + for (param_name, value) in tool_params.iter() { + let value = urlencoding::encode(value).into_owned(); + if !vars_replaced.contains(param_name) { + vars_replaced.insert(param_name.clone()); + params.insert(param_name.clone(), value.clone()); + if query_string_replaced.contains("?") { + query_string_replaced.push_str(&format!("&{}={}", param_name, value)); + } else { + query_string_replaced.push_str(&format!("?{}={}", param_name, value)); + } + } + } + + // add default values + for param in prompt_target_params.iter() { + if !vars_replaced.contains(¶m.name) && param.default.is_some() { + params.insert(param.name.clone(), param.default.clone().unwrap()); + if query_string_replaced.contains("?") { + query_string_replaced.push_str(&format!( + "&{}={}", + param.name, + param.default.as_ref().unwrap() + )); + } else { + query_string_replaced.push_str(&format!( + "?{}={}", + param.name, + param.default.as_ref().unwrap() + )); + } + } + } + + let parsed_uri = Url::parse("http://dummy.com").unwrap(); + let parsed_uri = parsed_uri + .join(&query_string_replaced) + .map_err(|e| e.to_string())?; + let query_string = parsed_uri.query().unwrap_or(""); + let path_uri = parsed_uri.path(); + + Ok((path_uri.to_string(), query_string.to_string(), params)) } #[cfg(test)] mod test { + use std::collections::HashMap; + + use crate::configuration::Parameter; + #[test] fn test_replace_path() { let path = "/cluster.open-cluster-management.io/v1/managedclusters/{cluster_name}"; - let params = vec![("cluster_name".to_string(), "test1".to_string())] - .into_iter() - .collect(); + let params = vec![ + ("cluster_name".to_string(), "test1".to_string()), + ("hello".to_string(), "hello world".to_string()), + ] + .into_iter() + .collect(); + let prompt_target_params = vec![Parameter { + name: "country".to_string(), + parameter_type: None, + description: "test target".to_string(), + required: None, + enum_values: None, + default: Some("US".to_string()), + in_path: None, + format: None, + }]; + + let out_params: HashMap = vec![ + ("country".to_string(), "US".to_string()), + ("hello".to_string(), "hello%20world".to_string()), + ] + .into_iter() + .collect(); assert_eq!( - super::replace_params_in_path(path, ¶ms), - Ok("/cluster.open-cluster-management.io/v1/managedclusters/test1".to_string()) + super::replace_params_in_path(path, ¶ms, &prompt_target_params), + Ok(( + "/cluster.open-cluster-management.io/v1/managedclusters/test1".to_string(), + "hello=hello%20world&country=US".to_string(), + out_params.clone() + )) ); + let out_params = HashMap::new(); + let prompt_target_params = vec![]; let path = "/cluster.open-cluster-management.io/v1/managedclusters"; let params = vec![].into_iter().collect(); assert_eq!( - super::replace_params_in_path(path, ¶ms), - Ok("/cluster.open-cluster-management.io/v1/managedclusters".to_string()) + super::replace_params_in_path(path, ¶ms, &prompt_target_params), + Ok(( + "/cluster.open-cluster-management.io/v1/managedclusters".to_string(), + "".to_string(), + out_params + )) ); let path = "/foo/{bar}/baz"; @@ -55,8 +139,8 @@ mod test { .into_iter() .collect(); assert_eq!( - super::replace_params_in_path(path, ¶ms), - Ok("/foo/qux/baz".to_string()) + super::replace_params_in_path(path, ¶ms, &prompt_target_params), + Ok(("/foo/qux/baz".to_string(), "".to_string(), HashMap::new())) ); let path = "/foo/{bar}/baz/{qux}"; @@ -67,8 +151,45 @@ mod test { .into_iter() .collect(); assert_eq!( - super::replace_params_in_path(path, ¶ms), - Ok("/foo/qux/baz/quux".to_string()) + super::replace_params_in_path(path, ¶ms, &prompt_target_params), + Ok(( + "/foo/qux/baz/quux".to_string(), + "".to_string(), + HashMap::new() + )) + ); + + let path = "/foo/{bar}/baz/{qux}?hello=world"; + let params = vec![ + ("bar".to_string(), "qux".to_string()), + ("qux".to_string(), "quux".to_string()), + ] + .into_iter() + .collect(); + assert_eq!( + super::replace_params_in_path(path, ¶ms, &prompt_target_params), + Ok(( + "/foo/qux/baz/quux".to_string(), + "hello=world".to_string(), + HashMap::new() + )) + ); + + let path = "/foo/{bar}/baz/{qux}?hello={hello}"; + let params = vec![ + ("bar".to_string(), "qux".to_string()), + ("qux".to_string(), "quux".to_string()), + ("hello".to_string(), "hello world".to_string()), + ] + .into_iter() + .collect(); + assert_eq!( + super::replace_params_in_path(path, ¶ms, &prompt_target_params), + Ok(( + "/foo/qux/baz/quux".to_string(), + "hello=hello%20world".to_string(), + HashMap::new() + )) ); let path = "/foo/{bar}/baz/{qux}"; @@ -76,7 +197,7 @@ mod test { .into_iter() .collect(); assert_eq!( - super::replace_params_in_path(path, ¶ms), + super::replace_params_in_path(path, ¶ms, &prompt_target_params), Err("Missing value for parameter `qux`".to_string()) ); } diff --git a/crates/llm_gateway/Cargo.lock b/crates/llm_gateway/Cargo.lock deleted file mode 100644 index 19ce3747..00000000 --- a/crates/llm_gateway/Cargo.lock +++ /dev/null @@ -1,2166 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "acap" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6851a0b3b2d5729a0b7e61e3c36923ed9d72240146b0efda61121b0b84ad595d" -dependencies = [ - "num-traits", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "ahash" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" - -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" - -[[package]] -name = "async-trait" -version = "0.1.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" -dependencies = [ - "memchr", - "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" - -[[package]] -name = "cc" -version = "1.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "common" -version = "0.1.0" -dependencies = [ - "derivative", - "duration-string", - "governor", - "log", - "proxy-wasm", - "rand", - "serde", - "serde_json", - "serde_yaml", - "thiserror", - "tiktoken-rs", -] - -[[package]] -name = "cpp_demangle" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-bforest" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305d51c180ebdc46ef61bc60c54ae6512db3bc9a05842a1f1e762e45977019ab" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-bitset" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3247afacd9b13d620033f3190d9e49d1beefc1acb33d5604a249956c9c13709" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-codegen" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7ca95e831c18d1356da783765c344207cbdffea91e13e47fa9327dbb2e0719" -dependencies = [ - "bumpalo", - "cranelift-bforest", - "cranelift-bitset", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", - "gimli", - "hashbrown 0.14.5", - "log", - "regalloc2", - "rustc-hash", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "450c105fa1e51bfba4e95a86e926504a867ad5639d63f31d43fe3b7ec1f1c9ef" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479117cd1266881479908d383086561cee37e49affbea9b1e6b594cc21cc220" - -[[package]] -name = "cranelift-control" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34378804f0abfdd22c068a741cfeed86938b92375b2a96fb0b42c878e0141bfb" -dependencies = [ - "arbitrary", -] - -[[package]] -name = "cranelift-entity" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a48cb0a194c9ba82fec35a1e492055388d89b2e3c03dee9dcf2488892be8004d" -dependencies = [ - "cranelift-bitset", - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-frontend" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8327afc6c1c05f4be62fefce5b439fa83521c65363a322e86ea32c85e7ceaf64" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-isle" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b08621c00321efcfa3eee6a3179adc009e21ea8d24ca7adc3c326184bc3f48" - -[[package]] -name = "cranelift-native" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51180b147c8557c1196c77b098f04140c91962e135ea152cd2fcabf40cf365c" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-wasm" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "019e3dccb7f15e0bc14f0ddc034ec608a66df8e05c9e1e16f75a7716f8461799" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "itertools", - "log", - "smallvec", - "wasmparser", - "wasmtime-types", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "duration-string" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fcc1d9ae294a15ed05aeae8e11ee5f2b3fe971c077d45a42fb20825fba6ee13" -dependencies = [ - "serde", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fancy-regex" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7493d4c459da9f84325ad297371a6b2b8a162800873a22e3b6b6512e61d18c05" -dependencies = [ - "bit-set", - "regex", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "fxprof-processed-profile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" -dependencies = [ - "bitflags 2.6.0", - "debugid", - "fxhash", - "serde", - "serde_json", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "governor" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" -dependencies = [ - "cfg-if 1.0.0", - "no-std-compat", - "nonzero_ext", - "portable-atomic", - "smallvec", - "spinning_top", -] - -[[package]] -name = "hashbrown" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "ahash 0.3.8", - "autocfg", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.11", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash 0.8.11", - "allocator-api2", - "serde", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] -name = "indexmap" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" -dependencies = [ - "equivalent", - "hashbrown 0.14.5", - "serde", -] - -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "ittapi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" -dependencies = [ - "anyhow", - "ittapi-sys", - "log", -] - -[[package]] -name = "ittapi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" -dependencies = [ - "cc", -] - -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "llm_gateway" -version = "0.1.0" -dependencies = [ - "acap", - "common", - "derivative", - "governor", - "http", - "log", - "md5", - "proxy-wasm", - "proxy-wasm-test-framework", - "rand", - "serde", - "serde_json", - "serde_yaml", - "serial_test", - "sha2", - "thiserror", -] - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "mach2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" -dependencies = [ - "libc", -] - -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix", -] - -[[package]] -name = "more-asserts" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fafa6961cabd9c63bcd77a45d7e3b7f3b552b70417831fb0f56db717e72407e" - -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" -dependencies = [ - "hashbrown 0.8.2", -] - -[[package]] -name = "nonzero_ext" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" -dependencies = [ - "crc32fast", - "hashbrown 0.14.5", - "indexmap", - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "portable-atomic" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" - -[[package]] -name = "postcard" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7f0a8d620d71c457dd1d47df76bb18960378da56af4527aaa10f515eee732e" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proxy-wasm" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14a5a4df5a1ab77235e36a0a0f638687ee1586d21ee9774037693001e94d4e11" -dependencies = [ - "hashbrown 0.14.5", - "log", -] - -[[package]] -name = "proxy-wasm-test-framework" -version = "0.1.0" -source = "git+https://github.com/katanemo/test-framework.git?branch=new#c2511cd9030705e14d5f60aca77d6c96c81c6dfa" -dependencies = [ - "anyhow", - "cfg-if 0.1.10", - "lazy_static", - "more-asserts", - "rand", - "structopt", - "wasmtime", -] - -[[package]] -name = "psm" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" -dependencies = [ - "cc", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - -[[package]] -name = "regalloc2" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" -dependencies = [ - "hashbrown 0.13.2", - "log", - "rustc-hash", - "slice-group-by", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustix" -version = "0.38.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "scc" -version = "2.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c947adb109a8afce5fc9c7bf951f87f146e9147b3a6a58413105628fb1d1e66" -dependencies = [ - "sdd", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sdd" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a7b59a5d9b0099720b417b6325d91a52cbf5b3dcb5041d864be53eefa58abc" - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "serde_json" -version = "1.0.128" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "serial_test" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" -dependencies = [ - "futures", - "log", - "once_cell", - "parking_lot", - "scc", - "serial_test_derive", -] - -[[package]] -name = "serial_test_derive" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "slice-group-by" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -dependencies = [ - "serde", -] - -[[package]] -name = "spinning_top" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" -dependencies = [ - "lock_api", -] - -[[package]] -name = "sptr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "tiktoken-rs" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c314e7ce51440f9e8f5a497394682a57b7c323d0f4d0a6b1b13c429056e0e234" -dependencies = [ - "anyhow", - "base64", - "bstr", - "fancy-regex", - "lazy_static", - "parking_lot", - "rustc-hash", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - -[[package]] -name = "unicode-width" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - -[[package]] -name = "unicode-xid" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "uuid" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-encoder" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.217.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b88b0814c9a2b323a9b46c687e726996c255ac8b64aa237dd11c81ed4854760" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasmparser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" -dependencies = [ - "ahash 0.8.11", - "bitflags 2.6.0", - "hashbrown 0.14.5", - "indexmap", - "semver", - "serde", -] - -[[package]] -name = "wasmprinter" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" -dependencies = [ - "anyhow", - "termcolor", - "wasmparser", -] - -[[package]] -name = "wasmtime" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07232e0b473af36112da7348f51e73fa8b11047a6cb546096da3812930b7c93a" -dependencies = [ - "addr2line", - "anyhow", - "async-trait", - "bitflags 2.6.0", - "bumpalo", - "cc", - "cfg-if 1.0.0", - "encoding_rs", - "fxprof-processed-profile", - "gimli", - "hashbrown 0.14.5", - "indexmap", - "ittapi", - "libc", - "libm", - "log", - "mach2", - "memfd", - "object", - "once_cell", - "paste", - "postcard", - "psm", - "rayon", - "rustix", - "semver", - "serde", - "serde_derive", - "serde_json", - "smallvec", - "sptr", - "target-lexicon", - "wasm-encoder 0.212.0", - "wasmparser", - "wasmtime-asm-macros", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-component-util", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", - "wasmtime-slab", - "wasmtime-versioned-export-macros", - "wasmtime-winch", - "wat", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a9c42562d879c749288d9a26acc0d95d2ca069e30c2ec2efce84461c4d62b3" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "wasmtime-cache" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d5d5aac98c8ae87cf5244495da7722e3fa022aa6f3f4fcd5e3d6e5699ce422" -dependencies = [ - "anyhow", - "base64", - "directories-next", - "log", - "postcard", - "rustix", - "serde", - "serde_derive", - "sha2", - "toml", - "windows-sys 0.52.0", - "zstd", -] - -[[package]] -name = "wasmtime-component-macro" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c3f57c4bc96f9b4a6ff4d6cb6e837913eff32e98d09e2b6d79b5c4647b415b" -dependencies = [ - "anyhow", - "proc-macro2", - "quote", - "syn 2.0.77", - "wasmtime-component-util", - "wasmtime-wit-bindgen", - "wit-parser", -] - -[[package]] -name = "wasmtime-component-util" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1da707969bc31a565da9b32d087eb2370c95c6f2087c5539a15f2e3b27e77203" - -[[package]] -name = "wasmtime-cranelift" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cb6135ec46994299be711b78b03acaa9480de3715f827d450f0c947a84977c" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", - "gimli", - "log", - "object", - "target-lexicon", - "thiserror", - "wasmparser", - "wasmtime-environ", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-environ" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bcaa3b42a0718e9123da7fb75e8e13fc95df7db2a7e32e2f2f4f0d3333b7d6f" -dependencies = [ - "anyhow", - "cpp_demangle", - "cranelift-bitset", - "cranelift-entity", - "gimli", - "indexmap", - "log", - "object", - "postcard", - "rustc-demangle", - "semver", - "serde", - "serde_derive", - "target-lexicon", - "wasm-encoder 0.212.0", - "wasmparser", - "wasmprinter", - "wasmtime-component-util", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-fiber" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1c805515f4bc157f70f998038951009d21a19c1ef8c5fbb374a11b1d56672" -dependencies = [ - "anyhow", - "cc", - "cfg-if 1.0.0", - "rustix", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "118e141e52f3898a531a612985bd09a5e05a1d646cad2f30a3020b675c21cd49" -dependencies = [ - "object", - "once_cell", - "rustix", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfee42dac5148fc2664ab1f5cb8d7fa77a28d1a2cf1d9483abc2c3d751a58b9" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-slab" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42eb8f6515708ec67974998c3e644101db4186308985f5ef7c2ef324ff33c948" - -[[package]] -name = "wasmtime-types" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046873fb8fb3e9652f3fd76fe99c8c8129007695c3d73b2e307fdae40f6e324c" -dependencies = [ - "anyhow", - "cranelift-entity", - "serde", - "serde_derive", - "smallvec", - "wasmparser", -] - -[[package]] -name = "wasmtime-versioned-export-macros" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c02af2e9dbeb427304d1a08787d70ed0dbfec1af2236616f84c9f1f03e7969" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "wasmtime-winch" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ceddc47a49af10908a288fdfdc296ab3932062cab62a785e3705bbb3709c59" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli", - "object", - "target-lexicon", - "wasmparser", - "wasmtime-cranelift", - "wasmtime-environ", - "winch-codegen", -] - -[[package]] -name = "wasmtime-wit-bindgen" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f528f8b8a2376a3dacaf497d960216dd466d324425361e1e00e26de0a7705c" -dependencies = [ - "anyhow", - "heck 0.4.1", - "indexmap", - "wit-parser", -] - -[[package]] -name = "wast" -version = "217.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79004ecebded92d3c710d4841383368c7f04b63d0992ddd6b0c7d5029b7629b7" -dependencies = [ - "bumpalo", - "leb128", - "memchr", - "unicode-width", - "wasm-encoder 0.217.0", -] - -[[package]] -name = "wat" -version = "1.217.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c126271c3d92ca0f7c63e4e462e40c69cca52fd4245fcda730d1cf558fb55088" -dependencies = [ - "wast", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winch-codegen" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a41b67a37ea74e83c38ef495cc213aba73385236b1deee883dc869e835003b9" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli", - "regalloc2", - "smallvec", - "target-lexicon", - "wasmparser", - "wasmtime-cranelift", - "wasmtime-environ", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - -[[package]] -name = "wit-parser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "zstd" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/crates/llm_gateway/src/filter_context.rs b/crates/llm_gateway/src/filter_context.rs index 56af01b5..0edba456 100644 --- a/crates/llm_gateway/src/filter_context.rs +++ b/crates/llm_gateway/src/filter_context.rs @@ -79,6 +79,11 @@ impl RootContext for FilterContext { } fn create_http_context(&self, context_id: u32) -> Option> { + trace!( + "||| create_http_context called with context_id: {:?} |||", + context_id + ); + Some(Box::new(StreamContext::new( context_id, Rc::clone(&self.metrics), diff --git a/crates/llm_gateway/src/stream_context.rs b/crates/llm_gateway/src/stream_context.rs index a0714e80..e7a17e9e 100644 --- a/crates/llm_gateway/src/stream_context.rs +++ b/crates/llm_gateway/src/stream_context.rs @@ -87,7 +87,7 @@ impl StreamContext { )); debug!( - "llm provider hint: {:?}, selected llm: {}", + "request received: llm provider hint: {:?}, selected llm: {}", self.get_http_request_header(ARCH_PROVIDER_HINT_HEADER), self.llm_provider.as_ref().unwrap().name ); @@ -309,6 +309,12 @@ impl HttpContext for StreamContext { } fn on_http_response_headers(&mut self, _num_headers: usize, _end_of_stream: bool) -> Action { + trace!( + "on_http_response_headers [S={}] end_stream={}", + self.context_id, + _end_of_stream + ); + self.set_property( vec!["metadata", "filter_metadata", "llm_filter", "user_prompt"], Some("hello world from filter".as_bytes()), @@ -318,6 +324,13 @@ impl HttpContext for StreamContext { } fn on_http_response_body(&mut self, body_size: usize, end_of_stream: bool) -> Action { + trace!( + "on_http_response_body [S={}] bytes={} end_stream={}", + self.context_id, + body_size, + end_of_stream + ); + if !self.is_chat_completions_request { debug!("non-chatcompletion request"); return Action::Continue; @@ -517,8 +530,11 @@ impl HttpContext for StreamContext { let chat_completions_response: ChatCompletionsResponse = match serde_json::from_str(body_utf8.as_str()) { Ok(de) => de, - Err(_e) => { - debug!("invalid response: {}", body_utf8); + Err(err) => { + debug!( + "non chat-completion compliant response received err: {}, body: {}", + err, body_utf8 + ); return Action::Continue; } }; diff --git a/crates/llm_gateway/tests/integration.rs b/crates/llm_gateway/tests/integration.rs index 7a74dfa8..0b28a175 100644 --- a/crates/llm_gateway/tests/integration.rs +++ b/crates/llm_gateway/tests/integration.rs @@ -22,12 +22,8 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { Some(MapType::HttpRequestHeaders), Some("x-arch-llm-provider-hint"), ) - .returning(Some("default")) - .expect_log( - Some(LogLevel::Debug), - Some("llm provider hint: Some(Default)"), - ) - .expect_log(Some(LogLevel::Debug), Some("selected llm: open-ai-gpt-4")) + .returning(None) + .expect_log(Some(LogLevel::Debug), Some("request received: llm provider hint: Some(\"default\"), selected llm: open-ai-gpt-4")) .expect_add_header_map_value( Some(MapType::HttpRequestHeaders), Some("x-arch-llm-provider"), @@ -38,7 +34,11 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { Some("Authorization"), Some("Bearer secret_key"), ) - .expect_remove_header_map_value(Some(MapType::HttpRequestHeaders), Some("content-length")) + .expect_get_header_map_value( + Some(MapType::HttpRequestHeaders), + Some("x-arch-llm-provider-hint"), + ) + .returning(Some("default")) .expect_get_header_map_value( Some(MapType::HttpRequestHeaders), Some("x-arch-ratelimit-selector"), @@ -50,7 +50,6 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { .returning(None) .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":path")) .returning(Some("/v1/chat/completions")) - .expect_log(Some(LogLevel::Debug), None) .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("x-request-id")) .returning(None) .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent")) @@ -62,7 +61,7 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { fn normal_flow(module: &mut Tester, filter_context: i32, http_context: i32) { module .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .execute_and_expect(ReturnType::None) .unwrap(); @@ -187,7 +186,10 @@ fn llm_gateway_successful_request_to_open_ai_chat_completions() { module .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Debug), None) + .expect_log( + Some(LogLevel::Trace), + Some("||| create_http_context called with context_id: 2 |||"), + ) .execute_and_expect(ReturnType::None) .unwrap(); @@ -218,9 +220,9 @@ fn llm_gateway_successful_request_to_open_ai_chat_completions() { .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) .returning(Some(chat_completions_request_body)) .expect_log(Some(LogLevel::Trace), None) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_metric_record("input_sequence_length", 21) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) @@ -251,7 +253,7 @@ fn llm_gateway_bad_request_to_open_ai_chat_completions() { module .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .execute_and_expect(ReturnType::None) .unwrap(); @@ -339,9 +341,9 @@ fn llm_gateway_request_ratelimited() { .returning(Some(chat_completions_request_body)) // The actual call is not important in this test, we just need to grab the token_id .expect_log(Some(LogLevel::Trace), None) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_metric_record("input_sequence_length", 107) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) @@ -405,9 +407,9 @@ fn llm_gateway_request_not_ratelimited() { .returning(Some(chat_completions_request_body)) // The actual call is not important in this test, we just need to grab the token_id .expect_log(Some(LogLevel::Trace), None) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_metric_record("input_sequence_length", 29) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) diff --git a/crates/prompt_gateway/Cargo.lock b/crates/prompt_gateway/Cargo.lock deleted file mode 100644 index 7679b301..00000000 --- a/crates/prompt_gateway/Cargo.lock +++ /dev/null @@ -1,2166 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "acap" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6851a0b3b2d5729a0b7e61e3c36923ed9d72240146b0efda61121b0b84ad595d" -dependencies = [ - "num-traits", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "ahash" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" - -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" - -[[package]] -name = "async-trait" -version = "0.1.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" -dependencies = [ - "memchr", - "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" - -[[package]] -name = "cc" -version = "1.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "common" -version = "0.1.0" -dependencies = [ - "derivative", - "duration-string", - "governor", - "log", - "proxy-wasm", - "rand", - "serde", - "serde_json", - "serde_yaml", - "thiserror", - "tiktoken-rs", -] - -[[package]] -name = "cpp_demangle" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-bforest" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305d51c180ebdc46ef61bc60c54ae6512db3bc9a05842a1f1e762e45977019ab" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-bitset" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3247afacd9b13d620033f3190d9e49d1beefc1acb33d5604a249956c9c13709" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-codegen" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7ca95e831c18d1356da783765c344207cbdffea91e13e47fa9327dbb2e0719" -dependencies = [ - "bumpalo", - "cranelift-bforest", - "cranelift-bitset", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", - "gimli", - "hashbrown 0.14.5", - "log", - "regalloc2", - "rustc-hash", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "450c105fa1e51bfba4e95a86e926504a867ad5639d63f31d43fe3b7ec1f1c9ef" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479117cd1266881479908d383086561cee37e49affbea9b1e6b594cc21cc220" - -[[package]] -name = "cranelift-control" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34378804f0abfdd22c068a741cfeed86938b92375b2a96fb0b42c878e0141bfb" -dependencies = [ - "arbitrary", -] - -[[package]] -name = "cranelift-entity" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a48cb0a194c9ba82fec35a1e492055388d89b2e3c03dee9dcf2488892be8004d" -dependencies = [ - "cranelift-bitset", - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-frontend" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8327afc6c1c05f4be62fefce5b439fa83521c65363a322e86ea32c85e7ceaf64" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-isle" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b08621c00321efcfa3eee6a3179adc009e21ea8d24ca7adc3c326184bc3f48" - -[[package]] -name = "cranelift-native" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51180b147c8557c1196c77b098f04140c91962e135ea152cd2fcabf40cf365c" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-wasm" -version = "0.110.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "019e3dccb7f15e0bc14f0ddc034ec608a66df8e05c9e1e16f75a7716f8461799" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "itertools", - "log", - "smallvec", - "wasmparser", - "wasmtime-types", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "duration-string" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fcc1d9ae294a15ed05aeae8e11ee5f2b3fe971c077d45a42fb20825fba6ee13" -dependencies = [ - "serde", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fancy-regex" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7493d4c459da9f84325ad297371a6b2b8a162800873a22e3b6b6512e61d18c05" -dependencies = [ - "bit-set", - "regex", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "fxprof-processed-profile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" -dependencies = [ - "bitflags 2.6.0", - "debugid", - "fxhash", - "serde", - "serde_json", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "governor" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" -dependencies = [ - "cfg-if 1.0.0", - "no-std-compat", - "nonzero_ext", - "portable-atomic", - "smallvec", - "spinning_top", -] - -[[package]] -name = "hashbrown" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "ahash 0.3.8", - "autocfg", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.11", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash 0.8.11", - "allocator-api2", - "serde", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] -name = "indexmap" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" -dependencies = [ - "equivalent", - "hashbrown 0.14.5", - "serde", -] - -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "ittapi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" -dependencies = [ - "anyhow", - "ittapi-sys", - "log", -] - -[[package]] -name = "ittapi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" -dependencies = [ - "cc", -] - -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "mach2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" -dependencies = [ - "libc", -] - -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix", -] - -[[package]] -name = "more-asserts" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fafa6961cabd9c63bcd77a45d7e3b7f3b552b70417831fb0f56db717e72407e" - -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" -dependencies = [ - "hashbrown 0.8.2", -] - -[[package]] -name = "nonzero_ext" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" -dependencies = [ - "crc32fast", - "hashbrown 0.14.5", - "indexmap", - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "portable-atomic" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" - -[[package]] -name = "postcard" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7f0a8d620d71c457dd1d47df76bb18960378da56af4527aaa10f515eee732e" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prompt_gateway" -version = "0.1.0" -dependencies = [ - "acap", - "common", - "derivative", - "governor", - "http", - "log", - "md5", - "proxy-wasm", - "proxy-wasm-test-framework", - "rand", - "serde", - "serde_json", - "serde_yaml", - "serial_test", - "sha2", - "thiserror", -] - -[[package]] -name = "proxy-wasm" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14a5a4df5a1ab77235e36a0a0f638687ee1586d21ee9774037693001e94d4e11" -dependencies = [ - "hashbrown 0.14.5", - "log", -] - -[[package]] -name = "proxy-wasm-test-framework" -version = "0.1.0" -source = "git+https://github.com/katanemo/test-framework.git?branch=new#c2511cd9030705e14d5f60aca77d6c96c81c6dfa" -dependencies = [ - "anyhow", - "cfg-if 0.1.10", - "lazy_static", - "more-asserts", - "rand", - "structopt", - "wasmtime", -] - -[[package]] -name = "psm" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" -dependencies = [ - "cc", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - -[[package]] -name = "regalloc2" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" -dependencies = [ - "hashbrown 0.13.2", - "log", - "rustc-hash", - "slice-group-by", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustix" -version = "0.38.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "scc" -version = "2.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c947adb109a8afce5fc9c7bf951f87f146e9147b3a6a58413105628fb1d1e66" -dependencies = [ - "sdd", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sdd" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a7b59a5d9b0099720b417b6325d91a52cbf5b3dcb5041d864be53eefa58abc" - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "serde_json" -version = "1.0.128" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "serial_test" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" -dependencies = [ - "futures", - "log", - "once_cell", - "parking_lot", - "scc", - "serial_test_derive", -] - -[[package]] -name = "serial_test_derive" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "slice-group-by" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -dependencies = [ - "serde", -] - -[[package]] -name = "spinning_top" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" -dependencies = [ - "lock_api", -] - -[[package]] -name = "sptr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "tiktoken-rs" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c314e7ce51440f9e8f5a497394682a57b7c323d0f4d0a6b1b13c429056e0e234" -dependencies = [ - "anyhow", - "base64", - "bstr", - "fancy-regex", - "lazy_static", - "parking_lot", - "rustc-hash", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - -[[package]] -name = "unicode-width" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - -[[package]] -name = "unicode-xid" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "uuid" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-encoder" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.217.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b88b0814c9a2b323a9b46c687e726996c255ac8b64aa237dd11c81ed4854760" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasmparser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" -dependencies = [ - "ahash 0.8.11", - "bitflags 2.6.0", - "hashbrown 0.14.5", - "indexmap", - "semver", - "serde", -] - -[[package]] -name = "wasmprinter" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" -dependencies = [ - "anyhow", - "termcolor", - "wasmparser", -] - -[[package]] -name = "wasmtime" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07232e0b473af36112da7348f51e73fa8b11047a6cb546096da3812930b7c93a" -dependencies = [ - "addr2line", - "anyhow", - "async-trait", - "bitflags 2.6.0", - "bumpalo", - "cc", - "cfg-if 1.0.0", - "encoding_rs", - "fxprof-processed-profile", - "gimli", - "hashbrown 0.14.5", - "indexmap", - "ittapi", - "libc", - "libm", - "log", - "mach2", - "memfd", - "object", - "once_cell", - "paste", - "postcard", - "psm", - "rayon", - "rustix", - "semver", - "serde", - "serde_derive", - "serde_json", - "smallvec", - "sptr", - "target-lexicon", - "wasm-encoder 0.212.0", - "wasmparser", - "wasmtime-asm-macros", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-component-util", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", - "wasmtime-slab", - "wasmtime-versioned-export-macros", - "wasmtime-winch", - "wat", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a9c42562d879c749288d9a26acc0d95d2ca069e30c2ec2efce84461c4d62b3" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "wasmtime-cache" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d5d5aac98c8ae87cf5244495da7722e3fa022aa6f3f4fcd5e3d6e5699ce422" -dependencies = [ - "anyhow", - "base64", - "directories-next", - "log", - "postcard", - "rustix", - "serde", - "serde_derive", - "sha2", - "toml", - "windows-sys 0.52.0", - "zstd", -] - -[[package]] -name = "wasmtime-component-macro" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c3f57c4bc96f9b4a6ff4d6cb6e837913eff32e98d09e2b6d79b5c4647b415b" -dependencies = [ - "anyhow", - "proc-macro2", - "quote", - "syn 2.0.77", - "wasmtime-component-util", - "wasmtime-wit-bindgen", - "wit-parser", -] - -[[package]] -name = "wasmtime-component-util" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1da707969bc31a565da9b32d087eb2370c95c6f2087c5539a15f2e3b27e77203" - -[[package]] -name = "wasmtime-cranelift" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cb6135ec46994299be711b78b03acaa9480de3715f827d450f0c947a84977c" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", - "gimli", - "log", - "object", - "target-lexicon", - "thiserror", - "wasmparser", - "wasmtime-environ", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-environ" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bcaa3b42a0718e9123da7fb75e8e13fc95df7db2a7e32e2f2f4f0d3333b7d6f" -dependencies = [ - "anyhow", - "cpp_demangle", - "cranelift-bitset", - "cranelift-entity", - "gimli", - "indexmap", - "log", - "object", - "postcard", - "rustc-demangle", - "semver", - "serde", - "serde_derive", - "target-lexicon", - "wasm-encoder 0.212.0", - "wasmparser", - "wasmprinter", - "wasmtime-component-util", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-fiber" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1c805515f4bc157f70f998038951009d21a19c1ef8c5fbb374a11b1d56672" -dependencies = [ - "anyhow", - "cc", - "cfg-if 1.0.0", - "rustix", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "118e141e52f3898a531a612985bd09a5e05a1d646cad2f30a3020b675c21cd49" -dependencies = [ - "object", - "once_cell", - "rustix", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfee42dac5148fc2664ab1f5cb8d7fa77a28d1a2cf1d9483abc2c3d751a58b9" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-slab" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42eb8f6515708ec67974998c3e644101db4186308985f5ef7c2ef324ff33c948" - -[[package]] -name = "wasmtime-types" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046873fb8fb3e9652f3fd76fe99c8c8129007695c3d73b2e307fdae40f6e324c" -dependencies = [ - "anyhow", - "cranelift-entity", - "serde", - "serde_derive", - "smallvec", - "wasmparser", -] - -[[package]] -name = "wasmtime-versioned-export-macros" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c02af2e9dbeb427304d1a08787d70ed0dbfec1af2236616f84c9f1f03e7969" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "wasmtime-winch" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ceddc47a49af10908a288fdfdc296ab3932062cab62a785e3705bbb3709c59" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli", - "object", - "target-lexicon", - "wasmparser", - "wasmtime-cranelift", - "wasmtime-environ", - "winch-codegen", -] - -[[package]] -name = "wasmtime-wit-bindgen" -version = "23.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f528f8b8a2376a3dacaf497d960216dd466d324425361e1e00e26de0a7705c" -dependencies = [ - "anyhow", - "heck 0.4.1", - "indexmap", - "wit-parser", -] - -[[package]] -name = "wast" -version = "217.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79004ecebded92d3c710d4841383368c7f04b63d0992ddd6b0c7d5029b7629b7" -dependencies = [ - "bumpalo", - "leb128", - "memchr", - "unicode-width", - "wasm-encoder 0.217.0", -] - -[[package]] -name = "wat" -version = "1.217.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c126271c3d92ca0f7c63e4e462e40c69cca52fd4245fcda730d1cf558fb55088" -dependencies = [ - "wast", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winch-codegen" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a41b67a37ea74e83c38ef495cc213aba73385236b1deee883dc869e835003b9" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli", - "regalloc2", - "smallvec", - "target-lexicon", - "wasmparser", - "wasmtime-cranelift", - "wasmtime-environ", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - -[[package]] -name = "wit-parser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "zstd" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/crates/prompt_gateway/src/context.rs b/crates/prompt_gateway/src/context.rs index c70937d7..89725e0d 100644 --- a/crates/prompt_gateway/src/context.rs +++ b/crates/prompt_gateway/src/context.rs @@ -27,21 +27,34 @@ impl Context for StreamContext { .get_http_call_response_body(0, body_size) .unwrap_or_default(); - let http_status = self - .get_http_call_response_header(":status") - .unwrap_or(StatusCode::OK.as_str().to_string()); - if http_status != StatusCode::OK.as_str() { - let server_error = ServerError::Upstream { - host: callout_context.upstream_cluster.unwrap(), - path: callout_context.upstream_cluster_path.unwrap(), - status: http_status.clone(), - body: String::from_utf8(body).unwrap(), - }; - warn!("filter received non 2xx code: {:?}", server_error); - return self.send_server_error( - server_error, - Some(StatusCode::from_str(http_status.as_str()).unwrap()), - ); + if let Some(http_status) = self.get_http_call_response_header(":status") { + match StatusCode::from_str(http_status.as_str()) { + Ok(status_code) => { + if !status_code.is_success() { + let server_error = ServerError::Upstream { + host: callout_context.upstream_cluster.unwrap(), + path: callout_context.upstream_cluster_path.unwrap(), + status: http_status.clone(), + body: String::from_utf8(body).unwrap(), + }; + warn!("received non 2xx code: {:?}", server_error); + return self.send_server_error( + server_error, + Some(StatusCode::from_str(http_status.as_str()).unwrap()), + ); + } + } + Err(_) => { + // invalid status code (status code non numeric) + return self.send_server_error( + ServerError::LogicError(format!("invalid status code: {}", http_status)), + Some(StatusCode::from_str(http_status.as_str()).unwrap()), + ); + } + } + } else { + // :status header not found + warn!("missing :status header"); } #[cfg_attr(any(), rustfmt::skip)] diff --git a/crates/prompt_gateway/src/filter_context.rs b/crates/prompt_gateway/src/filter_context.rs index b323e675..f782dea2 100644 --- a/crates/prompt_gateway/src/filter_context.rs +++ b/crates/prompt_gateway/src/filter_context.rs @@ -3,6 +3,7 @@ use crate::stream_context::StreamContext; use common::configuration::{Configuration, Overrides, PromptGuards, PromptTarget, Tracing}; use common::http::Client; use common::stats::Gauge; +use log::trace; use proxy_wasm::traits::*; use proxy_wasm::types::*; use std::cell::RefCell; @@ -83,6 +84,11 @@ impl RootContext for FilterContext { } fn create_http_context(&self, context_id: u32) -> Option> { + trace!( + "||| create_http_context called with context_id: {:?} |||", + context_id + ); + Some(Box::new(StreamContext::new( context_id, Rc::clone(&self.metrics), diff --git a/crates/prompt_gateway/src/http_context.rs b/crates/prompt_gateway/src/http_context.rs index f105fd7e..d5f62509 100644 --- a/crates/prompt_gateway/src/http_context.rs +++ b/crates/prompt_gateway/src/http_context.rs @@ -78,10 +78,7 @@ impl HttpContext for StreamContext { } }; - debug!( - "developer => archgw: {}", - String::from_utf8_lossy(&body_bytes) - ); + trace!("request body: {}", String::from_utf8_lossy(&body_bytes)); // Deserialize body into spec. // Currently OpenAI API. @@ -133,9 +130,23 @@ impl HttpContext for StreamContext { .map(|(_, pt)| pt.into()) .collect(); + let mut metadata = deserialized_body.metadata.clone(); + + if let Some(overrides) = self.overrides.as_ref() { + if overrides.optimize_context_window.unwrap_or_default() { + if metadata.is_none() { + metadata = Some(HashMap::new()); + } + metadata + .as_mut() + .unwrap() + .insert("optimize_context_window".to_string(), "true".to_string()); + } + } + let arch_fc_chat_completion_request = ChatCompletionsRequest { messages: deserialized_body.messages.clone(), - metadata: deserialized_body.metadata.clone(), + metadata, stream: deserialized_body.stream, model: "--".to_string(), stream_options: deserialized_body.stream_options.clone(), @@ -152,7 +163,8 @@ impl HttpContext for StreamContext { } }; - debug!("archgw => archfc: {}", json_data); + debug!("sending request to model server"); + trace!("request body: {}", json_data); let mut headers = vec![ (ARCH_UPSTREAM_HOST_HEADER, MODEL_SERVER_NAME), diff --git a/crates/prompt_gateway/src/lib.rs b/crates/prompt_gateway/src/lib.rs index 1acd4d6d..7e7a24f9 100644 --- a/crates/prompt_gateway/src/lib.rs +++ b/crates/prompt_gateway/src/lib.rs @@ -7,6 +7,7 @@ mod filter_context; mod http_context; mod metrics; mod stream_context; +mod tools; proxy_wasm::main! {{ proxy_wasm::set_log_level(LogLevel::Trace); diff --git a/crates/prompt_gateway/src/stream_context.rs b/crates/prompt_gateway/src/stream_context.rs index 678eedab..e6db7f59 100644 --- a/crates/prompt_gateway/src/stream_context.rs +++ b/crates/prompt_gateway/src/stream_context.rs @@ -1,4 +1,5 @@ use crate::metrics::Metrics; +use crate::tools::compute_request_path_body; use common::api::open_ai::{ to_server_events, ArchState, ChatCompletionStreamResponse, ChatCompletionsRequest, ChatCompletionsResponse, Message, ModelServerResponse, ToolCall, @@ -14,9 +15,8 @@ use common::http::{CallArgs, Client}; use common::stats::Gauge; use derivative::Derivative; use http::StatusCode; -use log::{debug, warn}; +use log::{debug, trace, warn}; use proxy_wasm::traits::*; -use serde_yaml::Value; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; @@ -46,7 +46,7 @@ pub struct StreamCallContext { pub struct StreamContext { system_prompt: Rc>, pub prompt_targets: Rc>, - _overrides: Rc>, + pub overrides: Rc>, pub metrics: Rc, pub callouts: RefCell>, pub context_id: u32, @@ -89,7 +89,7 @@ impl StreamContext { streaming_response: false, user_prompt: None, is_chat_completions_request: false, - _overrides: overrides, + overrides: overrides, request_id: None, traceparent: None, _tracing: tracing, @@ -125,13 +125,14 @@ impl StreamContext { mut callout_context: StreamCallContext, ) { let body_str = String::from_utf8(body).unwrap(); - debug!("archgw <= archfc response: {}", body_str); + debug!("model server response received"); + trace!("response body: {}", body_str); let model_server_response: ModelServerResponse = match serde_json::from_str(&body_str) { Ok(arch_fc_response) => arch_fc_response, Err(e) => { warn!( - "error deserializing archfc response: {}, body: {}", + "error deserializing modelserver response: {}, body: {}", e, body_str ); return self.send_server_error(ServerError::Deserialization(e), None); @@ -141,7 +142,7 @@ impl StreamContext { let arch_fc_response = match model_server_response { ModelServerResponse::ChatCompletionsResponse(response) => response, ModelServerResponse::ModelServerErrorResponse(response) => { - debug!("archgw <= archfc error response: {}", response.result); + debug!("archgw <= modelserver error response: {}", response.result); if response.result == "No intent matched" { if let Some(default_prompt_target) = self .prompt_targets @@ -272,85 +273,76 @@ impl StreamContext { fn schedule_api_call_request(&mut self, mut callout_context: StreamCallContext) { let tools_call_name = self.tool_calls.as_ref().unwrap()[0].function.name.clone(); + let prompt_target = self.prompt_targets.get(&tools_call_name).unwrap(); + let tool_params = &self.tool_calls.as_ref().unwrap()[0].function.arguments; + let endpoint_details = prompt_target.endpoint.as_ref().unwrap(); + let endpoint_path: String = endpoint_details + .path + .as_ref() + .unwrap_or(&String::from("/")) + .to_string(); - let prompt_target = self.prompt_targets.get(&tools_call_name).unwrap().clone(); + let http_method = endpoint_details.method.clone().unwrap_or_default(); + let prompt_target_params = prompt_target.parameters.clone().unwrap_or_default(); - let mut tool_params = self.tool_calls.as_ref().unwrap()[0] - .function - .arguments - .clone(); - tool_params.insert( - String::from(MESSAGES_KEY), - serde_yaml::to_value(&callout_context.request_body.messages).unwrap(), - ); - - let tool_params_json_str = serde_json::to_string(&tool_params).unwrap(); - - let endpoint = prompt_target.endpoint.unwrap(); - let path: String = endpoint.path.unwrap_or(String::from("/")); - - // only add params that are of string, number and bool type - let url_params = tool_params - .iter() - .filter(|(_, value)| value.is_number() || value.is_string() || value.is_bool()) - .map(|(key, value)| match value { - Value::Number(n) => (key.clone(), n.to_string()), - Value::String(s) => (key.clone(), s.clone()), - Value::Bool(b) => (key.clone(), b.to_string()), - Value::Null => todo!(), - Value::Sequence(_) => todo!(), - Value::Mapping(_) => todo!(), - Value::Tagged(_) => todo!(), - }) - .collect::>(); - - let path = match common::path::replace_params_in_path(&path, &url_params) { - Ok(path) => path, + let (path, body) = match compute_request_path_body( + &endpoint_path, + tool_params, + &prompt_target_params, + &http_method, + ) { + Ok((path, body)) => (path, body), Err(e) => { return self.send_server_error( ServerError::BadRequest { - why: format!("error replacing params in path: {}", e), + why: format!("error computing api request path or body: {}", e), }, Some(StatusCode::BAD_REQUEST), ); } }; - let http_method = endpoint.method.unwrap_or_default().to_string(); - let mut headers = vec![ - (ARCH_UPSTREAM_HOST_HEADER, endpoint.name.as_str()), - (":method", &http_method), + let http_method_str = http_method.to_string(); + let mut headers: HashMap<_, _> = [ + (ARCH_UPSTREAM_HOST_HEADER, endpoint_details.name.as_str()), + (":method", &http_method_str), (":path", &path), - (":authority", endpoint.name.as_str()), + (":authority", endpoint_details.name.as_str()), ("content-type", "application/json"), ("x-envoy-max-retries", "3"), - ]; + ] + .into_iter() + .collect(); if self.request_id.is_some() { - headers.push((REQUEST_ID_HEADER, self.request_id.as_ref().unwrap())); + headers.insert(REQUEST_ID_HEADER, self.request_id.as_ref().unwrap()); } if self.traceparent.is_some() { - headers.push((TRACE_PARENT_HEADER, self.traceparent.as_ref().unwrap())); + headers.insert(TRACE_PARENT_HEADER, self.traceparent.as_ref().unwrap()); + } + + // override http headers that are set in the prompt target + let http_headers = endpoint_details.http_headers.clone().unwrap_or_default(); + for (key, value) in http_headers.iter() { + headers.insert(key.as_str(), value.as_str()); } let call_args = CallArgs::new( ARCH_INTERNAL_CLUSTER_NAME, &path, - headers, - Some(tool_params_json_str.as_bytes()), + headers.into_iter().collect(), + body.as_deref().map(|s| s.as_bytes()), vec![], Duration::from_secs(5), ); debug!( - "archgw => api call, endpoint: {}{}, body: {}", - endpoint.name.as_str(), - path, - tool_params_json_str + "dispatching api call to developer endpoint: {}, path: {}, method: {}", + endpoint_details.name, path, http_method_str ); - callout_context.upstream_cluster = Some(endpoint.name.to_owned()); + callout_context.upstream_cluster = Some(endpoint_details.name.to_owned()); callout_context.upstream_cluster_path = Some(path.to_owned()); callout_context.response_handler_type = ResponseHandlerType::FunctionCall; @@ -363,6 +355,10 @@ impl StreamContext { let http_status = self .get_http_call_response_header(":status") .unwrap_or(StatusCode::OK.as_str().to_string()); + debug!( + "developer api call response received: status code: {}", + http_status + ); if http_status != StatusCode::OK.as_str() { warn!( "api server responded with non 2xx status code: {}", @@ -379,8 +375,8 @@ impl StreamContext { ); } self.tool_call_response = Some(String::from_utf8(body).unwrap()); - debug!( - "archgw <= api call response: {}", + trace!( + "response body: {}", self.tool_call_response.as_ref().unwrap() ); @@ -430,7 +426,8 @@ impl StreamContext { return self.send_server_error(ServerError::Serialization(e), None); } }; - debug!("archgw => llm request: {}", llm_request_str); + debug!("sending request to upstream llm"); + trace!("request body: {}", llm_request_str); self.start_upstream_llm_request_time = SystemTime::now() .duration_since(UNIX_EPOCH) diff --git a/crates/prompt_gateway/src/tools.rs b/crates/prompt_gateway/src/tools.rs new file mode 100644 index 00000000..b3b3d07e --- /dev/null +++ b/crates/prompt_gateway/src/tools.rs @@ -0,0 +1,157 @@ +use common::configuration::{HttpMethod, Parameter}; +use std::collections::HashMap; + +use serde_yaml::Value; + +// only add params that are of string, number and bool type +pub fn filter_tool_params(tool_params: &HashMap) -> HashMap { + tool_params + .iter() + .filter(|(_, value)| value.is_number() || value.is_string() || value.is_bool()) + .map(|(key, value)| match value { + Value::Number(n) => (key.clone(), n.to_string()), + Value::String(s) => (key.clone(), s.clone()), + Value::Bool(b) => (key.clone(), b.to_string()), + Value::Null => todo!(), + Value::Sequence(_) => todo!(), + Value::Mapping(_) => todo!(), + Value::Tagged(_) => todo!(), + }) + .collect::>() +} + +pub fn compute_request_path_body( + endpoint_path: &str, + tool_params: &HashMap, + prompt_target_params: &[Parameter], + http_method: &HttpMethod, +) -> Result<(String, Option), String> { + let tool_url_params = filter_tool_params(tool_params); + let (path_with_params, query_string, additional_params) = common::path::replace_params_in_path( + endpoint_path, + &tool_url_params, + prompt_target_params, + )?; + + let (path, body) = match http_method { + HttpMethod::Get => (format!("{}?{}", path_with_params, query_string), None), + HttpMethod::Post => { + let mut additional_params = additional_params; + if !query_string.is_empty() { + query_string.split("&").for_each(|param| { + let mut parts = param.split("="); + let key = parts.next().unwrap(); + let value = parts.next().unwrap(); + additional_params.insert(key.to_string(), value.to_string()); + }); + } + let body = serde_json::to_string(&additional_params).unwrap(); + (path_with_params, Some(body)) + } + }; + + Ok((path, body)) +} + +#[cfg(test)] +mod test { + use common::configuration::{HttpMethod, Parameter}; + + #[test] + fn test_compute_request_path_body() { + let endpoint_path = "/cluster.open-cluster-management.io/v1/managedclusters/{cluster_name}"; + let tool_params = serde_yaml::from_str( + r#" + cluster_name: test1 + hello: hello world + "#, + ) + .unwrap(); + let prompt_target_params = vec![Parameter { + name: "country".to_string(), + parameter_type: None, + description: "test target".to_string(), + required: None, + enum_values: None, + default: Some("US".to_string()), + in_path: None, + format: None, + }]; + let http_method = HttpMethod::Get; + let (path, body) = super::compute_request_path_body( + endpoint_path, + &tool_params, + &prompt_target_params, + &http_method, + ) + .unwrap(); + assert_eq!( + path, + "/cluster.open-cluster-management.io/v1/managedclusters/test1?hello=hello%20world&country=US" + ); + assert_eq!(body, None); + } + + #[test] + fn test_compute_request_path_body_empty_params() { + let endpoint_path = "/cluster.open-cluster-management.io/v1/managedclusters/"; + let tool_params = serde_yaml::from_str(r#"{}"#).unwrap(); + let prompt_target_params = vec![Parameter { + name: "country".to_string(), + parameter_type: None, + description: "test target".to_string(), + required: None, + enum_values: None, + default: Some("US".to_string()), + in_path: None, + format: None, + }]; + let http_method = HttpMethod::Get; + let (path, body) = super::compute_request_path_body( + endpoint_path, + &tool_params, + &prompt_target_params, + &http_method, + ) + .unwrap(); + assert_eq!( + path, + "/cluster.open-cluster-management.io/v1/managedclusters/?country=US" + ); + assert_eq!(body, None); + } + + #[test] + fn test_compute_request_path_body_override_default_val() { + let endpoint_path = "/cluster.open-cluster-management.io/v1/managedclusters/"; + let tool_params = serde_yaml::from_str( + r#" + country: UK + "#, + ) + .unwrap(); + let prompt_target_params = vec![Parameter { + name: "country".to_string(), + parameter_type: None, + description: "test target".to_string(), + required: None, + enum_values: None, + default: Some("US".to_string()), + in_path: None, + format: None, + }]; + let http_method = HttpMethod::Get; + let (path, body) = super::compute_request_path_body( + endpoint_path, + &tool_params, + &prompt_target_params, + &http_method, + ) + .unwrap(); + assert_eq!( + path, + "/cluster.open-cluster-management.io/v1/managedclusters/?country=UK" + ); + assert_eq!(body, None); + } +} diff --git a/crates/prompt_gateway/tests/integration.rs b/crates/prompt_gateway/tests/integration.rs index 1a6ed0e6..4af98166 100644 --- a/crates/prompt_gateway/tests/integration.rs +++ b/crates/prompt_gateway/tests/integration.rs @@ -41,7 +41,7 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { fn normal_flow(module: &mut Tester, filter_context: i32, http_context: i32) { module .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .execute_and_expect(ReturnType::None) .unwrap(); @@ -87,8 +87,9 @@ fn normal_flow(module: &mut Tester, filter_context: i32, http_context: i32) { None, ) .returning(Some(1)) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Trace), None) .expect_metric_increment("active_http_calls", 1) .execute_and_expect(ReturnType::Action(Action::Pause)) @@ -203,7 +204,7 @@ fn prompt_gateway_successful_request_to_open_ai_chat_completions() { module .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .execute_and_expect(ReturnType::None) .unwrap(); @@ -234,8 +235,9 @@ fn prompt_gateway_successful_request_to_open_ai_chat_completions() { .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) .returning(Some(chat_completions_request_body)) .expect_log(Some(LogLevel::Trace), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Trace), None) .expect_http_call(Some("arch_internal"), None, None, None, None) .returning(Some(4)) @@ -267,7 +269,7 @@ fn prompt_gateway_bad_request_to_open_ai_chat_completions() { module .call_proxy_on_context_create(http_context, filter_context) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .execute_and_expect(ReturnType::None) .unwrap(); @@ -302,7 +304,7 @@ fn prompt_gateway_bad_request_to_open_ai_chat_completions() { None, None, ) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .execute_and_expect(ReturnType::Action(Action::Pause)) .unwrap(); } @@ -363,29 +365,30 @@ fn prompt_gateway_request_to_llm_gateway() { metadata: None, }; + let expected_body = "{\"city\":\"seattle\"}"; let arch_fc_resp_str = serde_json::to_string(&arch_fc_resp).unwrap(); module .call_proxy_on_http_call_response(http_context, 1, 0, arch_fc_resp_str.len() as i32, 0) .expect_metric_increment("active_http_calls", -1) .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) .returning(Some(&arch_fc_resp_str)) + .expect_log(Some(LogLevel::Warn), None) .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Trace), None) .expect_log(Some(LogLevel::Trace), None) .expect_http_call( Some("arch_internal"), Some(vec![ - ("x-arch-upstream", "api_server"), (":method", "POST"), - (":path", "/weather"), - (":authority", "api_server"), ("content-type", "application/json"), + ("x-arch-upstream", "api_server"), + (":authority", "api_server"), ("x-envoy-max-retries", "3"), + (":path", "/weather"), ]), - None, + Some(expected_body), None, None, ) @@ -401,13 +404,12 @@ fn prompt_gateway_request_to_llm_gateway() { .expect_get_buffer_bytes(Some(BufferType::HttpCallResponseBody)) .returning(Some(&body_text)) .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) + .expect_log(Some(LogLevel::Debug), None) + .expect_log(Some(LogLevel::Trace), None) + .expect_log(Some(LogLevel::Trace), None) .expect_get_header_map_value(Some(MapType::HttpCallResponseHeaders), Some(":status")) .returning(Some("200")) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Debug), None) .expect_set_buffer_bytes(Some(BufferType::HttpRequestBody), None) .execute_and_expect(ReturnType::None) .unwrap(); diff --git a/demos/insurance_agent/Dockerfile b/demos/insurance_agent/Dockerfile deleted file mode 100644 index 95855991..00000000 --- a/demos/insurance_agent/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM python:3 AS base - -FROM base AS builder - -WORKDIR /src - -COPY requirements.txt /src/ -RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt - -COPY . /src - -FROM python:3-slim AS output - -COPY --from=builder /runtime /usr/local - -COPY . /app -WORKDIR /app - -CMD ["uvicorn", "insurance_agent_main:app", "--host", "0.0.0.0", "--port", "80", "--log-level", "info"] diff --git a/demos/insurance_agent/README.md b/demos/insurance_agent/README.md deleted file mode 100644 index 46067173..00000000 --- a/demos/insurance_agent/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# Insurance Agent Demo - -This demo showcases how the **Arch** can be used to manage insurance-related tasks such as policy inquiries, initiating policies, and updating claims or deductibles. In this demo, the assistant provides factual information related to insurance policies (e.g., car, boat, house, motorcycle). - -The system can perform a variety of tasks, such as answering insurance-related questions, retrieving policy coverage details, initiating policies, and updating claims or deductibles. - -## Available Functions: - -- **Policy Q/A**: Handles general Q&A related to insurance policies. - - **Endpoint**: `/policy/qa` - - This function answers general inquiries related to insurance, such as coverage details or policy types. It is the default target for insurance-related queries. - -- **Get Policy Coverage**: Retrieves the coverage details for a given policy type (car, boat, house, motorcycle). - - **Endpoint**: `/policy/coverage` - - Parameters: - - `policy_type` (required): The type of policy. Available options: `car`, `boat`, `house`, `motorcycle`. Defaults to `car`. - -- **Initiate Policy**: Starts a policy coverage for car, boat, motorcycle, or house. - - **Endpoint**: `/policy/initiate` - - Parameters: - - `policy_type` (required): The type of policy. Available options: `car`, `boat`, `house`, `motorcycle`. Defaults to `car`. - - `deductible` (required): The deductible amount set for the policy. - -- **Update Claim**: Updates the notes on a specific insurance claim. - - **Endpoint**: `/policy/claim` - - Parameters: - - `claim_id` (required): The claim number. - - `notes` (optional): Notes about the claim number for the adjustor to see. - -- **Update Deductible**: Updates the deductible amount for a specific policy coverage. - - **Endpoint**: `/policy/deductible` - - Parameters: - - `policy_id` (required): The ID of the policy. - - `deductible` (required): The deductible amount to be set for the policy. - -**Arch** is designed to intelligently routes prompts to the appropriate functions based on the target, allowing for seamless interaction with various insurance-related services. - -# Starting the demo -1. Please make sure the [pre-requisites](https://github.com/katanemo/arch/?tab=readme-ov-file#prerequisites) are installed correctly -2. Start Arch - ```sh - sh run_demo.sh - ``` -3. Navigate to http://localhost:18080/ -4. Tell me what can you do for me?" - -# Observability -Arch gateway publishes stats endpoint at http://localhost:19901/stats. In this demo we are using prometheus to pull stats from arch and we are using grafana to visalize the stats in dashboard. To see grafana dashboard follow instructions below, - -1. Start grafana and prometheus using following command - ```yaml - docker compose --profile monitoring up - ``` -1. Navigate to http://localhost:3000/ to open grafana UI (use admin/grafana as credentials) -1. From grafana left nav click on dashboards and select "Intelligent Gateway Overview" to view arch gateway stats - -Here is sample interaction, -image diff --git a/demos/insurance_agent/arch_config.yaml b/demos/insurance_agent/arch_config.yaml deleted file mode 100644 index 9e5c6ed3..00000000 --- a/demos/insurance_agent/arch_config.yaml +++ /dev/null @@ -1,105 +0,0 @@ -version: v0.1 -listener: - address: 127.0.0.1 - port: 8080 #If you configure port 443, you'll need to update the listener with tls_certificates - message_format: huggingface - -system_prompt: | - You are an insurance assistant that just offers guidance related to car, boat, rental and home insurnace only. Please be pricese and summarize based on the context provided. - -llm_providers: - - name: OpenAI - provider_interface: openai - access_key: $OPENAI_API_KEY - model: gpt-4o - default: true - -# 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: host.docker.internal:18083 - # max time to wait for a connection to be established - connect_timeout: 0.05s - -prompt_targets: - - name: policy_qa - endpoint: - name: app_server - path: /policy/qa - http_method: POST - description: Handle general Q/A related to insurance. - default: true - - - name: get_policy_coverage - description: Retrieve the coverage details for an insurance policy. - endpoint: - name: app_server - path: /policy/coverage - http_method: POST - parameters: - - name: policy_type - type: str - description: The type of policy - default: car - required: true - - - name: initiate_policy - endpoint: - name: app_server - path: /policy/initiate - http_method: POST - description: Start a policy coverage for an insurance policy - parameters: - - name: policy_type - type: str - description: The type of policy - default: car - required: true - - name: deductible - type: float - description: the deductible amount set of the policy - required: true - - - name: update_claim - endpoint: - name: app_server - path: /policy/claim - http_method: POST - description: Update the notes on the claim - parameters: - - name: claim_id - type: str - description: the claim number - required: true - - name: notes - type: str - description: notes about the cliam number for your adjustor to see - required: false - - - name: update_deductible - endpoint: - name: app_server - path: /policy/deductible - http_method: POST - description: Update the deductible amount for a specific insurance policy coverage. - parameters: - - name: policy_id - type: str - description: The id of the insurance policy - required: true - - name: deductible - type: float - description: the deductible amount set of the policy - required: true - -ratelimits: - - model: gpt-4 - selector: - key: selector-key - value: selector-value - limit: - tokens: 1 - unit: minute diff --git a/demos/insurance_agent/insurance_agent_main.py b/demos/insurance_agent/insurance_agent_main.py deleted file mode 100644 index 3143342f..00000000 --- a/demos/insurance_agent/insurance_agent_main.py +++ /dev/null @@ -1,140 +0,0 @@ -from fastapi import FastAPI, HTTPException -from pydantic import BaseModel, Field - -app = FastAPI() - - -class Conversation(BaseModel): - arch_messages: list - - -class PolicyCoverageRequest(BaseModel): - policy_type: str = Field( - ..., - description="The type of a policy held by the customer For, e.g. car, boat, house, motorcycle)", - ) - - -class PolicyInitiateRequest(PolicyCoverageRequest): - deductible: float = Field( - ..., description="The deductible amount set of the policy" - ) - - -class ClaimUpdate(BaseModel): - claim_id: str - notes: str # Status or details of the claim - - -class DeductibleUpdate(BaseModel): - policy_id: str - deductible: float - - -class CoverageResponse(BaseModel): - policy_type: str - coverage: str # Description of coverage - premium: float # The premium cost - - -# Get information about policy coverage -@app.post("/policy/coverage", response_model=CoverageResponse) -async def get_policy_coverage(req: PolicyCoverageRequest): - """ - Retrieve the coverage details for a given policy type (car, boat, house, motorcycle). - """ - policy_coverage = { - "car": { - "coverage": "Full car coverage with collision, liability", - "premium": 500.0, - }, - "boat": { - "coverage": "Full boat coverage including theft and storm damage", - "premium": 700.0, - }, - "house": { - "coverage": "Full house coverage including fire, theft, flood", - "premium": 1000.0, - }, - "motorcycle": { - "coverage": "Full motorcycle coverage with liability", - "premium": 400.0, - }, - } - - if req.policy_type not in policy_coverage: - raise HTTPException(status_code=404, detail="Policy type not found") - - return CoverageResponse( - policy_type=req.policy_type, - coverage=policy_coverage[req.policy_type]["coverage"], - premium=policy_coverage[req.policy_type]["premium"], - ) - - -# Initiate policy coverage -@app.post("/policy/initiate") -async def initiate_policy(policy_request: PolicyInitiateRequest): - """ - Initiate policy coverage for a car, boat, house, or motorcycle. - """ - if policy_request.policy_type not in ["car", "boat", "house", "motorcycle"]: - raise HTTPException(status_code=400, detail="Invalid policy type") - - return { - "message": f"Policy initiated for {policy_request.policy_type}", - "deductible": policy_request.deductible, - } - - -# Update claim details -@app.post("/policy/claim") -async def update_claim(req: ClaimUpdate): - """ - Update the status or details of a claim. - """ - # For simplicity, this is a mock update response - return { - "message": f"Claim {claim_update.claim_id} for policy {claim_update.claim_id} has been updated", - "update": claim_update.notes, - } - - -# Update deductible amount -@app.post("/policy/deductible") -async def update_deductible(deductible_update: DeductibleUpdate): - """ - Update the deductible amount for a specific policy. - """ - # For simplicity, this is a mock update response - return { - "message": f"Deductible for policy {deductible_update.policy_id} has been updated", - "new_deductible": deductible_update.deductible, - } - - -# Post method for policy Q/A -@app.post("/policy/qa") -async def policy_qa(conversation: Conversation): - """ - This method handles Q/A related to general issues in insurance. - It forwards the conversation to the OpenAI client via a local proxy and returns the response. - """ - return { - "choices": [ - { - "message": { - "role": "assistant", - "content": "I am a helpful insurance agent, and can only help with insurance things", - }, - "finish_reason": "completed", - "index": 0, - } - ], - "model": "insurance_agent", - "usage": {"completion_tokens": 0}, - } - - -# Run the app using: -# uvicorn main:app --reload diff --git a/demos/insurance_agent/requirements.txt b/demos/insurance_agent/requirements.txt deleted file mode 100644 index 6703613f..00000000 --- a/demos/insurance_agent/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -fastapi -uvicorn -pydantic -openai diff --git a/demos/network_agent/grafana/dashboard.yaml b/demos/network_agent/grafana/dashboard.yaml deleted file mode 100644 index fd66a479..00000000 --- a/demos/network_agent/grafana/dashboard.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: 1 - -providers: - - name: "Dashboard provider" - orgId: 1 - type: file - disableDeletion: false - updateIntervalSeconds: 10 - allowUiUpdates: false - options: - path: /var/lib/grafana/dashboards - foldersFromFilesStructure: true diff --git a/demos/network_agent/grafana/dashboards/envoy_overview.json b/demos/network_agent/grafana/dashboards/envoy_overview.json deleted file mode 100644 index 51bff777..00000000 --- a/demos/network_agent/grafana/dashboards/envoy_overview.json +++ /dev/null @@ -1,355 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "avg(rate(envoy_cluster_internal_upstream_rq_time_sum[1m]) / rate(envoy_cluster_internal_upstream_rq_time_count[1m])) by (envoy_cluster_name)", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "request latency - internal (ms)", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 0 - }, - "id": 1, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "avg(rate(envoy_cluster_external_upstream_rq_time_sum[1m]) / rate(envoy_cluster_external_upstream_rq_time_count[1m])) by (envoy_cluster_name)", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "request latency - external (ms)", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 8 - }, - "id": 3, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "avg(rate(envoy_cluster_internal_upstream_rq_completed[1m])) by (envoy_cluster_name)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "avg(rate(envoy_cluster_external_upstream_rq_completed[1m])) by (envoy_cluster_name)", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "B", - "useBackend": false - } - ], - "title": "Upstream request count", - "type": "timeseries" - } - ], - "schemaVersion": 39, - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Intelligent Gateway Overview", - "uid": "adt6uhx5lk8aob", - "version": 3, - "weekStart": "" -} diff --git a/demos/network_agent/grafana/datasource.yaml b/demos/network_agent/grafana/datasource.yaml deleted file mode 100644 index 4870174e..00000000 --- a/demos/network_agent/grafana/datasource.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: 1 - -datasources: -- name: Prometheus - type: prometheus - url: http://prometheus:9090 - isDefault: true - access: proxy - editable: true diff --git a/demos/network_agent/utils.py b/demos/network_agent/utils.py deleted file mode 100644 index ed1be070..00000000 --- a/demos/network_agent/utils.py +++ /dev/null @@ -1,253 +0,0 @@ -import logging -import random -import re -import sqlite3 -from datetime import datetime, timedelta, timezone - -import pandas as pd -from dateparser import parse - -logging.basicConfig( - level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" -) -logger = logging.getLogger(__name__) - - -def loadsql(): - # Example Usage - conn = sqlite3.connect(":memory:") - - # create and load the devices table - device_data = generate_device_data(conn) - - # create and load the interface_stats table - generate_interface_stats_data(conn, device_data) - - # create and load the flow table - generate_flow_data(conn, device_data) - - return conn - - -# Function to convert natural language time expressions to "X {time} ago" format -def convert_to_ago_format(expression): - # Define patterns for different time units - time_units = { - r"seconds": "seconds", - r"minutes": "minutes", - r"mins": "mins", - r"hrs": "hrs", - r"hours": "hours", - r"hour": "hour", - r"hr": "hour", - r"days": "days", - r"day": "day", - r"weeks": "weeks", - r"week": "week", - r"months": "months", - r"month": "month", - r"years": "years", - r"yrs": "years", - r"year": "year", - r"yr": "year", - } - - # Iterate over each time unit and create regex for each phrase format - for pattern, unit in time_units.items(): - # Handle "for the past X {unit}" - match = re.search(rf"(\d+) {pattern}", expression) - if match: - quantity = match.group(1) - return f"{quantity} {unit} ago" - - # If the format is not recognized, return None or raise an error - return None - - -# Function to generate random MAC addresses -def random_mac(): - return "AA:BB:CC:DD:EE:" + ":".join( - [f"{random.randint(0, 255):02X}" for _ in range(2)] - ) - - -# Function to generate random IP addresses -def random_ip(): - return f"""{random.randint(1, 255)} - .{random.randint(1, 255)} - .{random.randint(1, 255)} - .{random.randint(1, 255)}""" - - -# Generate synthetic data for the device table -def generate_device_data( - conn, - n=1000, -): - device_data = { - "switchip": [random_ip() for _ in range(n)], - "hwsku": [f"HW{i+1}" for i in range(n)], - "hostname": [f"switch{i+1}" for i in range(n)], - "osversion": [f"v{i+1}" for i in range(n)], - "layer": ["L2" if i % 2 == 0 else "L3" for i in range(n)], - "region": [random.choice(["US", "EU", "ASIA"]) for _ in range(n)], - "uptime": [ - f"""{random.randint(0, 10)} days {random.randint(0, 23)} - :{random.randint(0, 59)}:{random.randint(0, 59)}""" - for _ in range(n) - ], - "device_mac_address": [random_mac() for _ in range(n)], - } - df = pd.DataFrame(device_data) - df.to_sql("device", conn, index=False) - return df - - -# Generate synthetic data for the interfacestats table -def generate_interface_stats_data(conn, device_df, n=1000): - interface_stats_data = [] - for _ in range(n): - device_mac = random.choice(device_df["device_mac_address"]) - ifname = random.choice(["eth0", "eth1", "eth2", "eth3"]) - time = datetime.now(timezone.utc) - timedelta( - minutes=random.randint(0, 1440 * 5) - ) # random timestamps in the past 5 day - in_discards = random.randint(0, 1000) - in_errors = random.randint(0, 500) - out_discards = random.randint(0, 800) - out_errors = random.randint(0, 400) - in_octets = random.randint(1000, 100000) - out_octets = random.randint(1000, 100000) - - interface_stats_data.append( - { - "device_mac_address": device_mac, - "ifname": ifname, - "time": time, - "in_discards": in_discards, - "in_errors": in_errors, - "out_discards": out_discards, - "out_errors": out_errors, - "in_octets": in_octets, - "out_octets": out_octets, - } - ) - df = pd.DataFrame(interface_stats_data) - df.to_sql("interfacestats", conn, index=False) - - -# Generate synthetic data for the ts_flow table -def generate_flow_data(conn, device_df, n=1000): - flow_data = [] - for _ in range(n): - sampler_address = random.choice(device_df["switchip"]) - proto = random.choice(["TCP", "UDP"]) - src_addr = random_ip() - dst_addr = random_ip() - src_port = random.randint(1024, 65535) - dst_port = random.randint(1024, 65535) - in_if = random.randint(1, 10) - out_if = random.randint(1, 10) - flow_start = int( - (datetime.now() - timedelta(days=random.randint(1, 30))).timestamp() - ) - flow_end = int( - (datetime.now() - timedelta(days=random.randint(1, 30))).timestamp() - ) - bytes_transferred = random.randint(1000, 100000) - packets = random.randint(1, 1000) - flow_time = datetime.now(timezone.utc) - timedelta( - minutes=random.randint(0, 1440 * 5) - ) # random flow time - - flow_data.append( - { - "sampler_address": sampler_address, - "proto": proto, - "src_addr": src_addr, - "dst_addr": dst_addr, - "src_port": src_port, - "dst_port": dst_port, - "in_if": in_if, - "out_if": out_if, - "flow_start": flow_start, - "flow_end": flow_end, - "bytes": bytes_transferred, - "packets": packets, - "time": flow_time, - } - ) - df = pd.DataFrame(flow_data) - df.to_sql("ts_flow", conn, index=False) - - -def load_params(req): - # Step 1: Convert the from_time natural language string to a timestamp if provided - if req.from_time: - # Use `dateparser` to parse natural language timeframes - logger.info("%s\n\nCaptured from time: %s\n\n", "* " * 50, req.from_time) - parsed_time = parse(req.from_time, settings={"RELATIVE_BASE": datetime.now()}) - if not parsed_time: - conv_time = convert_to_ago_format(req.from_time) - if conv_time: - parsed_time = parse( - conv_time, settings={"RELATIVE_BASE": datetime.now()} - ) - else: - return { - "error": """Invalid from_time format. Please provide a valid time description - such as 'past 7 days' or 'since last month'.""" - } - logger.info("\n\nConverted from time: %s\n\n%s\n\n", parsed_time, "* " * 50) - from_time = parsed_time - logger.info("Using parsed from_time: %f", from_time) - else: - # If no from_time is provided, use a default value (e.g., the past 7 days) - from_time = datetime.now() - timedelta(days=7) - logger.info("Using default from_time: %f", from_time) - - # Step 2: Build the dynamic SQL query based on the optional filters - filters = [] - params = {"from_time": from_time} - - if req.ifname: - filters.append("i.ifname = :ifname") - params["ifname"] = req.ifname - - if req.region: - filters.append("d.region = :region") - params["region"] = req.region - - if req.min_in_errors is not None: - filters.append("i.in_errors >= :min_in_errors") - params["min_in_errors"] = req.min_in_errors - - if req.max_in_errors is not None: - filters.append("i.in_errors <= :max_in_errors") - params["max_in_errors"] = req.max_in_errors - - if req.min_out_errors is not None: - filters.append("i.out_errors >= :min_out_errors") - params["min_out_errors"] = req.min_out_errors - - if req.max_out_errors is not None: - filters.append("i.out_errors <= :max_out_errors") - params["max_out_errors"] = req.max_out_errors - - if req.min_in_discards is not None: - filters.append("i.in_discards >= :min_in_discards") - params["min_in_discards"] = req.min_in_discards - - if req.max_in_discards is not None: - filters.append("i.in_discards <= :max_in_discards") - params["max_in_discards"] = req.max_in_discards - - if req.min_out_discards is not None: - filters.append("i.out_discards >= :min_out_discards") - params["min_out_discards"] = req.min_out_discards - - if req.max_out_discards is not None: - filters.append("i.out_discards <= :max_out_discards") - params["max_out_discards"] = req.max_out_discards - - return params, filters diff --git a/demos/samples_java/weather_forcecast_service/Dockerfile b/demos/samples_java/weather_forcecast_service/Dockerfile new file mode 100644 index 00000000..1f536c5a --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/Dockerfile @@ -0,0 +1,18 @@ +# Stage 1: Build the application using Maven +FROM maven:3.8.7-openjdk-18-slim AS build +WORKDIR /app +# Copy pom.xml and download dependencies first (caching) +COPY pom.xml . +RUN mvn dependency:go-offline +# Copy the source code and build the application +COPY src ./src +RUN mvn clean package -DskipTests + +# Stage 2: Run the application using a slim JDK image +FROM openjdk:17-jdk-slim +WORKDIR /app +# Copy the built jar from the previous stage +COPY --from=build /app/target/weather-forecast-service-0.0.1-SNAPSHOT.jar app.jar +# Expose the port on which the app runs (default Spring Boot is 8080) +EXPOSE 8081 +ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/demos/samples_java/weather_forcecast_service/arch_config.yaml b/demos/samples_java/weather_forcecast_service/arch_config.yaml new file mode 100644 index 00000000..10c22819 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/arch_config.yaml @@ -0,0 +1,45 @@ +version: v0.1 +listener: + address: 127.0.0.1 + port: 10000 #If you configure port 443, you'll need to update the listener with tls_certificates + message_format: huggingface + +# Centralized way to manage LLMs, manage keys, retry logic, failover and limits in a central way +llm_providers: + - name: OpenAI + provider_interface: openai + access_key: $OPENAI_API_KEY + model: gpt-4o-mini + default: true + +# Arch creates a round-robin load balancing between different endpoints, managed via the cluster subsystem. +endpoints: + weather_forecast_service: + # 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: host.docker.internal:18081 + # max time to wait for a connection to be established + connect_timeout: 0.005s + +# default system prompt used by all prompt targets +system_prompt: | + You are a helpful weather assistant. + +prompt_targets: + - name: weather_forecast + description: get the weather forecast + parameters: + - name: location + description: the location for which to get the weather forecast + required: true + type: string + format: City, State + - name: days + description: the number of days for the forecast + required: true + type: int + endpoint: + name: weather_forecast_service + path: /weather + http_method: POST diff --git a/demos/insurance_agent/docker-compose.yaml b/demos/samples_java/weather_forcecast_service/docker-compose.yaml similarity index 66% rename from demos/insurance_agent/docker-compose.yaml rename to demos/samples_java/weather_forcecast_service/docker-compose.yaml index a4bd27bd..998800b7 100644 --- a/demos/insurance_agent/docker-compose.yaml +++ b/demos/samples_java/weather_forcecast_service/docker-compose.yaml @@ -1,18 +1,14 @@ services: - api_server: + weather_forecast_service: build: context: . dockerfile: Dockerfile ports: - - "18083:80" - healthcheck: - test: ["CMD", "curl" ,"http://localhost:80/healthz"] - interval: 5s - retries: 20 + - "18081:8081" chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui dockerfile: Dockerfile ports: - "18080:8080" diff --git a/demos/samples_java/weather_forcecast_service/pom.xml b/demos/samples_java/weather_forcecast_service/pom.xml new file mode 100644 index 00000000..c2fed928 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/pom.xml @@ -0,0 +1,40 @@ + + 4.0.0 + + weather + weather-forecast-service + 0.0.1-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 2.7.10 + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/demos/currency_exchange/run_demo.sh b/demos/samples_java/weather_forcecast_service/run_demo.sh similarity index 100% rename from demos/currency_exchange/run_demo.sh rename to demos/samples_java/weather_forcecast_service/run_demo.sh diff --git a/demos/samples_java/weather_forcecast_service/src/main/java/weather/WeatherForecastApplication.java b/demos/samples_java/weather_forcecast_service/src/main/java/weather/WeatherForecastApplication.java new file mode 100644 index 00000000..b31a3444 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/src/main/java/weather/WeatherForecastApplication.java @@ -0,0 +1,12 @@ +// File: src/main/java/com/example/weather/WeatherForecastApplication.java +package weather; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WeatherForecastApplication { + public static void main(String[] args) { + SpringApplication.run(WeatherForecastApplication.class, args); + } +} diff --git a/demos/samples_java/weather_forcecast_service/src/main/java/weather/controller/WeatherController.java b/demos/samples_java/weather_forcecast_service/src/main/java/weather/controller/WeatherController.java new file mode 100644 index 00000000..bb41227a --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/src/main/java/weather/controller/WeatherController.java @@ -0,0 +1,54 @@ +package weather.controller; + +import weather.model.DayForecast; +import weather.model.WeatherForecastResponse; +import weather.model.WeatherRequest; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.time.Instant; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +@RestController +public class WeatherController { + + private Random random = new Random(); + + @PostMapping("/weather") + public WeatherForecastResponse getRandomWeatherForecast(@RequestBody WeatherRequest req) { + WeatherForecastResponse response = new WeatherForecastResponse(); + response.setLocation(req.getLocation()); + response.setUnits(req.getUnits()); + + List forecasts = new ArrayList<>(); + for (int i = 0; i < req.getDays(); i++) { + // Generate a random min temperature between 50 and 89 (inclusive) + int minTemp = random.nextInt(90 - 50) + 50; + // Generate a max temperature between (minTemp + 5) and (minTemp + 19) + int maxTemp = random.nextInt(15) + (minTemp + 5); + + double finalMinTemp = minTemp; + double finalMaxTemp = maxTemp; + + // Convert to Celsius if necessary + if (req.getUnits().equalsIgnoreCase("celsius") || req.getUnits().equalsIgnoreCase("c")) { + finalMinTemp = (minTemp - 32) * 5.0 / 9.0; + finalMaxTemp = (maxTemp - 32) * 5.0 / 9.0; + } + + DayForecast dayForecast = new DayForecast(); + dayForecast.setDate(LocalDate.now().plusDays(i).toString()); + dayForecast.setMin(finalMinTemp); + dayForecast.setMax(finalMaxTemp); + dayForecast.setUnits(req.getUnits()); + + forecasts.add(dayForecast); + } + response.setDailyForecast(forecasts); + return response; + } +} diff --git a/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/DayForecast.java b/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/DayForecast.java new file mode 100644 index 00000000..0077a3a7 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/DayForecast.java @@ -0,0 +1,40 @@ +package weather.model; + +public class DayForecast { + private String date; + private String units; + private double min; + private double max; + + public DayForecast() {} + + // Getters and setters + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getUnits() { + return units; + } + + public void setUnits(String units) { + this.units = units; + } + + public double getMin() { + return min; + } + public void setMin(double min) { + this.min = min; + } + public double getMax() { + return max; + } + public void setMax(double max) { + this.max = max; + } +} diff --git a/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/WeatherForecastResponse.java b/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/WeatherForecastResponse.java new file mode 100644 index 00000000..3fc4d116 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/WeatherForecastResponse.java @@ -0,0 +1,37 @@ +package weather.model; + +import java.util.List; + +public class WeatherForecastResponse { + private String location; + private String units; + private List forecast; + + // Default Constructor + public WeatherForecastResponse() {} + + // Getters and Setters + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getUnits() { + return units; + } + + public void setUnits(String units) { + this.units = units; + } + + public List getDailyForecast() { + return forecast; + } + + public void setDailyForecast(List forecast) { + this.forecast = forecast; + } +} diff --git a/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/WeatherRequest.java b/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/WeatherRequest.java new file mode 100644 index 00000000..8b5e1340 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/src/main/java/weather/model/WeatherRequest.java @@ -0,0 +1,29 @@ +package weather.model; + +public class WeatherRequest { + private String location; + private int days = 7; + private String units = "Farenheit"; + + public WeatherRequest() {} + + // Getters and setters + public String getLocation() { + return location; + } + public void setLocation(String location) { + this.location = location; + } + public int getDays() { + return days; + } + public void setDays(int days) { + this.days = days; + } + public String getUnits() { + return units; + } + public void setUnits(String units) { + this.units = units; + } +} diff --git a/demos/samples_java/weather_forcecast_service/src/main/resources/application.properties b/demos/samples_java/weather_forcecast_service/src/main/resources/application.properties new file mode 100644 index 00000000..4d360de1 --- /dev/null +++ b/demos/samples_java/weather_forcecast_service/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=8081 diff --git a/demos/currency_exchange/README.md b/demos/samples_python/currency_exchange/README.md similarity index 100% rename from demos/currency_exchange/README.md rename to demos/samples_python/currency_exchange/README.md diff --git a/demos/currency_exchange/arch_config.yaml b/demos/samples_python/currency_exchange/arch_config.yaml similarity index 92% rename from demos/currency_exchange/arch_config.yaml rename to demos/samples_python/currency_exchange/arch_config.yaml index f8776c48..89a9e65b 100644 --- a/demos/currency_exchange/arch_config.yaml +++ b/demos/samples_python/currency_exchange/arch_config.yaml @@ -12,6 +12,11 @@ llm_providers: provider_interface: openai model: gpt-4o +endpoints: + frankfurther_api: + endpoint: api.frankfurter.dev + protocol: https + system_prompt: | You are a helpful assistant. @@ -26,7 +31,7 @@ prompt_targets: description: Get currency exchange rate from USD to other currencies parameters: - name: currency_symbol - description: the currency that needs conversion + description: currency symbol to convert from USD required: true type: str in_path: true @@ -42,11 +47,6 @@ prompt_targets: name: frankfurther_api path: /v1/currencies -endpoints: - frankfurther_api: - endpoint: api.frankfurter.dev:443 - protocol: https - tracing: random_sampling: 100 trace_arch_internal: true diff --git a/demos/currency_exchange_ollama/docker-compose.yaml b/demos/samples_python/currency_exchange/docker-compose.yaml similarity index 86% rename from demos/currency_exchange_ollama/docker-compose.yaml rename to demos/samples_python/currency_exchange/docker-compose.yaml index 32e52c40..ee5465a5 100644 --- a/demos/currency_exchange_ollama/docker-compose.yaml +++ b/demos/samples_python/currency_exchange/docker-compose.yaml @@ -1,7 +1,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -14,7 +14,7 @@ services: jaeger: build: - context: ../shared/jaeger + context: ../../shared/jaeger ports: - "16686:16686" - "4317:4317" diff --git a/demos/currency_exchange_ollama/run_demo.sh b/demos/samples_python/currency_exchange/run_demo.sh similarity index 100% rename from demos/currency_exchange_ollama/run_demo.sh rename to demos/samples_python/currency_exchange/run_demo.sh diff --git a/demos/currency_exchange/test_data.yaml b/demos/samples_python/currency_exchange/test_data.yaml similarity index 100% rename from demos/currency_exchange/test_data.yaml rename to demos/samples_python/currency_exchange/test_data.yaml diff --git a/demos/hr_agent/Dockerfile b/demos/samples_python/human_resources_agent/Dockerfile similarity index 100% rename from demos/hr_agent/Dockerfile rename to demos/samples_python/human_resources_agent/Dockerfile diff --git a/demos/hr_agent/README.md b/demos/samples_python/human_resources_agent/README.md similarity index 100% rename from demos/hr_agent/README.md rename to demos/samples_python/human_resources_agent/README.md diff --git a/demos/hr_agent/arch_config.yaml b/demos/samples_python/human_resources_agent/arch_config.yaml similarity index 100% rename from demos/hr_agent/arch_config.yaml rename to demos/samples_python/human_resources_agent/arch_config.yaml diff --git a/demos/hr_agent/docker-compose.yaml b/demos/samples_python/human_resources_agent/docker-compose.yaml similarity index 89% rename from demos/hr_agent/docker-compose.yaml rename to demos/samples_python/human_resources_agent/docker-compose.yaml index 61c710a2..f1afe6f4 100644 --- a/demos/hr_agent/docker-compose.yaml +++ b/demos/samples_python/human_resources_agent/docker-compose.yaml @@ -8,7 +8,6 @@ services: - CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1 volumes: - ./arch_config.yaml:/app/arch_config.yaml - - ../shared/chatbot_ui/common.py:/app/common.py ports: - "18080:80" healthcheck: @@ -18,7 +17,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui dockerfile: Dockerfile ports: - "18080:8080" diff --git a/demos/hr_agent/image.png b/demos/samples_python/human_resources_agent/image.png similarity index 100% rename from demos/hr_agent/image.png rename to demos/samples_python/human_resources_agent/image.png diff --git a/demos/hr_agent/main.py b/demos/samples_python/human_resources_agent/main.py similarity index 100% rename from demos/hr_agent/main.py rename to demos/samples_python/human_resources_agent/main.py diff --git a/demos/hr_agent/requirements.txt b/demos/samples_python/human_resources_agent/requirements.txt similarity index 100% rename from demos/hr_agent/requirements.txt rename to demos/samples_python/human_resources_agent/requirements.txt diff --git a/demos/hr_agent/run_demo.sh b/demos/samples_python/human_resources_agent/run_demo.sh similarity index 100% rename from demos/hr_agent/run_demo.sh rename to demos/samples_python/human_resources_agent/run_demo.sh diff --git a/demos/hr_agent/test_data.yaml b/demos/samples_python/human_resources_agent/test_data.yaml similarity index 100% rename from demos/hr_agent/test_data.yaml rename to demos/samples_python/human_resources_agent/test_data.yaml diff --git a/demos/hr_agent/workforce_data.json b/demos/samples_python/human_resources_agent/workforce_data.json similarity index 100% rename from demos/hr_agent/workforce_data.json rename to demos/samples_python/human_resources_agent/workforce_data.json diff --git a/demos/multi_turn_rag_agent/Dockerfile b/demos/samples_python/multi_turn_rag_agent/Dockerfile similarity index 100% rename from demos/multi_turn_rag_agent/Dockerfile rename to demos/samples_python/multi_turn_rag_agent/Dockerfile diff --git a/demos/multi_turn_rag_agent/README.md b/demos/samples_python/multi_turn_rag_agent/README.md similarity index 100% rename from demos/multi_turn_rag_agent/README.md rename to demos/samples_python/multi_turn_rag_agent/README.md diff --git a/demos/multi_turn_rag_agent/arch_config.yaml b/demos/samples_python/multi_turn_rag_agent/arch_config.yaml similarity index 100% rename from demos/multi_turn_rag_agent/arch_config.yaml rename to demos/samples_python/multi_turn_rag_agent/arch_config.yaml diff --git a/demos/multi_turn_rag_agent/docker-compose.yaml b/demos/samples_python/multi_turn_rag_agent/docker-compose.yaml similarity index 93% rename from demos/multi_turn_rag_agent/docker-compose.yaml rename to demos/samples_python/multi_turn_rag_agent/docker-compose.yaml index 3bc8fc40..0bcbdbfd 100644 --- a/demos/multi_turn_rag_agent/docker-compose.yaml +++ b/demos/samples_python/multi_turn_rag_agent/docker-compose.yaml @@ -12,7 +12,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui dockerfile: Dockerfile ports: - "18080:8080" diff --git a/demos/multi_turn_rag_agent/main.py b/demos/samples_python/multi_turn_rag_agent/main.py similarity index 100% rename from demos/multi_turn_rag_agent/main.py rename to demos/samples_python/multi_turn_rag_agent/main.py diff --git a/demos/multi_turn_rag_agent/mutli-turn-example.png b/demos/samples_python/multi_turn_rag_agent/mutli-turn-example.png similarity index 100% rename from demos/multi_turn_rag_agent/mutli-turn-example.png rename to demos/samples_python/multi_turn_rag_agent/mutli-turn-example.png diff --git a/demos/multi_turn_rag_agent/requirements.txt b/demos/samples_python/multi_turn_rag_agent/requirements.txt similarity index 100% rename from demos/multi_turn_rag_agent/requirements.txt rename to demos/samples_python/multi_turn_rag_agent/requirements.txt diff --git a/demos/multi_turn_rag_agent/run_demo.sh b/demos/samples_python/multi_turn_rag_agent/run_demo.sh similarity index 100% rename from demos/multi_turn_rag_agent/run_demo.sh rename to demos/samples_python/multi_turn_rag_agent/run_demo.sh diff --git a/demos/network_agent/Dockerfile b/demos/samples_python/network_switch_operator_agent/Dockerfile similarity index 91% rename from demos/network_agent/Dockerfile rename to demos/samples_python/network_switch_operator_agent/Dockerfile index d54fa746..96600b38 100644 --- a/demos/network_agent/Dockerfile +++ b/demos/samples_python/network_switch_operator_agent/Dockerfile @@ -7,13 +7,13 @@ WORKDIR /src COPY requirements.txt /src/ RUN pip install --prefix=/runtime --force-reinstall -r requirements.txt -COPY . /src +COPY ../. /src FROM python:3.12-slim AS output COPY --from=builder /runtime /usr/local -COPY . /app +COPY ../. /app WORKDIR /app CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80", "--log-level", "info"] diff --git a/demos/network_agent/README.md b/demos/samples_python/network_switch_operator_agent/README.md similarity index 100% rename from demos/network_agent/README.md rename to demos/samples_python/network_switch_operator_agent/README.md diff --git a/demos/network_agent/arch_config.yaml b/demos/samples_python/network_switch_operator_agent/arch_config.yaml similarity index 100% rename from demos/network_agent/arch_config.yaml rename to demos/samples_python/network_switch_operator_agent/arch_config.yaml diff --git a/demos/network_agent/docker-compose.yaml b/demos/samples_python/network_switch_operator_agent/docker-compose.yaml similarity index 91% rename from demos/network_agent/docker-compose.yaml rename to demos/samples_python/network_switch_operator_agent/docker-compose.yaml index f8235331..90b5c084 100644 --- a/demos/network_agent/docker-compose.yaml +++ b/demos/samples_python/network_switch_operator_agent/docker-compose.yaml @@ -8,7 +8,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui dockerfile: Dockerfile ports: - "18080:8080" diff --git a/demos/network_agent/image.png b/demos/samples_python/network_switch_operator_agent/image.png similarity index 100% rename from demos/network_agent/image.png rename to demos/samples_python/network_switch_operator_agent/image.png diff --git a/demos/network_agent/main.py b/demos/samples_python/network_switch_operator_agent/main.py similarity index 100% rename from demos/network_agent/main.py rename to demos/samples_python/network_switch_operator_agent/main.py diff --git a/demos/network_agent/requirements.txt b/demos/samples_python/network_switch_operator_agent/requirements.txt similarity index 100% rename from demos/network_agent/requirements.txt rename to demos/samples_python/network_switch_operator_agent/requirements.txt diff --git a/demos/network_agent/run_demo.sh b/demos/samples_python/network_switch_operator_agent/run_demo.sh similarity index 99% rename from demos/network_agent/run_demo.sh rename to demos/samples_python/network_switch_operator_agent/run_demo.sh index e6c678e8..6995e7d0 100644 --- a/demos/network_agent/run_demo.sh +++ b/demos/samples_python/network_switch_operator_agent/run_demo.sh @@ -24,6 +24,7 @@ start_demo() { # Step 4: Start Network Agent echo "Starting Network Agent using Docker Compose..." + cd build docker compose up -d # Run in detached mode } diff --git a/demos/samples_python/stock_quote/README.md b/demos/samples_python/stock_quote/README.md new file mode 100644 index 00000000..885bdd5d --- /dev/null +++ b/demos/samples_python/stock_quote/README.md @@ -0,0 +1,9 @@ +This demo shows how you can use a publicly hosted rest api that is protected by an access key. + +Before you start the demo make sure you set `OPENAI_API_KEY` and `TWELVEDATA_API_KEY`. + +To get `TWELVEDATA_API_KEY` please head over to https://twelvedata.com/. + +Following screenshot shows interaction with stock quote demo, + +![alt text](stock_quote_demo.png) diff --git a/demos/samples_python/stock_quote/arch_config.yaml b/demos/samples_python/stock_quote/arch_config.yaml new file mode 100644 index 00000000..c763d4ca --- /dev/null +++ b/demos/samples_python/stock_quote/arch_config.yaml @@ -0,0 +1,69 @@ +version: v0.1 + +listener: + address: 0.0.0.0 + port: 10000 + message_format: huggingface + connect_timeout: 0.005s + +llm_providers: + - name: gpt-4o + access_key: $OPENAI_API_KEY + provider_interface: openai + model: gpt-4o + +endpoints: + twelvedata_api: + endpoint: api.twelvedata.com + protocol: https + +system_prompt: | + You are a helpful assistant. + +prompt_guards: + input_guards: + jailbreak: + on_exception: + message: Looks like you're curious about my abilities, but I can only provide assistance for currency exchange. + +prompt_targets: + - name: stock_quote + description: get current stock exchange rate for a given symbol + parameters: + - name: symbol + description: Stock symbol + required: true + type: str + endpoint: + name: twelvedata_api + path: /quote + http_headers: + Authorization: "apikey $TWELVEDATA_API_KEY" + system_prompt: | + You are a helpful stock exchange assistant. You are given stock symbol along with its exchange rate in json format. Your task is to parse the data and present it in a human-readable format. Keep the details to highlevel and be concise. + + - name: stock_quote_time_series + description: get historical stock exchange rate for a given symbol + parameters: + - name: symbol + description: Stock symbol + required: true + type: str + - name: interval + description: Time interval + default: 1day + enum: + - 1h + - 1day + type: str + endpoint: + name: twelvedata_api + path: /time_series + http_headers: + Authorization: "apikey $TWELVEDATA_API_KEY" + system_prompt: | + You are a helpful stock exchange assistant. You are given stock symbol along with its historical data in json format. Your task is to parse the data and present it in a human-readable format. Keep the details to highlevel only and be concise. + +tracing: + random_sampling: 100 + trace_arch_internal: true diff --git a/demos/samples_python/stock_quote/docker-compose.yaml b/demos/samples_python/stock_quote/docker-compose.yaml new file mode 100644 index 00000000..a862224a --- /dev/null +++ b/demos/samples_python/stock_quote/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + chatbot_ui: + build: + context: ../../shared/chatbot_ui + ports: + - "18080:8080" + environment: + # this is only because we are running the sample app in the same docker container environment as archgw + - CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1 + extra_hosts: + - "host.docker.internal:host-gateway" + volumes: + - ./arch_config.yaml:/app/arch_config.yaml + + jaeger: + build: + context: ../../shared/jaeger + ports: + - "16686:16686" + - "4317:4317" + - "4318:4318" diff --git a/demos/insurance_agent/run_demo.sh b/demos/samples_python/stock_quote/run_demo.sh similarity index 96% rename from demos/insurance_agent/run_demo.sh rename to demos/samples_python/stock_quote/run_demo.sh index e6c678e8..eb47dce6 100644 --- a/demos/insurance_agent/run_demo.sh +++ b/demos/samples_python/stock_quote/run_demo.sh @@ -22,7 +22,7 @@ start_demo() { echo "Starting Arch with arch_config.yaml..." archgw up arch_config.yaml - # Step 4: Start Network Agent + # Step 4: Start developer services echo "Starting Network Agent using Docker Compose..." docker compose up -d # Run in detached mode } diff --git a/demos/samples_python/stock_quote/stock_quote_demo.png b/demos/samples_python/stock_quote/stock_quote_demo.png new file mode 100644 index 00000000..abb70aa2 Binary files /dev/null and b/demos/samples_python/stock_quote/stock_quote_demo.png differ diff --git a/demos/weather_forecast/Dockerfile b/demos/samples_python/weather_forecast/Dockerfile similarity index 100% rename from demos/weather_forecast/Dockerfile rename to demos/samples_python/weather_forecast/Dockerfile diff --git a/demos/weather_forecast/README.md b/demos/samples_python/weather_forecast/README.md similarity index 100% rename from demos/weather_forecast/README.md rename to demos/samples_python/weather_forecast/README.md diff --git a/demos/weather_forecast/arch_config.yaml b/demos/samples_python/weather_forecast/arch_config.yaml similarity index 100% rename from demos/weather_forecast/arch_config.yaml rename to demos/samples_python/weather_forecast/arch_config.yaml diff --git a/demos/weather_forecast/docker-compose-honeycomb.yaml b/demos/samples_python/weather_forecast/docker-compose-honeycomb.yaml similarity index 77% rename from demos/weather_forecast/docker-compose-honeycomb.yaml rename to demos/samples_python/weather_forecast/docker-compose-honeycomb.yaml index 9f81fa69..5b1612e6 100644 --- a/demos/weather_forecast/docker-compose-honeycomb.yaml +++ b/demos/samples_python/weather_forecast/docker-compose-honeycomb.yaml @@ -11,7 +11,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -24,12 +24,12 @@ services: otel-collector: build: - context: ../shared/honeycomb/ + context: ../../shared/honeycomb/ ports: - "4317:4317" - "4318:4318" volumes: - - ../shared/honeycomb/otel-collector-config.yaml:/etc/otel-collector-config.yaml + - ../../shared/honeycomb/otel-collector-config.yaml:/etc/otel-collector-config.yaml env_file: - .env environment: @@ -37,10 +37,10 @@ services: prometheus: build: - context: ../shared/prometheus + context: ../../shared/prometheus grafana: build: - context: ../shared/grafana + context: ../../shared/grafana ports: - "3000:3000" diff --git a/demos/weather_forecast/docker-compose-jaeger.yaml b/demos/samples_python/weather_forecast/docker-compose-jaeger.yaml similarity index 83% rename from demos/weather_forecast/docker-compose-jaeger.yaml rename to demos/samples_python/weather_forecast/docker-compose-jaeger.yaml index 15441de3..dab610bf 100644 --- a/demos/weather_forecast/docker-compose-jaeger.yaml +++ b/demos/samples_python/weather_forecast/docker-compose-jaeger.yaml @@ -11,7 +11,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -24,7 +24,7 @@ services: jaeger: build: - context: ../shared/jaeger + context: ../../shared/jaeger ports: - "16686:16686" - "4317:4317" @@ -32,10 +32,10 @@ services: prometheus: build: - context: ../shared/prometheus + context: ../../shared/prometheus grafana: build: - context: ../shared/grafana + context: ../../shared/grafana ports: - "3000:3000" diff --git a/demos/weather_forecast/docker-compose-logfire.yaml b/demos/samples_python/weather_forecast/docker-compose-logfire.yaml similarity index 77% rename from demos/weather_forecast/docker-compose-logfire.yaml rename to demos/samples_python/weather_forecast/docker-compose-logfire.yaml index 6f747cd0..164862c2 100644 --- a/demos/weather_forecast/docker-compose-logfire.yaml +++ b/demos/samples_python/weather_forecast/docker-compose-logfire.yaml @@ -11,7 +11,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -24,12 +24,12 @@ services: otel-collector: build: - context: ../shared/logfire/ + context: ../../shared/logfire/ ports: - "4317:4317" - "4318:4318" volumes: - - ../shared/logfire/otel-collector-config.yaml:/etc/otel-collector-config.yaml + - ../../shared/logfire/otel-collector-config.yaml:/etc/otel-collector-config.yaml env_file: - .env environment: @@ -37,10 +37,10 @@ services: prometheus: build: - context: ../shared/prometheus + context: ../../shared/prometheus grafana: build: - context: ../shared/grafana + context: ../../shared/grafana ports: - "3000:3000" diff --git a/demos/weather_forecast/docker-compose-signoz.yaml b/demos/samples_python/weather_forecast/docker-compose-signoz.yaml similarity index 80% rename from demos/weather_forecast/docker-compose-signoz.yaml rename to demos/samples_python/weather_forecast/docker-compose-signoz.yaml index 392debfb..a40d32f0 100644 --- a/demos/weather_forecast/docker-compose-signoz.yaml +++ b/demos/samples_python/weather_forecast/docker-compose-signoz.yaml @@ -1,5 +1,5 @@ include: - - ../shared/signoz/docker-compose-minimal.yaml + - ../../shared/signoz/docker-compose-minimal.yaml services: weather_forecast_service: @@ -14,7 +14,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -27,10 +27,10 @@ services: prometheus: build: - context: ../shared/prometheus + context: ../../shared/prometheus grafana: build: - context: ../shared/grafana + context: ../../shared/grafana ports: - "3000:3000" diff --git a/demos/weather_forecast/docker-compose.yaml b/demos/samples_python/weather_forecast/docker-compose.yaml similarity index 58% rename from demos/weather_forecast/docker-compose.yaml rename to demos/samples_python/weather_forecast/docker-compose.yaml index 15441de3..566dfa8d 100644 --- a/demos/weather_forecast/docker-compose.yaml +++ b/demos/samples_python/weather_forecast/docker-compose.yaml @@ -11,7 +11,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -19,23 +19,3 @@ services: - CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1 extra_hosts: - "host.docker.internal:host-gateway" - volumes: - - ./arch_config.yaml:/app/arch_config.yaml - - jaeger: - build: - context: ../shared/jaeger - ports: - - "16686:16686" - - "4317:4317" - - "4318:4318" - - prometheus: - build: - context: ../shared/prometheus - - grafana: - build: - context: ../shared/grafana - ports: - - "3000:3000" diff --git a/demos/weather_forecast/main.py b/demos/samples_python/weather_forecast/main.py similarity index 100% rename from demos/weather_forecast/main.py rename to demos/samples_python/weather_forecast/main.py diff --git a/demos/weather_forecast/poetry.lock b/demos/samples_python/weather_forecast/poetry.lock similarity index 100% rename from demos/weather_forecast/poetry.lock rename to demos/samples_python/weather_forecast/poetry.lock diff --git a/demos/weather_forecast/pyproject.toml b/demos/samples_python/weather_forecast/pyproject.toml similarity index 100% rename from demos/weather_forecast/pyproject.toml rename to demos/samples_python/weather_forecast/pyproject.toml diff --git a/demos/weather_forecast/run_demo.sh b/demos/samples_python/weather_forecast/run_demo.sh similarity index 100% rename from demos/weather_forecast/run_demo.sh rename to demos/samples_python/weather_forecast/run_demo.sh diff --git a/demos/test_runner/common.py b/demos/shared/test_runner/common.py similarity index 100% rename from demos/test_runner/common.py rename to demos/shared/test_runner/common.py diff --git a/demos/test_runner/poetry.lock b/demos/shared/test_runner/poetry.lock similarity index 100% rename from demos/test_runner/poetry.lock rename to demos/shared/test_runner/poetry.lock diff --git a/demos/test_runner/pyproject.toml b/demos/shared/test_runner/pyproject.toml similarity index 100% rename from demos/test_runner/pyproject.toml rename to demos/shared/test_runner/pyproject.toml diff --git a/demos/test_runner/run_demo_tests.sh b/demos/shared/test_runner/run_demo_tests.sh similarity index 62% rename from demos/test_runner/run_demo_tests.sh rename to demos/shared/test_runner/run_demo_tests.sh index 2f7a7ae6..a029345f 100644 --- a/demos/test_runner/run_demo_tests.sh +++ b/demos/shared/test_runner/run_demo_tests.sh @@ -7,13 +7,13 @@ do echo "******************************************" echo "Running tests for $demo ..." echo "****************************************" - cd ../$demo + cd ../../samples_python/$demo archgw up arch_config.yaml docker compose up -d - cd ../test_runner - TEST_DATA=../$demo/test_data.yaml poetry run pytest - cd ../$demo + cd ../../shared/test_runner + TEST_DATA=../../samples_python/$demo/test_data.yaml poetry run pytest + cd ../../samples_python/$demo archgw down docker compose down -v - cd ../test_runner + cd ../../shared/test_runner done diff --git a/demos/test_runner/test_demos.py b/demos/shared/test_runner/test_demos.py similarity index 100% rename from demos/test_runner/test_demos.py rename to demos/shared/test_runner/test_demos.py diff --git a/demos/llm_routing/README.md b/demos/use_cases/llm_routing/README.md similarity index 98% rename from demos/llm_routing/README.md rename to demos/use_cases/llm_routing/README.md index 8418b7f8..08c06dc4 100644 --- a/demos/llm_routing/README.md +++ b/demos/use_cases/llm_routing/README.md @@ -1,5 +1,5 @@ # LLM Routing -This demo shows how you can arch gateway to manage keys and route to appropriate LLM. +This demo shows how you can arch gateway to manage keys and route to upstream LLM. # Starting the demo 1. Please make sure the [pre-requisites](https://github.com/katanemo/arch/?tab=readme-ov-file#prerequisites) are installed correctly diff --git a/demos/llm_routing/arch_config.yaml b/demos/use_cases/llm_routing/arch_config.yaml similarity index 100% rename from demos/llm_routing/arch_config.yaml rename to demos/use_cases/llm_routing/arch_config.yaml diff --git a/demos/llm_routing/docker-compose.yaml b/demos/use_cases/llm_routing/docker-compose.yaml similarity index 76% rename from demos/llm_routing/docker-compose.yaml rename to demos/use_cases/llm_routing/docker-compose.yaml index ac59499c..c2d794c6 100644 --- a/demos/llm_routing/docker-compose.yaml +++ b/demos/use_cases/llm_routing/docker-compose.yaml @@ -2,7 +2,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui dockerfile: Dockerfile ports: - "18080:8080" @@ -15,7 +15,7 @@ services: jaeger: build: - context: ../shared/jaeger + context: ../../shared/jaeger ports: - "16686:16686" - "4317:4317" @@ -23,10 +23,10 @@ services: prometheus: build: - context: ../shared/prometheus + context: ../../shared/prometheus grafana: build: - context: ../shared/grafana + context: ../../shared/grafana ports: - "3000:3000" diff --git a/demos/llm_routing/jaeger_tracing_llm_routing.png b/demos/use_cases/llm_routing/jaeger_tracing_llm_routing.png similarity index 100% rename from demos/llm_routing/jaeger_tracing_llm_routing.png rename to demos/use_cases/llm_routing/jaeger_tracing_llm_routing.png diff --git a/demos/llm_routing/llm_routing_demo.png b/demos/use_cases/llm_routing/llm_routing_demo.png similarity index 100% rename from demos/llm_routing/llm_routing_demo.png rename to demos/use_cases/llm_routing/llm_routing_demo.png diff --git a/demos/llm_routing/run_demo.sh b/demos/use_cases/llm_routing/run_demo.sh similarity index 100% rename from demos/llm_routing/run_demo.sh rename to demos/use_cases/llm_routing/run_demo.sh diff --git a/demos/currency_exchange_ollama/README.md b/demos/use_cases/ollama/README.md similarity index 100% rename from demos/currency_exchange_ollama/README.md rename to demos/use_cases/ollama/README.md diff --git a/demos/currency_exchange_ollama/arch_config.yaml b/demos/use_cases/ollama/arch_config.yaml similarity index 100% rename from demos/currency_exchange_ollama/arch_config.yaml rename to demos/use_cases/ollama/arch_config.yaml diff --git a/demos/currency_exchange/docker-compose.yaml b/demos/use_cases/ollama/docker-compose.yaml similarity index 86% rename from demos/currency_exchange/docker-compose.yaml rename to demos/use_cases/ollama/docker-compose.yaml index 32e52c40..ee5465a5 100644 --- a/demos/currency_exchange/docker-compose.yaml +++ b/demos/use_cases/ollama/docker-compose.yaml @@ -1,7 +1,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -14,7 +14,7 @@ services: jaeger: build: - context: ../shared/jaeger + context: ../../shared/jaeger ports: - "16686:16686" - "4317:4317" diff --git a/demos/currency_exchange_ollama/docker-compose_honeycomb.yaml b/demos/use_cases/ollama/docker-compose_honeycomb.yaml similarity index 77% rename from demos/currency_exchange_ollama/docker-compose_honeycomb.yaml rename to demos/use_cases/ollama/docker-compose_honeycomb.yaml index 3c46c7cf..ab0df80d 100644 --- a/demos/currency_exchange_ollama/docker-compose_honeycomb.yaml +++ b/demos/use_cases/ollama/docker-compose_honeycomb.yaml @@ -1,7 +1,7 @@ services: chatbot_ui: build: - context: ../shared/chatbot_ui + context: ../../shared/chatbot_ui ports: - "18080:8080" environment: @@ -14,12 +14,12 @@ services: otel-collector: build: - context: ../shared/honeycomb/ + context: ../../shared/honeycomb/ ports: - "4317:4317" - "4318:4318" volumes: - - ../shared/honeycomb/otel-collector-config.yaml:/etc/otel-collector-config.yaml + - ../../shared/honeycomb/otel-collector-config.yaml:/etc/otel-collector-config.yaml env_file: - .env environment: diff --git a/demos/use_cases/ollama/run_demo.sh b/demos/use_cases/ollama/run_demo.sh new file mode 100644 index 00000000..eb47dce6 --- /dev/null +++ b/demos/use_cases/ollama/run_demo.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e + +# Function to start the demo +start_demo() { + # Step 1: Check if .env file exists + if [ -f ".env" ]; then + echo ".env file already exists. Skipping creation." + else + # Step 2: Create `.env` file and set OpenAI key + if [ -z "$OPENAI_API_KEY" ]; then + echo "Error: OPENAI_API_KEY environment variable is not set for the demo." + exit 1 + fi + + echo "Creating .env file..." + echo "OPENAI_API_KEY=$OPENAI_API_KEY" > .env + echo ".env file created with OPENAI_API_KEY." + fi + + # Step 3: Start Arch + echo "Starting Arch with arch_config.yaml..." + archgw up arch_config.yaml + + # Step 4: Start developer services + echo "Starting Network Agent using Docker Compose..." + docker compose up -d # Run in detached mode +} + +# Function to stop the demo +stop_demo() { + # Step 1: Stop Docker Compose services + echo "Stopping Network Agent using Docker Compose..." + docker compose down + + # Step 2: Stop Arch + echo "Stopping Arch..." + archgw down +} + +# Main script logic +if [ "$1" == "down" ]; then + stop_demo +else + # Default action is to bring the demo up + start_demo +fi diff --git a/demos/use_cases/spotify_bearer_auth/README.md b/demos/use_cases/spotify_bearer_auth/README.md new file mode 100644 index 00000000..7dd3c81e --- /dev/null +++ b/demos/use_cases/spotify_bearer_auth/README.md @@ -0,0 +1,31 @@ +# Use Case Demo: Bearer Authorization with Spotify APIs + +In this demo, we show how you can use Arch's bearer authorization capability to connect your agentic apps to third-party APIs. +More specifically, we demonstrate how you can connect to two Spotify APIs: + +- [`/v1/browse/new-releases`](https://developer.spotify.com/documentation/web-api/reference/get-new-releases) +- [`/v1/artists/{artist_id}/top-tracks`](https://developer.spotify.com/documentation/web-api/reference/get-an-artists-top-tracks) + +Where users can engage by asking questions like _"Show me the latest releases in the US"_, followed by queries like _"Show me top tracks from Taylor Swift"_. + +![Example of Bearer Authorization with Spotify APIs](spotify_bearer_auth.png) + +## Starting the demo + +1. Ensure the [prerequisites](https://github.com/katanemo/arch/?tab=readme-ov-file#prerequisites) are installed correctly. +2. Create an `.env` file with API keys for OpenAI and Spotify. + - Sign up for an OpenAI API key at [https://platform.openai.com/signup/](https://platform.openai.com/signup/) + - Sign up for a Spotify Client Key/Secret by following instructions at [https://developer.spotify.com/dashboard/](https://developer.spotify.com/dashboard/) + - Generate a Spotify token using the [https://accounts.spotify.com/api/token API](https://accounts.spotify.com/api/token), using ```curl``` or similar commands. + - Create a .env file with the following keys: + ``` + OPENAI_API_KEY=your_openai_api_key + SPOTIFY_CLIENT_KEY=your_spotify_api_token + ``` + +3. Start Arch + ```sh + sh run_demo.sh + ``` +4. Navigate to http://localhost:18080 +5. Ask "show me new album releases in the US" diff --git a/demos/use_cases/spotify_bearer_auth/arch_config.yaml b/demos/use_cases/spotify_bearer_auth/arch_config.yaml new file mode 100644 index 00000000..a259a539 --- /dev/null +++ b/demos/use_cases/spotify_bearer_auth/arch_config.yaml @@ -0,0 +1,122 @@ +version: v0.1 +listener: + address: 127.0.0.1 + port: 8080 #If you configure port 443, you'll need to update the listener with tls_certificates + message_format: huggingface + +overrides: + optimize_context_window: true + +endpoints: + spotify: + endpoint: api.spotify.com + protocol: https + +system_prompt: | + I have the following JSON data representing a list of albums from Spotify: + + { + "items": [ + { + "album_type": "album", + "artists": [ + { + "external_urls": { + "spotify": "https://open.spotify.com/artist/06HL4z0CvFAxyc27GXpf02" + }, + "href": "https://api.spotify.com/v1/artists/06HL4z0CvFAxyc27GXpf02", + "id": "06HL4z0CvFAxyc27GXpf02", + "name": "Taylor Swift", + "type": "artist", + "uri": "spotify:artist:06HL4z0CvFAxyc27GXpf02" + } + ], + "available_markets": [ /* ... markets omitted for brevity ... */ ], + "external_urls": { + "spotify": "https://open.spotify.com/album/1Mo4aZ8pdj6L1jx8zSwJnt" + }, + "href": "https://api.spotify.com/v1/albums/1Mo4aZ8pdj6L1jx8zSwJnt", + "id": "1Mo4aZ8pdj6L1jx8zSwJnt", + "images": [ + { + "height": 300, + "url": "https://i.scdn.co/image/ab67616d00001e025076e4160d018e378f488c33", + "width": 300 + }, + { + "height": 64, + "url": "https://i.scdn.co/image/ab67616d000048515076e4160d018e378f488c33", + "width": 64 + }, + { + "height": 640, + "url": "https://i.scdn.co/image/ab67616d0000b2735076e4160d018e378f488c33", + "width": 640 + } + ], + "name": "THE TORTURED POETS DEPARTMENT", + "release_date": "2024-04-18", + "release_date_precision": "day", + "total_tracks": 16, + "type": "album", + "uri": "spotify:album:1Mo4aZ8pdj6L1jx8zSwJnt" + } + ] + } + + Please convert this JSON into Markdown with the following layout for each album: + + - Display the album image (using Markdown image syntax) first. + - On the next line immediately after the image, display the album title, artist name (use the first artist listed), and the release date, all separated by a hyphen or another clear delimiter. + - On the next line, provide the Spotify link (using Markdown link syntax). + + For example, the output should look similar to this (using the data above): + + ![Album Image](https://i.scdn.co/image/ab67616d00001e025076e4160d018e378f488c33) + **THE TORTURED POETS DEPARTMENT** + Taylor Swift - 2024-04-18 + [Listen on Spotify](https://open.spotify.com/album/1Mo4aZ8pdj6L1jx8zSwJnt) + Arist Id: 06HL4z0CvFAxyc27GXpf02 +
+ + Make sure your output is valid Markdown. And don't say "formatted in Markdown". Thanks! + +llm_providers: + - name: openai + provider_interface: openai + access_key: $OPENAI_API_KEY + model: gpt-4o + default: true + +prompt_targets: + - name: get_new_releases + description: Get a list of new album releases featured in Spotify (shown, for example, on a Spotify player’s “Browse” tab). + parameters: + - name: country + description: the country where the album is released + required: true + type: str + in_path: true + - name: limit + type: integer + description: The maximum number of results to return + default: "5" + endpoint: + name: spotify + path: /v1/browse/new-releases + http_headers: + Authorization: "Bearer $SPOTIFY_CLIENT_KEY" + + - name: get_artist_top_tracks + description: Get information about an artist's top tracks + parameters: + - name: artist_id + description: The ID of the artist. + required: true + type: str + in_path: true + endpoint: + name: spotify + path: /v1/artists/{artist_id}/top-tracks + http_headers: + Authorization: "Bearer $SPOTIFY_CLIENT_KEY" diff --git a/demos/use_cases/spotify_bearer_auth/docker-compose.yaml b/demos/use_cases/spotify_bearer_auth/docker-compose.yaml new file mode 100644 index 00000000..ee5465a5 --- /dev/null +++ b/demos/use_cases/spotify_bearer_auth/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + chatbot_ui: + build: + context: ../../shared/chatbot_ui + ports: + - "18080:8080" + environment: + # this is only because we are running the sample app in the same docker container environemtn as archgw + - CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1 + extra_hosts: + - "host.docker.internal:host-gateway" + volumes: + - ./arch_config.yaml:/app/arch_config.yaml + + jaeger: + build: + context: ../../shared/jaeger + ports: + - "16686:16686" + - "4317:4317" + - "4318:4318" diff --git a/demos/use_cases/spotify_bearer_auth/run_demo.sh b/demos/use_cases/spotify_bearer_auth/run_demo.sh new file mode 100644 index 00000000..eb47dce6 --- /dev/null +++ b/demos/use_cases/spotify_bearer_auth/run_demo.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e + +# Function to start the demo +start_demo() { + # Step 1: Check if .env file exists + if [ -f ".env" ]; then + echo ".env file already exists. Skipping creation." + else + # Step 2: Create `.env` file and set OpenAI key + if [ -z "$OPENAI_API_KEY" ]; then + echo "Error: OPENAI_API_KEY environment variable is not set for the demo." + exit 1 + fi + + echo "Creating .env file..." + echo "OPENAI_API_KEY=$OPENAI_API_KEY" > .env + echo ".env file created with OPENAI_API_KEY." + fi + + # Step 3: Start Arch + echo "Starting Arch with arch_config.yaml..." + archgw up arch_config.yaml + + # Step 4: Start developer services + echo "Starting Network Agent using Docker Compose..." + docker compose up -d # Run in detached mode +} + +# Function to stop the demo +stop_demo() { + # Step 1: Stop Docker Compose services + echo "Stopping Network Agent using Docker Compose..." + docker compose down + + # Step 2: Stop Arch + echo "Stopping Arch..." + archgw down +} + +# Main script logic +if [ "$1" == "down" ]; then + stop_demo +else + # Default action is to bring the demo up + start_demo +fi diff --git a/demos/use_cases/spotify_bearer_auth/spotify_bearer_auth.png b/demos/use_cases/spotify_bearer_auth/spotify_bearer_auth.png new file mode 100644 index 00000000..3111d47f Binary files /dev/null and b/demos/use_cases/spotify_bearer_auth/spotify_bearer_auth.png differ diff --git a/docs/source/build_with_arch/multi_turn.rst b/docs/source/build_with_arch/multi_turn.rst index 3ff5e6da..3bb31002 100644 --- a/docs/source/build_with_arch/multi_turn.rst +++ b/docs/source/build_with_arch/multi_turn.rst @@ -80,7 +80,7 @@ Once the prompt targets are configured as above, handle parameters across multi- Demo App ~~~~~~~~ -For your convenience, we've built a `demo app `_ +For your convenience, we've built a `demo app `_ that you can test and modify locally for multi-turn RAG scenarios. .. figure:: includes/multi_turn/mutli-turn-example.png diff --git a/docs/source/conf.py b/docs/source/conf.py index be9db942..3ea0822c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,7 +15,7 @@ from sphinxawesome_theme.postprocess import Icons project = "Arch Docs" copyright = "2025, Katanemo Labs, Inc" author = "Katanemo Labs, Inc" -release = " v0.2.0" +release = " v0.2.1" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/docs/source/get_started/quickstart.rst b/docs/source/get_started/quickstart.rst index 5363f817..268bf45d 100644 --- a/docs/source/get_started/quickstart.rst +++ b/docs/source/get_started/quickstart.rst @@ -25,7 +25,7 @@ Arch's CLI allows you to manage and interact with the Arch gateway efficiently. $ python -m venv venv $ source venv/bin/activate # On Windows, use: venv\Scripts\activate - $ pip install archgw==0.2.0 + $ pip install archgw==0.2.1 Build AI Agent with Arch Gateway diff --git a/docs/source/guides/observability/tracing.rst b/docs/source/guides/observability/tracing.rst index 23bf80d2..8dda14fd 100644 --- a/docs/source/guides/observability/tracing.rst +++ b/docs/source/guides/observability/tracing.rst @@ -289,6 +289,53 @@ To send tracing data to `Datadog `_: + +1. **Configure Arch**: Make sure Arch is installed and setup correctly. For more information, refer to the `installation guide `_. + +2. **Install Langtrace**: Install the Langtrace SDK.: + + .. code-block:: console + + $ pip install langtrace-python-sdk + +3. **Set Environment Variables**: Provide your Langtrace API key. + + .. code-block:: console + + $ export LANGTRACE_API_KEY= + +4. **Trace Requests**: Once you have Langtrace set up, you can start tracing requests. + + Here's an example of how to trace a request using the Langtrace Python SDK: + + .. code-block:: python + + import os + from langtrace_python_sdk import langtrace # Must precede any llm module imports + from openai import OpenAI + + langtrace.init(api_key=os.environ['LANGTRACE_API_KEY']) + + client = OpenAI(api_key=os.environ['OPENAI_API_KEY'], base_url="http://localhost:12000/v1") + + response = client.chat.completions.create( + model="gpt-4o-mini", + messages=[ + {"role": "system", "content": "You are a helpful assistant"}, + {"role": "user", "content": "Hello"}, + ] + ) + + print(chat_completion.choices[0].message.content) + +5. **Verify Traces**: Access the Langtrace dashboard to view your traces. + Best Practices -------------- @@ -312,6 +359,7 @@ Additional Resources - `W3C Trace Context Specification `_ - `AWS X-Ray Exporter `_ - `Datadog Exporter `_ +- `Langtrace Documentation `_ .. Note:: Replace placeholders such as ```` and ```` with your actual configurations. diff --git a/model_server/pyproject.toml b/model_server/pyproject.toml index e9b2dc0e..397b58fb 100644 --- a/model_server/pyproject.toml +++ b/model_server/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "archgw_modelserver" -version = "0.2.0" +version = "0.2.1" description = "A model server for serving models" authors = ["Katanemo Labs, Inc "] license = "Apache 2.0" diff --git a/model_server/src/core/function_calling.py b/model_server/src/core/function_calling.py index 25c83818..99dd29ba 100644 --- a/model_server/src/core/function_calling.py +++ b/model_server/src/core/function_calling.py @@ -134,7 +134,7 @@ class ArchIntentHandler(ArchBaseHandler): req.messages, req.tools, self.extra_instruction ) - logger.info(f"[request]: {json.dumps(messages)}") + logger.info(f"[request to arch-fc (intent)]: {json.dumps(messages)}") model_response = self.client.chat.completions.create( messages=messages, @@ -519,9 +519,11 @@ class ArchFunctionHandler(ArchBaseHandler): """ logger.info("[Arch-Function] - ChatCompletion") - messages = self._process_messages(req.messages, req.tools) + messages = self._process_messages( + req.messages, req.tools, metadata=req.metadata + ) - logger.info(f"[request]: {json.dumps(messages)}") + logger.info(f"[request to arch-fc]: {json.dumps(messages)}") # always enable `stream=True` to collect model responses response = self.client.chat.completions.create( diff --git a/model_server/src/core/guardrails.py b/model_server/src/core/guardrails.py index 0d2f34fc..fae4e5ba 100644 --- a/model_server/src/core/guardrails.py +++ b/model_server/src/core/guardrails.py @@ -105,7 +105,7 @@ class ArchGuardHanlder: raise NotImplementedError(f"{req.task} is not supported!") logger.info("[Arch-Guard] - Prediction") - logger.info(f"[request]: {req.input}") + logger.info(f"[request arch-guard]: {req.input}") if len(req.input.split()) < max_num_words: result = self._predict_text(req.task, req.input) diff --git a/model_server/src/core/utils/model_utils.py b/model_server/src/core/utils/model_utils.py index d971d115..7dc71acf 100644 --- a/model_server/src/core/utils/model_utils.py +++ b/model_server/src/core/utils/model_utils.py @@ -16,6 +16,7 @@ class Message(BaseModel): class ChatMessage(BaseModel): messages: List[Message] = [] tools: List[Dict[str, Any]] = [] + metadata: Optional[Dict[str, str]] = {} class Choice(BaseModel): @@ -123,6 +124,7 @@ class ArchBaseHandler: tools: List[Dict[str, Any]] = None, extra_instruction: str = None, max_tokens=4096, + metadata: Dict[str, str] = {}, ): """ Processes a list of messages and formats them appropriately. @@ -157,7 +159,12 @@ class ArchBaseHandler: content = f"\n{json.dumps(tool_calls[0]['function'])}\n" elif role == "tool": role = "user" - content = f"\n{json.dumps(content)}\n" + if metadata.get("optimize_context_window", "false").lower() == "true": + content = f"\n\n" + else: + content = ( + f"\n{json.dumps(content)}\n" + ) processed_messages.append({"role": role, "content": content}) diff --git a/tests/e2e/docker-compose.yaml b/tests/e2e/docker-compose.yaml index 0bf9ccd3..53b4338d 100644 --- a/tests/e2e/docker-compose.yaml +++ b/tests/e2e/docker-compose.yaml @@ -8,7 +8,7 @@ services: - "12000:12000" - "19901:9901" volumes: - - ../../demos/weather_forecast/arch_config.yaml:/app/arch_config.yaml + - ../../demos/samples_python/weather_forecast/arch_config.yaml:/app/arch_config.yaml - /etc/ssl/cert.pem:/etc/ssl/cert.pem - ~/archgw_logs:/var/log/ extra_hosts: diff --git a/tests/e2e/run_e2e_tests.sh b/tests/e2e/run_e2e_tests.sh index e288e30b..c87af4f8 100644 --- a/tests/e2e/run_e2e_tests.sh +++ b/tests/e2e/run_e2e_tests.sh @@ -26,7 +26,7 @@ log starting > ../build.log log building and running function_callling demo log =========================================== -cd ../../demos/weather_forecast/ +cd ../../demos/samples_python/weather_forecast/ docker compose up weather_forecast_service --build -d cd - @@ -53,7 +53,7 @@ cd ../../ tail -F ~/archgw_logs/modelserver.log & model_server_tail_pid=$! archgw down -archgw up demos/weather_forecast/arch_config.yaml +archgw up demos/samples_python/weather_forecast/arch_config.yaml kill $model_server_tail_pid cd - @@ -68,6 +68,6 @@ archgw down log shutting down the weather_forecast demo log ======================================= -cd ../../demos/weather_forecast +cd ../../demos/samples_python/weather_forecast docker compose down cd -