From ecdcf129fd16d528c7ac66f384685aa4dea8cf8a Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Fri, 20 Sep 2024 16:23:47 +0530 Subject: [PATCH] Make devcontainer work in codespace (#251) * WIP * WIP: Enable 'Recommended secrets' in the dev container * WIP: Polishing * WIP * Set default value for container prefix env variable * WIP * WIP * WIP * Add prefix to container names * Make python 3.10 version of dev container as default * Fix env file path * Fix NATS server config path * Fix the workspace path * WIP: Update contributing guide * WIP * WIP * WIP * Update contributing guide * Update contributing guide * Fix test which hangs in codespace * Update contributing guide * Update python 3.9 devcontainer configuration * Update docs * Update docs and configuration files * Update configuration files * Update configuration file * Polishing --------- Co-authored-by: Kumaran Rajendhiran --- .devcontainer/devcontainer.json | 97 ++++++++++ .../{python-3.10 => }/docker-compose.yml | 22 +-- .devcontainer/python-3.10/devcontainer.json | 63 ------- .devcontainer/python-3.11/devcontainer.json | 44 ++++- .devcontainer/python-3.11/docker-compose.yml | 14 +- .devcontainer/python-3.12/devcontainer.json | 45 ++++- .devcontainer/python-3.12/docker-compose.yml | 14 +- .devcontainer/python-3.9/devcontainer.json | 44 ++++- .devcontainer/python-3.9/docker-compose.yml | 14 +- CONTRIBUTING.md | 175 +++++++++++++----- docs/docs/en/contributing/CONTRIBUTING.md | 175 +++++++++++++----- tests/api/openapi/security/conftest.py | 2 +- tests/studio/test_nats.py | 4 +- 13 files changed, 513 insertions(+), 200 deletions(-) create mode 100644 .devcontainer/devcontainer.json rename .devcontainer/{python-3.10 => }/docker-compose.yml (57%) delete mode 100644 .devcontainer/python-3.10/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..9324ddeea --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,97 @@ +{ + "name": "python-3.10", + // "image": "mcr.microsoft.com/devcontainers/python:3.10", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.10-fastagency", + "forwardPorts": [ + "fastagency-${containerEnv:CONTAINER_PREFIX}-nats-py310:9222" + ], + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + "AZURE_GPT35_MODEL": { + "description": "This key is required if you are using Azure's GPT-3.5 model. Ensure you also set AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT4_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION for full compatibility with Azure OpenAI services. These can be configured later in the codespace terminal as environment variables." + }, + "AZURE_GPT4_MODEL": { + "description": "This key is required if you are using Azure's GPT-4 model. It must be set along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION to properly integrate with Azure's OpenAI services. All keys can be added later as environment variables in the codespace terminal." + }, + "AZURE_GPT4o_MODEL": { + "description": "This key is required if you are using Azure's GPT-4o model. Ensure that AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, and AZURE_API_VERSION are also set. You can always add these later as environment variables in the codespace terminal." + }, + "BING_API_KEY": { + "description": "This key is optional. The WebSurfer agent can work without it, but when added, it uses Bing's search and data services to improve information retrieval. You can always set it later as an environment variable in the codespace terminal." + } + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/fastagency", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "postCreateCommand": [], + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.10/docker-compose.yml b/.devcontainer/docker-compose.yml similarity index 57% rename from .devcontainer/python-3.10/docker-compose.yml rename to .devcontainer/docker-compose.yml index 9659a03a0..202a66e7c 100644 --- a/.devcontainer/python-3.10/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -3,34 +3,34 @@ version: '3' services: python-3.10-fastagency: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.10 - container_name: $USER-python-3.10-fastagency + container_name: fastagency-${USER}-python-3.10 volumes: - - ../../:/workspaces/fastagency:cached + - ../:/workspaces/fastagency:cached command: sleep infinity environment: - - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py310-fastagency:5432/fastagency - - PY_DATABASE_URL=postgresql://admin:password@${USER}-postgres-py310-fastagency:5432/pyfastagency - - NATS_URL=nats://${USER}-nats-py310-fastagency:4222 + - DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py310:5432/fastagency + - PY_DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py310:5432/pyfastagency + - NATS_URL=nats://fastagency-${USER}-nats-py310:4222 env_file: - - ../devcontainer.env + - ./devcontainer.env networks: - fastagency-network nats-fastagency: # nosemgrep image: nats:latest - container_name: $USER-nats-py310-fastagency + container_name: fastagency-${USER}-nats-py310 # ports: # - "${PORT_PREFIX}4222:4222" # - "${PORT_PREFIX}9222:9222" volumes: - - ../nats_server.conf:/etc/nats/server.conf + - ./nats_server.conf:/etc/nats/server.conf command: [ "--config", "/etc/nats/server.conf" ] env_file: - - ../devcontainer.env + - ./devcontainer.env networks: - fastagency-network postgres-fastagency: # nosemgrep image: postgres:latest - container_name: $USER-postgres-py310-fastagency + container_name: fastagency-${USER}-postgres-py310 environment: POSTGRES_USER: admin POSTGRES_PASSWORD: password # pragma: allowlist secret @@ -42,4 +42,4 @@ services: networks: fastagency-network: - name: "${USER}-fastagency-network" + name: fastagency-${USER}-network diff --git a/.devcontainer/python-3.10/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json deleted file mode 100644 index 678f383f7..000000000 --- a/.devcontainer/python-3.10/devcontainer.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "python-3.10", - // "image": "mcr.microsoft.com/devcontainers/python:3.10", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-3.10-fastagency", - "forwardPorts": [ - "${containerEnv:CONTAINER_PREFIX}-nats-py310-fastagency:9222" - ], - "shutdownAction": "stopCompose", - "workspaceFolder": "/workspaces/fastagency", - // "runArgs": [], - "remoteEnv": {}, - "features": { - "ghcr.io/devcontainers/features/common-utils:2": { - "installZsh": true, - "installOhMyZsh": true, - "configureZshAsDefaultShell": true, - "username": "vscode", - "userUid": "1000", - "userGid": "1000" - // "upgradePackages": "true" - }, - // "ghcr.io/devcontainers/features/python:1": {}, - "ghcr.io/devcontainers/features/node:1": {}, - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": true - }, - "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} - }, - "updateContentCommand": "bash .devcontainer/setup.sh", - "postCreateCommand": [], - "customizations": { - "vscode": { - "settings": { - "python.linting.enabled": true, - "python.testing.pytestEnabled": true, - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": "always" - }, - "[python]": { - "editor.defaultFormatter": "ms-python.vscode-pylance" - }, - "editor.rulers": [ - 80 - ] - }, - "extensions": [ - "ms-python.python", - "ms-toolsai.jupyter", - "ms-toolsai.vscode-jupyter-cell-tags", - "ms-toolsai.jupyter-keymap", - "ms-toolsai.jupyter-renderers", - "ms-toolsai.vscode-jupyter-slideshow", - "ms-python.vscode-pylance" - ] - } - } -} diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json index 796577d35..26e627a61 100644 --- a/.devcontainer/python-3.11/devcontainer.json +++ b/.devcontainer/python-3.11/devcontainer.json @@ -5,8 +5,40 @@ ], "service": "python-3.11-fastagency", "forwardPorts": [ - "${containerEnv:CONTAINER_PREFIX}-nats-py311-fastagency:9222" + "fastagency-${containerEnv:CONTAINER_PREFIX}-nats-py311:9222" ], + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + "AZURE_GPT35_MODEL": { + "description": "This key is required if you are using Azure's GPT-3.5 model. Ensure you also set AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT4_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION for full compatibility with Azure OpenAI services. These can be configured later in the codespace terminal as environment variables." + }, + "AZURE_GPT4_MODEL": { + "description": "This key is required if you are using Azure's GPT-4 model. It must be set along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION to properly integrate with Azure's OpenAI services. All keys can be added later as environment variables in the codespace terminal." + }, + "AZURE_GPT4o_MODEL": { + "description": "This key is required if you are using Azure's GPT-4o model. Ensure that AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, and AZURE_API_VERSION are also set. You can always add these later as environment variables in the codespace terminal." + }, + "BING_API_KEY": { + "description": "This key is optional. The WebSurfer agent can work without it, but when added, it uses Bing's search and data services to improve information retrieval. You can always set it later as an environment variable in the codespace terminal." + } + }, "shutdownAction": "stopCompose", "workspaceFolder": "/workspaces/fastagency", // "runArgs": [], @@ -23,10 +55,12 @@ }, // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": true - }, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, diff --git a/.devcontainer/python-3.11/docker-compose.yml b/.devcontainer/python-3.11/docker-compose.yml index a7521a01c..abd260fcb 100644 --- a/.devcontainer/python-3.11/docker-compose.yml +++ b/.devcontainer/python-3.11/docker-compose.yml @@ -3,21 +3,21 @@ version: '3' services: python-3.11-fastagency: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.11 - container_name: $USER-python-3.11-fastagency + container_name: fastagency-${USER}-python-3.11 volumes: - ../../:/workspaces/fastagency:cached command: sleep infinity environment: - - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py311-fastagency:5432/fastagency - - PY_DATABASE_URL=postgresql://admin:password@${USER}-postgres-py311-fastagency:5432/pyfastagency - - NATS_URL=nats://${USER}-nats-py311-fastagency:4222 + - DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py311:5432/fastagency + - PY_DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py311:5432/pyfastagency + - NATS_URL=nats://fastagency-${USER}-nats-py311:4222 env_file: - ../devcontainer.env networks: - fastagency-network nats-fastagency: # nosemgrep image: nats:latest - container_name: $USER-nats-py311-fastagency + container_name: fastagency-${USER}-nats-py311 # ports: # - "${PORT_PREFIX}4222:4222" # - "${PORT_PREFIX}9222:9222" @@ -30,7 +30,7 @@ services: - fastagency-network postgres-fastagency: # nosemgrep image: postgres:latest - container_name: $USER-postgres-py311-fastagency + container_name: fastagency-${USER}-postgres-py311 environment: POSTGRES_USER: admin POSTGRES_PASSWORD: password # pragma: allowlist secret @@ -42,4 +42,4 @@ services: networks: fastagency-network: - name: "${USER}-fastagency-network" + name: fastagency-${USER}-network diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json index 0fa777f1d..458d4a22b 100644 --- a/.devcontainer/python-3.12/devcontainer.json +++ b/.devcontainer/python-3.12/devcontainer.json @@ -1,13 +1,44 @@ { "name": "python-3.12", - // "image": "mcr.microsoft.com/devcontainers/python:3.12", "dockerComposeFile": [ "./docker-compose.yml" ], "service": "python-3.12-fastagency", "forwardPorts": [ - "${containerEnv:CONTAINER_PREFIX}-nats-py312-fastagency:9222" + "fastagency-${containerEnv:CONTAINER_PREFIX}-nats-py312:9222" ], + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + "AZURE_GPT35_MODEL": { + "description": "This key is required if you are using Azure's GPT-3.5 model. Ensure you also set AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT4_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION for full compatibility with Azure OpenAI services. These can be configured later in the codespace terminal as environment variables." + }, + "AZURE_GPT4_MODEL": { + "description": "This key is required if you are using Azure's GPT-4 model. It must be set along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION to properly integrate with Azure's OpenAI services. All keys can be added later as environment variables in the codespace terminal." + }, + "AZURE_GPT4o_MODEL": { + "description": "This key is required if you are using Azure's GPT-4o model. Ensure that AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, and AZURE_API_VERSION are also set. You can always add these later as environment variables in the codespace terminal." + }, + "BING_API_KEY": { + "description": "This key is optional. The WebSurfer agent can work without it, but when added, it uses Bing's search and data services to improve information retrieval. You can always set it later as an environment variable in the codespace terminal." + } + }, "shutdownAction": "stopCompose", "workspaceFolder": "/workspaces/fastagency", // "runArgs": [], @@ -24,10 +55,12 @@ }, // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": true - }, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, diff --git a/.devcontainer/python-3.12/docker-compose.yml b/.devcontainer/python-3.12/docker-compose.yml index f5059b3a5..78d87ac7d 100644 --- a/.devcontainer/python-3.12/docker-compose.yml +++ b/.devcontainer/python-3.12/docker-compose.yml @@ -3,21 +3,21 @@ version: '3' services: python-3.12-fastagency: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.12 - container_name: $USER-python-3.12-fastagency + container_name: fastagency-${USER}-python-3.12 volumes: - ../../:/workspaces/fastagency:cached command: sleep infinity environment: - - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py312-fastagency:5432/fastagency - - PY_DATABASE_URL=postgresql://admin:password@${USER}-postgres-py312-fastagency:5432/pyfastagency - - NATS_URL=nats://${USER}-nats-py312-fastagency:4222 + - DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py312:5432/fastagency + - PY_DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py312:5432/pyfastagency + - NATS_URL=nats://fastagency-${USER}-nats-py312:4222 env_file: - ../devcontainer.env networks: - fastagency-network nats-fastagency: # nosemgrep image: nats:latest - container_name: $USER-nats-py312-fastagency + container_name: fastagency-$USER-nats-py312 # ports: # - "${PORT_PREFIX}4222:4222" # - "${PORT_PREFIX}9222:9222" @@ -30,7 +30,7 @@ services: - fastagency-network postgres-fastagency: # nosemgrep image: postgres:latest - container_name: $USER-postgres-py312-fastagency + container_name: fastagency-${USER}-postgres-py312 environment: POSTGRES_USER: admin POSTGRES_PASSWORD: password # pragma: allowlist secret @@ -42,4 +42,4 @@ services: networks: fastagency-network: - name: "${USER}-fastagency-network" + name: fastagency-${USER}-network diff --git a/.devcontainer/python-3.9/devcontainer.json b/.devcontainer/python-3.9/devcontainer.json index c9f4276fe..cb8577bec 100644 --- a/.devcontainer/python-3.9/devcontainer.json +++ b/.devcontainer/python-3.9/devcontainer.json @@ -6,8 +6,40 @@ ], "service": "python-3.9-fastagency", "forwardPorts": [ - "${containerEnv:CONTAINER_PREFIX}-nats-py39-fastagency:9222" + "fastagency-${containerEnv:CONTAINER_PREFIX}-nats-py39:9222" ], + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, and at least one of AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, or AZURE_GPT4o_MODEL for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + "AZURE_GPT35_MODEL": { + "description": "This key is required if you are using Azure's GPT-3.5 model. Ensure you also set AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT4_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION for full compatibility with Azure OpenAI services. These can be configured later in the codespace terminal as environment variables." + }, + "AZURE_GPT4_MODEL": { + "description": "This key is required if you are using Azure's GPT-4 model. It must be set along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4o_MODEL, and AZURE_API_VERSION to properly integrate with Azure's OpenAI services. All keys can be added later as environment variables in the codespace terminal." + }, + "AZURE_GPT4o_MODEL": { + "description": "This key is required if you are using Azure's GPT-4o model. Ensure that AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT, AZURE_GPT35_MODEL, AZURE_GPT4_MODEL, and AZURE_API_VERSION are also set. You can always add these later as environment variables in the codespace terminal." + }, + "BING_API_KEY": { + "description": "This key is optional. The WebSurfer agent can work without it, but when added, it uses Bing's search and data services to improve information retrieval. You can always set it later as an environment variable in the codespace terminal." + } + }, "shutdownAction": "stopCompose", "workspaceFolder": "/workspaces/fastagency", // "runArgs": [], @@ -24,10 +56,12 @@ }, // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": true - }, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, diff --git a/.devcontainer/python-3.9/docker-compose.yml b/.devcontainer/python-3.9/docker-compose.yml index edf211a3a..5bfb1426e 100644 --- a/.devcontainer/python-3.9/docker-compose.yml +++ b/.devcontainer/python-3.9/docker-compose.yml @@ -3,21 +3,21 @@ version: '3' services: python-3.9-fastagency: # nosemgrep image: mcr.microsoft.com/devcontainers/python:3.9 - container_name: $USER-python-3.9-fastagency + container_name: fastagency-${USER}-python-3.9 volumes: - ../../:/workspaces/fastagency:cached command: sleep infinity environment: - - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py39-fastagency:5432/fastagency - - PY_DATABASE_URL=postgresql://admin:password@${USER}-postgres-py39-fastagency:5432/pyfastagency - - NATS_URL=nats://${USER}-nats-py39-fastagency:4222 + - DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py39:5432/fastagency + - PY_DATABASE_URL=postgresql://admin:password@fastagency-${USER}-postgres-py39:5432/pyfastagency + - NATS_URL=nats://fastagency-${USER}-nats-py39:4222 env_file: - ../devcontainer.env networks: - fastagency-network nats-fastagency: # nosemgrep image: nats:latest - container_name: $USER-nats-py39-fastagency + container_name: fastagency-${USER}-nats-py39 # ports: # - "${PORT_PREFIX}4222:4222" # - "${PORT_PREFIX}9222:9222" @@ -30,7 +30,7 @@ services: - fastagency-network postgres-fastagency: # nosemgrep image: postgres:latest - container_name: $USER-postgres-py39-fastagency + container_name: fastagency-${USER}-postgres-py39 environment: POSTGRES_USER: admin POSTGRES_PASSWORD: password # pragma: allowlist secret @@ -42,4 +42,4 @@ services: networks: fastagency-network: - name: "${USER}-fastagency-network" + name: fastagency-${USER}-network diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8b5e9bb2a..333efdf52 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,74 +1,163 @@ > **_NOTE:_** This is an auto-generated file. Please edit docs/docs/en/contributing/CONTRIBUTING.md instead. -# Development +# Development Environment Setup -After cloning the project, you'll need to set up the development environment. Here are the guidelines on how to do this. +You can set up the development environment using one of two methods: -## Virtual Environment with `venv` +1. **Using GitHub Codespaces** +2. **Setting Up Locally with Dev Containers** -Create a virtual environment in a directory using Python's `venv` module: -```bash -python -m venv venv -``` +## Using GitHub Codespaces -That will create a `./venv/` directory with Python binaries, allowing you to install packages in an isolated environment. +Using GitHub Codespaces is the fastest way to contribute without setting up a local development environment. -## Activate the Environment +Follow the steps below to begin contributing using Codespaces. -Activate the new environment with: +### 1. Fork the Repository -```bash -source ./venv/bin/activate -``` +- Navigate to the FastAgency GitHub repository. +- Click on the **Fork** button in the top-right corner to create your own copy of the repository. -Ensure you have the latest pip version in your virtual environment: +### 2. Open a Codespace -```bash -python -m pip install --upgrade pip -``` +- In your forked repository, navigate to the main page. +- Ensure you are on the **main** branch. +- Click the **< > Code** button, then select the **Codespaces** tab. +- Click on **Create codespace on main**. -## Installing Dependencies +#### Advanced Options -After activating the virtual environment as described above, run: +- If you choose to configure advanced options, you will have the opportunity to set optional environment secrets needed for development while starting the codespace. +- For detailed instructions related to advanced options, refer to the GitHub Codespaces documentation. -```bash -pip install -e ".[dev]" -``` +> **Note:** If you create the Codespace using the default options, you may not see an option to set environment variables during setup. However, you can set them later in the terminal after starting the Codespace, as needed. For a list of environment variables, please refer to the section [below](#list-of-optional-environment-variables). -This will install all the dependencies and your local **FastAgency** in your virtual environment. -### Using Your local **FastAgency** +#### Setting Environment Variables (Optional) -If you create a Python file that imports and uses **FastAgency**, and run it with the Python from your local environment, it will use your local **FastAgency** source code. +If you choose to configure advanced options when creating the Codespace, you might see a section called Recommended secrets. These are optional and depend on the parts of the codebase you plan to work on. -Whenever you update your local **FastAgency** source code, it will automatically use the latest version when you run your Python file again. This is because it is installed with `-e`. +#### Working with External APIs -This way, you don't have to "install" your local version to be able to test every change. +If your contributions involve interacting with external APIs (e.g., OpenAI), you need to provide your own API keys. -## Running Tests +- **For example**, to work with OpenAI services, set the `OPENAI_API_KEY` environment variable. -### Pytest +#### How to Set Environment Variables -To run tests with your current **FastAgency** application and Python environment, use: +- While creating the Codespace, find the section for **Recommended secrets** and enter the necessary keys. +- You can also set the keys as environment variables after starting the Codespace in the terminal. -```bash -pytest tests -# or -./scripts/test.sh -# with coverage output -./scripts/test-cov.sh -``` +#### List of Optional environment variables + +The table below provides a list of optional environment variables that you may need to set. + +| Name | Description | +|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `OPENAI_API_KEY` | Optional; needed if working on OpenAI-related code. Can be set later in the Codespace terminal. | +| `TOGETHER_API_KEY` | Optional; needed if working with Together API-related code. Can be set later in the Codespace terminal. | +| `ANTHROPIC_API_KEY` | Optional; needed if working with Anthropic API-related code. Can be set later in the Codespace terminal. | +| `AZURE_OPENAI_API_KEY` | Optional; required if using Azure's OpenAI services. Also set `AZURE_API_ENDPOINT`, `AZURE_API_VERSION`, and at least one Azure model. | +| `AZURE_API_ENDPOINT` | Required with `AZURE_OPENAI_API_KEY`, `AZURE_API_VERSION`, and at least one Azure model when using Azure's OpenAI services. Can be set later in the Codespace terminal. | +| `AZURE_API_VERSION` | Required with `AZURE_OPENAI_API_KEY`, `AZURE_API_ENDPOINT`, and at least one Azure model when using Azure's OpenAI services. Can be set later in the Codespace terminal. | +| `AZURE_GPT35_MODEL` | Required if using Azure's GPT-3.5 model; must also set other Azure-related keys. Can be configured later as an environment variable. | +| `AZURE_GPT4_MODEL` | Required if using Azure's GPT-4 model; must also set other Azure-related keys. Can be configured later in the Codespace terminal. | +| `AZURE_GPT4o_MODEL` | Required if using Azure's GPT-4o model; must also set other Azure-related keys. Can be configured later as an environment variable. | +| `BING_API_KEY` | Optional; used to enhance WebSurfer agent performance with Bing search and data services. Can be set later as an environment variable. | + + +### 3. Wait for Codespace Initialization + +- After initiating the Codespace, wait for it to set up. This may take a few minutes. +- The development environment is configured automatically, including the installation of all dependencies. +- **No manual setup is required on your part.** +- Once the Codespace is ready, you can start coding immediately. + + +## Setting Up Locally with Dev Containers + +Our project supports development using Visual Studio Code's **Dev Containers** feature. This allows contributors to set up a consistent development environment inside a Docker container. + +Here's how you can use Dev Containers to contribute to our project: + +### Prerequisites + +Before you begin, make sure you have the following installed: + +- **Visual Studio Code**: Download and install the latest version from the official website. +- **Dev Containers Extension**: Open Visual Studio Code, go to the Extensions view (`Ctrl+Shift+X` or `Cmd+Shift+X`), search for "**Dev Containers**" by Microsoft, and install it. +- **Docker**: Install Docker Desktop for your operating system from the official website. Docker is required to build and run the dev container. -In your project, you'll find some *pytest marks*: -* **slow** -* **all** +### Setting up the project -By default, running *pytest* will execute "not slow" tests. +#### 1. Fork the repository -To run all tests use: +- Navigate to the FastAgency GitHub repository. +- Click on the **Fork** button in the top-right corner to create your own copy of the repository. + + +#### 2. Clone the forked repository + +Clone your forked **FastAgency** repository to your local machine: ```bash -pytest -m 'all' +git clone https://github.com//fastagency.git ``` + +Replace `` with your GitHub username. + +#### 3. Open the project in a dev container + +- Open Visual Studio Code. +- Open the cloned repository folder in Visual Studio Code. +- Visual Studio Code automatically detects that this project uses a dev container and prompts you to reopen the project in the container via a prompt at the bottom right corner of the editor. Click on the **Reopen in Container** button in this prompt to display the Command Palette, where you can choose a container configuration file from the list of options. +- Alternatively, you can launch the Command Palette directly by pressing `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS) and select **Dev Containers: Rebuild and Reopen in Container**. This will also prompt you to choose a container configuration file from the list of options. +- Once you select a configuration file, Visual Studio Code will read the container configuration and reopen the project inside the dev container. You can click on the **Show Logs** link in the prompt displayed at the bottom right to see the live logs. +- The development environment is configured automatically, including the installation of all dependencies. +- **No manual setup is required on your part.** +- Once the devcontainer is ready, you can start coding immediately. + + +#### 4. Set Optional Environment Variables + +Depending on your contribution, you may need to set a few optional environment variables. Please refer to the [list of optional environment variables](#list-of-optional-environment-variables) for details. + +## Making Changes and Submitting a Pull Request + + +1. **Create a New Branch** + - From your main branch, create a new branch for your changes or new features. + +2. **Make Your Changes** + - Implement the necessary changes or add new features in your branch. + +3. **Test Your Changes** + - Ensure your changes work as expected by running the project's tests or manually testing the functionality. + + - To run tests, use: + ```bash + pytest tests + ``` + + - In the project, you'll find some **pytest marks**: + - `slow` + - `all` + + - By default, running `pytest` will execute tests **not** marked as `slow`. + - To run all tests, including slow ones, use: + ```bash + pytest -m 'all' + ``` + + +4. **Commit and Push Your Changes** + - After testing, commit your changes to your branch and push them to your forked repository. + +5. **Create a Pull Request** + - Navigate to your forked repository on GitHub. + - Create a new pull request targeting our project's main branch. + - Provide a clear title and description for your changes. + +Thank you for your contributions! If you have any questions or need assistance, feel free to open an issue or reach out to the maintainers. diff --git a/docs/docs/en/contributing/CONTRIBUTING.md b/docs/docs/en/contributing/CONTRIBUTING.md index 34f76fd29..8607a32fb 100644 --- a/docs/docs/en/contributing/CONTRIBUTING.md +++ b/docs/docs/en/contributing/CONTRIBUTING.md @@ -8,75 +8,164 @@ search: boost: 3 --- -# Development +# Development Environment Setup -After cloning the project, you'll need to set up the development environment. Here are the guidelines on how to do this. +You can set up the development environment using one of two methods: -## Virtual Environment with `venv` +1. **Using GitHub Codespaces** +2. **Setting Up Locally with Dev Containers** -Create a virtual environment in a directory using Python's `venv` module: -```bash -python -m venv venv -``` +## Using GitHub Codespaces -That will create a `./venv/` directory with Python binaries, allowing you to install packages in an isolated environment. +Using GitHub Codespaces is the fastest way to contribute without setting up a local development environment. -## Activate the Environment +Follow the steps below to begin contributing using Codespaces. -Activate the new environment with: +### 1. Fork the Repository -```bash -source ./venv/bin/activate -``` +- Navigate to the FastAgency GitHub repository. +- Click on the **Fork** button in the top-right corner to create your own copy of the repository. -Ensure you have the latest pip version in your virtual environment: +### 2. Open a Codespace -```bash -python -m pip install --upgrade pip -``` +- In your forked repository, navigate to the main page. +- Ensure you are on the **main** branch. +- Click the **< > Code** button, then select the **Codespaces** tab. +- Click on **Create codespace on main**. -## Installing Dependencies +#### Advanced Options -After activating the virtual environment as described above, run: +- If you choose to configure advanced options, you will have the opportunity to set optional environment secrets needed for development while starting the codespace. +- For detailed instructions related to advanced options, refer to the GitHub Codespaces documentation. -```bash -pip install -e ".[dev]" -``` +> **Note:** If you create the Codespace using the default options, you may not see an option to set environment variables during setup. However, you can set them later in the terminal after starting the Codespace, as needed. For a list of environment variables, please refer to the section [below](#list-of-optional-environment-variables). -This will install all the dependencies and your local **FastAgency** in your virtual environment. -### Using Your local **FastAgency** +#### Setting Environment Variables (Optional) -If you create a Python file that imports and uses **FastAgency**, and run it with the Python from your local environment, it will use your local **FastAgency** source code. +If you choose to configure advanced options when creating the Codespace, you might see a section called Recommended secrets. These are optional and depend on the parts of the codebase you plan to work on. -Whenever you update your local **FastAgency** source code, it will automatically use the latest version when you run your Python file again. This is because it is installed with `-e`. +#### Working with External APIs -This way, you don't have to "install" your local version to be able to test every change. +If your contributions involve interacting with external APIs (e.g., OpenAI), you need to provide your own API keys. -## Running Tests +- **For example**, to work with OpenAI services, set the `OPENAI_API_KEY` environment variable. -### Pytest +#### How to Set Environment Variables -To run tests with your current **FastAgency** application and Python environment, use: +- While creating the Codespace, find the section for **Recommended secrets** and enter the necessary keys. +- You can also set the keys as environment variables after starting the Codespace in the terminal. -```bash -pytest tests -# or -./scripts/test.sh -# with coverage output -./scripts/test-cov.sh -``` +#### List of Optional environment variables + +The table below provides a list of optional environment variables that you may need to set. + +| Name | Description | +|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `OPENAI_API_KEY` | Optional; needed if working on OpenAI-related code. Can be set later in the Codespace terminal. | +| `TOGETHER_API_KEY` | Optional; needed if working with Together API-related code. Can be set later in the Codespace terminal. | +| `ANTHROPIC_API_KEY` | Optional; needed if working with Anthropic API-related code. Can be set later in the Codespace terminal. | +| `AZURE_OPENAI_API_KEY` | Optional; required if using Azure's OpenAI services. Also set `AZURE_API_ENDPOINT`, `AZURE_API_VERSION`, and at least one Azure model. | +| `AZURE_API_ENDPOINT` | Required with `AZURE_OPENAI_API_KEY`, `AZURE_API_VERSION`, and at least one Azure model when using Azure's OpenAI services. Can be set later in the Codespace terminal. | +| `AZURE_API_VERSION` | Required with `AZURE_OPENAI_API_KEY`, `AZURE_API_ENDPOINT`, and at least one Azure model when using Azure's OpenAI services. Can be set later in the Codespace terminal. | +| `AZURE_GPT35_MODEL` | Required if using Azure's GPT-3.5 model; must also set other Azure-related keys. Can be configured later as an environment variable. | +| `AZURE_GPT4_MODEL` | Required if using Azure's GPT-4 model; must also set other Azure-related keys. Can be configured later in the Codespace terminal. | +| `AZURE_GPT4o_MODEL` | Required if using Azure's GPT-4o model; must also set other Azure-related keys. Can be configured later as an environment variable. | +| `BING_API_KEY` | Optional; used to enhance WebSurfer agent performance with Bing search and data services. Can be set later as an environment variable. | + + +### 3. Wait for Codespace Initialization + +- After initiating the Codespace, wait for it to set up. This may take a few minutes. +- The development environment is configured automatically, including the installation of all dependencies. +- **No manual setup is required on your part.** +- Once the Codespace is ready, you can start coding immediately. + + +## Setting Up Locally with Dev Containers + +Our project supports development using Visual Studio Code's **Dev Containers** feature. This allows contributors to set up a consistent development environment inside a Docker container. + +Here's how you can use Dev Containers to contribute to our project: + +### Prerequisites + +Before you begin, make sure you have the following installed: + +- **Visual Studio Code**: Download and install the latest version from the official website. +- **Dev Containers Extension**: Open Visual Studio Code, go to the Extensions view (`Ctrl+Shift+X` or `Cmd+Shift+X`), search for "**Dev Containers**" by Microsoft, and install it. +- **Docker**: Install Docker Desktop for your operating system from the official website. Docker is required to build and run the dev container. -In your project, you'll find some *pytest marks*: -* **slow** -* **all** +### Setting up the project -By default, running *pytest* will execute "not slow" tests. +#### 1. Fork the repository -To run all tests use: +- Navigate to the FastAgency GitHub repository. +- Click on the **Fork** button in the top-right corner to create your own copy of the repository. + + +#### 2. Clone the forked repository + +Clone your forked **FastAgency** repository to your local machine: ```bash -pytest -m 'all' +git clone https://github.com//fastagency.git ``` + +Replace `` with your GitHub username. + +#### 3. Open the project in a dev container + +- Open Visual Studio Code. +- Open the cloned repository folder in Visual Studio Code. +- Visual Studio Code automatically detects that this project uses a dev container and prompts you to reopen the project in the container via a prompt at the bottom right corner of the editor. Click on the **Reopen in Container** button in this prompt to display the Command Palette, where you can choose a container configuration file from the list of options. +- Alternatively, you can launch the Command Palette directly by pressing `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS) and select **Dev Containers: Rebuild and Reopen in Container**. This will also prompt you to choose a container configuration file from the list of options. +- Once you select a configuration file, Visual Studio Code will read the container configuration and reopen the project inside the dev container. You can click on the **Show Logs** link in the prompt displayed at the bottom right to see the live logs. +- The development environment is configured automatically, including the installation of all dependencies. +- **No manual setup is required on your part.** +- Once the devcontainer is ready, you can start coding immediately. + + +#### 4. Set Optional Environment Variables + +Depending on your contribution, you may need to set a few optional environment variables. Please refer to the [list of optional environment variables](#list-of-optional-environment-variables) for details. + +## Making Changes and Submitting a Pull Request + + +1. **Create a New Branch** + - From your main branch, create a new branch for your changes or new features. + +2. **Make Your Changes** + - Implement the necessary changes or add new features in your branch. + +3. **Test Your Changes** + - Ensure your changes work as expected by running the project's tests or manually testing the functionality. + + - To run tests, use: + ```bash + pytest tests + ``` + + - In the project, you'll find some **pytest marks**: + - `slow` + - `all` + + - By default, running `pytest` will execute tests **not** marked as `slow`. + - To run all tests, including slow ones, use: + ```bash + pytest -m 'all' + ``` + + +4. **Commit and Push Your Changes** + - After testing, commit your changes to your branch and push them to your forked repository. + +5. **Create a Pull Request** + - Navigate to your forked repository on GitHub. + - Create a new pull request targeting our project's main branch. + - Provide a clear title and description for your changes. + +Thank you for your contributions! If you have any questions or need assistance, feel free to open an issue or reach out to the maintainers. diff --git a/tests/api/openapi/security/conftest.py b/tests/api/openapi/security/conftest.py index 804e60abb..5c3878a74 100644 --- a/tests/api/openapi/security/conftest.py +++ b/tests/api/openapi/security/conftest.py @@ -48,7 +48,7 @@ async def read_items( @pytest.fixture(scope="session") def secure_fastapi_url() -> Iterator[str]: - host = "localhost" + host = "127.0.0.1" port = find_free_port() app = create_secure_fastapi_app(host, port) diff --git a/tests/studio/test_nats.py b/tests/studio/test_nats.py index 910d316ae..58a355b6b 100644 --- a/tests/studio/test_nats.py +++ b/tests/studio/test_nats.py @@ -339,11 +339,11 @@ async def test_ionats_e2e( thread_id = uuid.uuid4() # Add secret, llm, agent, team to database + api_key_model_uuid = str(uuid.uuid4()) api_key = api_key_model( # type: ignore [operator] api_key=os.getenv("AZURE_OPENAI_API_KEY", default="*" * 64), - name="api_key_model_name", + name=f"api_key_model_name_{api_key_model_uuid}", ) - api_key_model_uuid = str(uuid.uuid4()) await add_model( user_uuid=user_uuid, type_name="secret",