From ec42abbb24c63543734685097e7691385abc88e8 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Fri, 9 Feb 2024 12:38:19 +0100 Subject: [PATCH 01/23] added dataset attribute to eval delete button --- .../pages/evaluations/evaluationResults/EvaluationResults.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/agenta-web/src/components/pages/evaluations/evaluationResults/EvaluationResults.tsx b/agenta-web/src/components/pages/evaluations/evaluationResults/EvaluationResults.tsx index 8ff5806227..8d8ad2aaf3 100644 --- a/agenta-web/src/components/pages/evaluations/evaluationResults/EvaluationResults.tsx +++ b/agenta-web/src/components/pages/evaluations/evaluationResults/EvaluationResults.tsx @@ -294,6 +294,7 @@ const EvaluationResults: React.FC = () => { disabled={selected.length === 0} icon={} type="primary" + data-cy="evaluation-results-delete-button" danger onClick={onDelete} > From 5ff130a8bc79474c9c9e37b0c70c31f7c9527be8 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Fri, 9 Feb 2024 12:39:29 +0100 Subject: [PATCH 02/23] added checks and reusable test blocks --- agenta-web/cypress/e2e/eval.comparison.cy.ts | 29 +++++++------------ agenta-web/cypress/e2e/eval.evaluations.cy.ts | 19 +++--------- agenta-web/cypress/e2e/eval.evaluators.cy.ts | 3 ++ agenta-web/cypress/e2e/eval.scenarios.cy.ts | 19 +++--------- .../cypress/support/commands/evaluations.ts | 19 ++++++++++++ agenta-web/cypress/support/commands/index.ts | 1 + 6 files changed, 41 insertions(+), 49 deletions(-) diff --git a/agenta-web/cypress/e2e/eval.comparison.cy.ts b/agenta-web/cypress/e2e/eval.comparison.cy.ts index e6e2110def..ad2f4c3fd1 100644 --- a/agenta-web/cypress/e2e/eval.comparison.cy.ts +++ b/agenta-web/cypress/e2e/eval.comparison.cy.ts @@ -12,35 +12,26 @@ describe("Evaluation Comparison Test", function () { beforeEach(() => { cy.visit(`/apps/${app_id}/evaluations`) cy.location("pathname").should("include", "/evaluations") + cy.get('[data-cy="evaluation-results-compare-button"]').should("exist") + cy.get('[data-cy="evaluation-results-delete-button"]').should("exist") + cy.get('[data-cy="new-evaluation-button"]').should("exist") }) it("Should create 2 new Evaluations", () => { Array.from({length: 2}).map((_) => { - cy.get('[data-cy="new-evaluation-button"]').click() - cy.get(".ant-modal-content").should("exist") - - cy.get('[data-cy="select-testset-group"]').click() - cy.get('[data-cy="select-testset-option"]').click() - - cy.get('[data-cy="select-variant-group"]').click() - cy.get('[data-cy="select-variant-option"]').eq(0).click() - cy.get('[data-cy="select-variant-group"]').click() - - cy.get('[data-cy="select-evaluators-group"]').click() - cy.get('[data-cy="select-evaluators-option"]').eq(0).click() - cy.get('[data-cy="select-evaluators-group"]').click() - - cy.get( - ".ant-modal-footer > .ant-btn-primary > .ant-btn-icon > .anticon > svg", - ).click() - cy.wait(1000) + cy.createNewEvaluation() }) }) it("Should verify that there are completed evaluations in the list", () => { cy.get('.ag-row[row-index="0"]').should("exist") cy.get('.ag-row[row-index="1"]').should("exist") - cy.get('.ag-cell[col-id="status"]').should("contain.text", "Completed") + cy.get('.ag-cell[col-id="status"]', {timeout: 60000}) + .eq(0) + .should("contain.text", "Completed") + cy.get('.ag-cell[col-id="status"]', {timeout: 60000}) + .eq(1) + .should("contain.text", "Completed") }) it("Should select 2 evaluations, click on the compare button, and successfully navigate to the comparison page", () => { diff --git a/agenta-web/cypress/e2e/eval.evaluations.cy.ts b/agenta-web/cypress/e2e/eval.evaluations.cy.ts index a152671edf..51f42b3d1c 100644 --- a/agenta-web/cypress/e2e/eval.evaluations.cy.ts +++ b/agenta-web/cypress/e2e/eval.evaluations.cy.ts @@ -12,24 +12,13 @@ describe("Evaluations CRUD Operations Test", function () { beforeEach(() => { cy.visit(`/apps/${app_id}/evaluations`) cy.location("pathname").should("include", "/evaluations") + cy.get('[data-cy="evaluation-results-compare-button"]').should("exist") + cy.get('[data-cy="evaluation-results-delete-button"]').should("exist") + cy.get('[data-cy="new-evaluation-button"]').should("exist") }) it("Should successfully create an Evaluation", () => { - cy.get('[data-cy="new-evaluation-button"]').click() - cy.get(".ant-modal-content").should("exist") - - cy.get('[data-cy="select-testset-group"]').click() - cy.get('[data-cy="select-testset-option"]').click() - - cy.get('[data-cy="select-variant-group"]').click() - cy.get('[data-cy="select-variant-option"]').eq(0).click() - cy.get('[data-cy="select-variant-group"]').click() - - cy.get('[data-cy="select-evaluators-group"]').click() - cy.get('[data-cy="select-evaluators-option"]').eq(0).click() - cy.get('[data-cy="select-evaluators-group"]').click() - - cy.get(".ant-modal-footer > .ant-btn-primary > .ant-btn-icon > .anticon > svg").click() + cy.createNewEvaluation() }) it("Should throw warning when creating an evaluation without selecting testset, variants, and evaluators", () => { diff --git a/agenta-web/cypress/e2e/eval.evaluators.cy.ts b/agenta-web/cypress/e2e/eval.evaluators.cy.ts index 6775429935..40f33d8d6b 100644 --- a/agenta-web/cypress/e2e/eval.evaluators.cy.ts +++ b/agenta-web/cypress/e2e/eval.evaluators.cy.ts @@ -14,6 +14,9 @@ describe("Evaluators CRUD Operations Test", function () { beforeEach(() => { cy.visit(`/apps/${app_id}/evaluations`) cy.location("pathname").should("include", "/evaluations") + cy.get('[data-cy="evaluation-results-compare-button"]').should("exist") + cy.get('[data-cy="evaluation-results-delete-button"]').should("exist") + cy.get('[data-cy="new-evaluation-button"]').should("exist") cy.get("#rc-tabs-1-tab-evaluators > :nth-child(2)").click() }) diff --git a/agenta-web/cypress/e2e/eval.scenarios.cy.ts b/agenta-web/cypress/e2e/eval.scenarios.cy.ts index 39c8a8d637..f14b6baef0 100644 --- a/agenta-web/cypress/e2e/eval.scenarios.cy.ts +++ b/agenta-web/cypress/e2e/eval.scenarios.cy.ts @@ -12,24 +12,13 @@ describe("Evaluation Scenarios Test", function () { beforeEach(() => { cy.visit(`/apps/${app_id}/evaluations`) cy.location("pathname").should("include", "/evaluations") + cy.get('[data-cy="evaluation-results-compare-button"]').should("exist") + cy.get('[data-cy="evaluation-results-delete-button"]').should("exist") + cy.get('[data-cy="new-evaluation-button"]').should("exist") }) it("Should successfully create an Evaluation", () => { - cy.get('[data-cy="new-evaluation-button"]').click() - cy.get(".ant-modal-content").should("exist") - - cy.get('[data-cy="select-testset-group"]').click() - cy.get('[data-cy="select-testset-option"]').click() - - cy.get('[data-cy="select-variant-group"]').click() - cy.get('[data-cy="select-variant-option"]').eq(0).click() - cy.get('[data-cy="select-variant-group"]').click() - - cy.get('[data-cy="select-evaluators-group"]').click() - cy.get('[data-cy="select-evaluators-option"]').eq(0).click() - cy.get('[data-cy="select-evaluators-group"]').click() - - cy.get(".ant-modal-footer > .ant-btn-primary > .ant-btn-icon > .anticon > svg").click() + cy.createNewEvaluation() }) it("Should verify that evalaution was created and completed successfully", () => { diff --git a/agenta-web/cypress/support/commands/evaluations.ts b/agenta-web/cypress/support/commands/evaluations.ts index b5f24209da..31c4d8545e 100644 --- a/agenta-web/cypress/support/commands/evaluations.ts +++ b/agenta-web/cypress/support/commands/evaluations.ts @@ -104,3 +104,22 @@ Cypress.Commands.add("addingOpenaiKey", () => { Cypress.Commands.add("removeLlmProviderKey", () => { removeLlmProviderKey() }) + +Cypress.Commands.add("createNewEvaluation", () => { + cy.get('[data-cy="new-evaluation-button"]').click() + cy.get(".ant-modal-content").should("exist") + + cy.get('[data-cy="select-testset-group"]').click() + cy.get('[data-cy="select-testset-option"]').eq(0).click() + + cy.get('[data-cy="select-variant-group"]').click() + cy.get('[data-cy="select-variant-option"]').eq(0).click() + cy.get('[data-cy="select-variant-group"]').click() + + cy.get('[data-cy="select-evaluators-group"]').click() + cy.get('[data-cy="select-evaluators-option"]').eq(0).click() + cy.get('[data-cy="select-evaluators-group"]').click() + + cy.get(".ant-modal-footer > .ant-btn-primary > .ant-btn-icon > .anticon > svg").click() + cy.wait(1000) +}) diff --git a/agenta-web/cypress/support/commands/index.ts b/agenta-web/cypress/support/commands/index.ts index b1da828cac..3944f7d7ed 100644 --- a/agenta-web/cypress/support/commands/index.ts +++ b/agenta-web/cypress/support/commands/index.ts @@ -13,6 +13,7 @@ declare global { saveOpenAiKey(): Chainable removeLlmProviderKey(): Chainable addingOpenaiKey(): Chainable + createNewEvaluation(): Chainable } } } From 358320de015b8095c9a4af6f3c9c86bd102847a9 Mon Sep 17 00:00:00 2001 From: MohammedMaaz Date: Wed, 14 Feb 2024 13:01:09 +0500 Subject: [PATCH 03/23] paying org check in app selector --- .../components/AppSelector/AppSelector.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/agenta-web/src/components/AppSelector/AppSelector.tsx b/agenta-web/src/components/AppSelector/AppSelector.tsx index 3c35672c45..2829d24629 100644 --- a/agenta-web/src/components/AppSelector/AppSelector.tsx +++ b/agenta-web/src/components/AppSelector/AppSelector.tsx @@ -1,11 +1,9 @@ import {useState, useEffect, useMemo} from "react" -import {useRouter} from "next/router" import {PlusOutlined} from "@ant-design/icons" -import {Input, Modal, ConfigProvider, theme, Spin, Card, Button, notification, Divider} from "antd" +import {Input, Modal, ConfigProvider, theme, Card, Button, notification, Divider} from "antd" import AppCard from "./AppCard" import {Template, GenericObject} from "@/lib/Types" import {useAppTheme} from "../Layout/ThemeContextProvider" -import {CloseCircleFilled} from "@ant-design/icons" import TipsAndFeatures from "./TipsAndFeatures" import Welcome from "./Welcome" import { @@ -31,6 +29,7 @@ import {useProfileData} from "@/contexts/profile.context" import CreateAppStatusModal from "./modals/CreateAppStatusModal" import {usePostHogAg} from "@/hooks/usePostHogAg" import ResultComponent from "../ResultComponent/ResultComponent" +import {dynamicContext} from "@/lib/helpers/dynamic" type StyleProps = { themeMode: "dark" | "light" @@ -128,6 +127,14 @@ const AppSelector: React.FC = () => { details: undefined, appId: undefined, }) + const [useOrgData, setUseOrgData] = useState(() => () => "") + const {selectedOrg} = useOrgData() + + useEffect(() => { + dynamicContext("org.context", {useOrgData}).then((context) => { + setUseOrgData(() => context.useOrgData) + }) + }, []) useEffect(() => { getAllProviderLlmKeys() @@ -284,7 +291,11 @@ const AppSelector: React.FC = () => { { - if (isDemo() && apps.length > 2) { + if ( + isDemo() && + selectedOrg?.is_paying == false && + apps.length > 2 + ) { showMaxAppError() } else { showCreateAppModal() From 7c60a7cfdf061b18be0e0e12f2c76d5564813b26 Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Wed, 14 Feb 2024 13:54:15 +0100 Subject: [PATCH 04/23] rename migrations folders and bump versions --- .../agenta_backend/migrations/README.md | 51 ----------------- .../20240110001454_initial_migration.py | 0 ...547_create_exact_match_evaluator_config.py | 0 .../20240110165900_evaluations_revamp.py | 0 ...40112120721_evaluation_scenarios_revamp.py | 0 ...12120740_human_a_b_evaluation_scenarios.py | 0 ...human_single_model_evaluation_scenarios.py | 0 ...1802_new_evaluation_results_aggregation.py | 0 ...04909_change_odmantic_reference_to_link.py | 0 .../20240130133518_updating_app_variant.py | 0 ...40130133544_create_app_variant_revision.py | 0 ...20240130133603_updating_app_environment.py | 0 .../20240130140202_connection_evaluation.py | 0 ...0240124174954_evaluation_error_handling.py | 0 ...5808_evaluation_scenario_error_handling.py | 0 agenta-backend/pyproject.toml | 2 +- agenta-cli/pyproject.toml | 2 +- agenta-web/package.json | 4 +- docs/self-host/migration.mdx | 55 ++++++++++++------- 19 files changed, 40 insertions(+), 74 deletions(-) delete mode 100644 agenta-backend/agenta_backend/migrations/README.md rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240110001454_initial_migration.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240110132547_create_exact_match_evaluator_config.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240110165900_evaluations_revamp.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240112120721_evaluation_scenarios_revamp.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240112120740_human_a_b_evaluation_scenarios.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240112120800_human_single_model_evaluation_scenarios.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240113131802_new_evaluation_results_aggregation.py (100%) rename agenta-backend/agenta_backend/migrations/{17_01_24_pydantic_and_evaluations => v0_7_0_to_v0_8_0}/20240113204909_change_odmantic_reference_to_link.py (100%) rename agenta-backend/agenta_backend/migrations/{30_01_24_prompt_versioning => v0_8_0_to_v0_9_0}/20240130133518_updating_app_variant.py (100%) rename agenta-backend/agenta_backend/migrations/{30_01_24_prompt_versioning => v0_8_0_to_v0_9_0}/20240130133544_create_app_variant_revision.py (100%) rename agenta-backend/agenta_backend/migrations/{30_01_24_prompt_versioning => v0_8_0_to_v0_9_0}/20240130133603_updating_app_environment.py (100%) rename agenta-backend/agenta_backend/migrations/{30_01_24_prompt_versioning => v0_8_0_to_v0_9_0}/20240130140202_connection_evaluation.py (100%) rename agenta-backend/agenta_backend/migrations/{24_01_24_error_and_result => v0_9_0_to_v10_0_0}/20240124174954_evaluation_error_handling.py (100%) rename agenta-backend/agenta_backend/migrations/{24_01_24_error_and_result => v0_9_0_to_v10_0_0}/20240124225808_evaluation_scenario_error_handling.py (100%) diff --git a/agenta-backend/agenta_backend/migrations/README.md b/agenta-backend/agenta_backend/migrations/README.md deleted file mode 100644 index fce2f5aba4..0000000000 --- a/agenta-backend/agenta_backend/migrations/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Database Migrations - -This guide outlines the process for performing database migrations using Beanie with the Agenta backend system. - -Beanie is a MongoDB ODM (Object Document Mapper) for Python. More information about Beanie can be found [here](https://github.com/roman-right/beanie). - -## Steps for Migration - -### Accessing the Backend Docker Container - -To access the backend Docker container: - -1. **List Docker Containers**: List all running Docker containers with the command: - - ```bash - docker ps - ``` - -2. **Identify the `agenta-backend` Container ID**: Note down the container ID from the output. Example output: - - ``` - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES - ae0c56933636 agenta-backend "uvicorn agenta_back…" 3 hours ago Up 3 hours 8000/tcp agenta-backend-1 - e35f6c8b7fcb agenta-agenta-web "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:3000->3000/tcp agenta-agenta-web-1 - ``` - -3. **SSH into the Container**: Use the following command, replacing `CONTAINER_ID` with your container's ID: - - ```bash - docker exec -it CONTAINER_ID bash - ``` - -### Performing the Migration - -To perform the database migration: - -1. **Navigate to Migration Directory**: Change the directory to the migration folder: - - ```sh - cd agenta_backend/migrations/{migration_name} - ``` - Replace `{migration_name}` with the actual migration name, e.g., `17_01_24_pydantic_and_evaluations`. - -2. **Run Beanie Migration**: Execute the migration command: - - ```sh - beanie migrate --no-use-transaction -uri 'mongodb://username:password@mongo' -db 'agenta_v2' -p . - ``` - Ensure to replace `username`, `password`, and other placeholders with actual values. - -Follow these steps for a successful database migration in your Agenta backend system. \ No newline at end of file diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240110001454_initial_migration.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240110001454_initial_migration.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240110001454_initial_migration.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240110001454_initial_migration.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240110132547_create_exact_match_evaluator_config.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240110132547_create_exact_match_evaluator_config.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240110132547_create_exact_match_evaluator_config.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240110132547_create_exact_match_evaluator_config.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240110165900_evaluations_revamp.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240110165900_evaluations_revamp.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240110165900_evaluations_revamp.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240110165900_evaluations_revamp.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240112120721_evaluation_scenarios_revamp.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240112120721_evaluation_scenarios_revamp.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240112120721_evaluation_scenarios_revamp.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240112120721_evaluation_scenarios_revamp.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240112120740_human_a_b_evaluation_scenarios.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240112120740_human_a_b_evaluation_scenarios.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240112120740_human_a_b_evaluation_scenarios.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240112120740_human_a_b_evaluation_scenarios.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240112120800_human_single_model_evaluation_scenarios.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240112120800_human_single_model_evaluation_scenarios.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240112120800_human_single_model_evaluation_scenarios.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240112120800_human_single_model_evaluation_scenarios.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240113131802_new_evaluation_results_aggregation.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240113131802_new_evaluation_results_aggregation.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240113131802_new_evaluation_results_aggregation.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240113131802_new_evaluation_results_aggregation.py diff --git a/agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240113204909_change_odmantic_reference_to_link.py b/agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240113204909_change_odmantic_reference_to_link.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/20240113204909_change_odmantic_reference_to_link.py rename to agenta-backend/agenta_backend/migrations/v0_7_0_to_v0_8_0/20240113204909_change_odmantic_reference_to_link.py diff --git a/agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130133518_updating_app_variant.py b/agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130133518_updating_app_variant.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130133518_updating_app_variant.py rename to agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130133518_updating_app_variant.py diff --git a/agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130133544_create_app_variant_revision.py b/agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130133544_create_app_variant_revision.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130133544_create_app_variant_revision.py rename to agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130133544_create_app_variant_revision.py diff --git a/agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130133603_updating_app_environment.py b/agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130133603_updating_app_environment.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130133603_updating_app_environment.py rename to agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130133603_updating_app_environment.py diff --git a/agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130140202_connection_evaluation.py b/agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130140202_connection_evaluation.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/30_01_24_prompt_versioning/20240130140202_connection_evaluation.py rename to agenta-backend/agenta_backend/migrations/v0_8_0_to_v0_9_0/20240130140202_connection_evaluation.py diff --git a/agenta-backend/agenta_backend/migrations/24_01_24_error_and_result/20240124174954_evaluation_error_handling.py b/agenta-backend/agenta_backend/migrations/v0_9_0_to_v10_0_0/20240124174954_evaluation_error_handling.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/24_01_24_error_and_result/20240124174954_evaluation_error_handling.py rename to agenta-backend/agenta_backend/migrations/v0_9_0_to_v10_0_0/20240124174954_evaluation_error_handling.py diff --git a/agenta-backend/agenta_backend/migrations/24_01_24_error_and_result/20240124225808_evaluation_scenario_error_handling.py b/agenta-backend/agenta_backend/migrations/v0_9_0_to_v10_0_0/20240124225808_evaluation_scenario_error_handling.py similarity index 100% rename from agenta-backend/agenta_backend/migrations/24_01_24_error_and_result/20240124225808_evaluation_scenario_error_handling.py rename to agenta-backend/agenta_backend/migrations/v0_9_0_to_v10_0_0/20240124225808_evaluation_scenario_error_handling.py diff --git a/agenta-backend/pyproject.toml b/agenta-backend/pyproject.toml index 0fb5c705e4..227782c285 100644 --- a/agenta-backend/pyproject.toml +++ b/agenta-backend/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "agenta_backend" -version = "0.2.2" +version = "0.12.0" description = "" authors = ["Mahmoud Mabrouk "] readme = "README.md" diff --git a/agenta-cli/pyproject.toml b/agenta-cli/pyproject.toml index a3c5cf3ea2..b2945565c2 100644 --- a/agenta-cli/pyproject.toml +++ b/agenta-cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "agenta" -version = "0.10.3" +version = "0.12.0" description = "The SDK for agenta is an open-source LLMOps platform." readme = "README.md" authors = ["Mahmoud Mabrouk "] diff --git a/agenta-web/package.json b/agenta-web/package.json index 603ae9f6c2..60bd6fbd6d 100644 --- a/agenta-web/package.json +++ b/agenta-web/package.json @@ -1,6 +1,6 @@ { - "name": "dashboard", - "version": "0.1.0", + "name": "agenta", + "version": "0.12.0", "private": true, "engines": { "node": ">=18" diff --git a/docs/self-host/migration.mdx b/docs/self-host/migration.mdx index 3c50e37d2c..75d272cfd9 100644 --- a/docs/self-host/migration.mdx +++ b/docs/self-host/migration.mdx @@ -13,35 +13,52 @@ docker compose -f docker-compose.gh.yml up -d --pull always This command instructs Docker to fetch and use the latest version of the Agenta image. -### Migrating from Version 0.9 to 0.11 +# Database Migrations -1. **Executing the Beanie Migration**: Run the migration script as follows: - - ``` - docker compose exec -w /app/agenta_backend/migrations/v0_10_0_to_v0_11_0/ agenta-backend bash -c 'beanie migrate --no-use-transaction -uri $MONGODB_URI -db 'agenta_v2' -p .' - ``` +The steps below outlines the process for performing database migrations using Beanie with the Agenta backend system. -### Migrating from Version 0.8 to 0.9 +Beanie is a MongoDB ODM (Object Document Mapper) for Python. More information about Beanie can be found [here](https://github.com/roman-right/beanie). -1. **Executing the Beanie Migration**: Run the migration script as follows: - - ``` - docker compose exec -w /app/agenta_backend/migrations/30_01_24_prompt_versioning/ agenta-backend bash -c 'beanie migrate --no-use-transaction -uri $MONGODB_URI -db 'agenta_v2' -p .' +## Steps for Migration + +### Accessing the Backend Docker Container + +To access the backend Docker container: + +1. **List Docker Containers**: List all running Docker containers with the command: + + ```bash + docker ps ``` -### Migrating from Version 0.8 to 0.9 +2. **Identify the `agenta-backend` Container ID**: Note down the container ID from the output. Example output: -1. **Executing the Beanie Migration**: Run the migration script as follows: - ``` - docker compose exec -w /app/agenta_backend/migrations/24_01_24_error_and_result/ agenta-backend bash -c 'beanie migrate --no-use-transaction -uri $MONGODB_URI -db 'agenta_v2' -p .' + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + ae0c56933636 agenta-backend "uvicorn agenta_back…" 3 hours ago Up 3 hours 8000/tcp agenta-backend-1 + e35f6c8b7fcb agenta-agenta-web "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:3000->3000/tcp agenta-agenta-web-1 ``` -### Migrating from Version 0.7 to 0.8 +3. **SSH into the Container**: Use the following command, replacing `CONTAINER_ID` with your container's ID: -1. **Executing the Beanie Migration**: Run the migration script as follows: - + ```bash + docker exec -it CONTAINER_ID bash ``` - docker compose exec -w /app/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/ agenta-backend bash -c 'beanie migrate --no-use-transaction -uri $MONGODB_URI -db 'agenta_v2' -p .' + +### Performing the Migration + +To perform the database migration: + +1. **Navigate to the Migration Directory**: Change the directory to the migration folder: + + ```sh + cd agenta_backend/migrations/{migration_name} ``` + Replace `{migration_name}` with the actual migration name, e.g., `v0_10_0_to_v0_11_0`. + +2. **Run Beanie Migration**: Execute the migration command: + ```sh + beanie migrate --no-use-transaction -uri 'mongodb://username:password@mongo' -db 'agenta_v2' -p . + ``` + Ensure to replace `username`, `password`, and other placeholders with actual values. \ No newline at end of file From 85fe7aada21aadcf87c3f10dede4aec6747fcfaa Mon Sep 17 00:00:00 2001 From: Abram Date: Wed, 14 Feb 2024 16:30:38 +0100 Subject: [PATCH 05/23] Refactor - resolve NoneType when creating new evaluation scenario (in case of error) --- agenta-backend/agenta_backend/tasks/evaluations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agenta-backend/agenta_backend/tasks/evaluations.py b/agenta-backend/agenta_backend/tasks/evaluations.py index 2408824ccb..57a0cabc45 100644 --- a/agenta-backend/agenta_backend/tasks/evaluations.py +++ b/agenta-backend/agenta_backend/tasks/evaluations.py @@ -180,10 +180,12 @@ def evaluate( if correct_answer_column in data_point else "" ) + loop.run_until_complete( create_new_evaluation_scenario( user=app.user, - organization=app.organization, + organization=app.organization if isCloudEE() else None, + workspace=app.workspace if isCloudEE() else None, evaluation=new_evaluation_db, variant_id=variant_id, evaluators_configs=new_evaluation_db.evaluators_configs, From f736ed1222a9bf78d875a3253327594a66f399f1 Mon Sep 17 00:00:00 2001 From: MohammedMaaz Date: Wed, 14 Feb 2024 22:39:46 +0500 Subject: [PATCH 06/23] fixed is paying condition --- agenta-web/src/components/AppSelector/AppSelector.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agenta-web/src/components/AppSelector/AppSelector.tsx b/agenta-web/src/components/AppSelector/AppSelector.tsx index 2829d24629..584315bb1a 100644 --- a/agenta-web/src/components/AppSelector/AppSelector.tsx +++ b/agenta-web/src/components/AppSelector/AppSelector.tsx @@ -293,8 +293,8 @@ const AppSelector: React.FC = () => { onClick={() => { if ( isDemo() && - selectedOrg?.is_paying == false && - apps.length > 2 + !selectedOrg?.is_paying && + apps.length >= 3 ) { showMaxAppError() } else { From 54491d45ab48341d348b4142f9a096e9e50518a1 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 08:57:52 +0100 Subject: [PATCH 07/23] Update - added mongo_express back to test compose --- docker-compose.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 8be8cfcd99..65058140fb 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -22,7 +22,7 @@ services: - DOMAIN_NAME=http://localhost - CELERY_BROKER_URL=amqp://guest@rabbitmq// - CELERY_RESULT_BACKEND=redis://redis:6379/0 - - DATABASE_MODE=test + - DATABASE_MODE=v2 - FEATURE_FLAG=oss - OPENAI_API_KEY=${OPENAI_API_KEY} - AGENTA_TEMPLATE_REPO=agentaai/templates_v2 From 0136f5643e2ccc095e253903b9a79eac7acde490 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 10:15:29 +0100 Subject: [PATCH 08/23] Update - remove mongo-express and added mongo to celery worker service --- docker-compose.test.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 65058140fb..255b5d1094 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -61,21 +61,6 @@ services: networks: - agenta-network - mongo_express: - image: mongo-express:0.54.0 - environment: - ME_CONFIG_MONGODB_ADMINUSERNAME: username - ME_CONFIG_MONGODB_ADMINPASSWORD: password - ME_CONFIG_MONGODB_SERVER: mongo - ports: - - "8081:8081" - networks: - - agenta-network - depends_on: - mongo: - condition: service_healthy - restart: always - mongo: image: mongo:5.0 container_name: agenta-mongo-test @@ -130,6 +115,7 @@ services: - ./agenta-backend/agenta_backend:/app/agenta_backend - /var/run/docker.sock:/var/run/docker.sock depends_on: + - mongo - rabbitmq - redis extra_hosts: From 7cbd588ba48088bb7edd59539df2405a492a7fd6 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 10:33:35 +0100 Subject: [PATCH 09/23] Update - change database mode to test --- docker-compose.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 255b5d1094..81ea3c22eb 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -22,7 +22,7 @@ services: - DOMAIN_NAME=http://localhost - CELERY_BROKER_URL=amqp://guest@rabbitmq// - CELERY_RESULT_BACKEND=redis://redis:6379/0 - - DATABASE_MODE=v2 + - DATABASE_MODE=test - FEATURE_FLAG=oss - OPENAI_API_KEY=${OPENAI_API_KEY} - AGENTA_TEMPLATE_REPO=agentaai/templates_v2 From ab0306803ce8d8984171d6c43dfbe012522943a4 Mon Sep 17 00:00:00 2001 From: Mahmoud Mabrouk Date: Thu, 15 Feb 2024 10:56:10 +0100 Subject: [PATCH 10/23] Fix bug in batch_invoke and add assertion for app variant not found --- agenta-backend/agenta_backend/services/llm_apps_service.py | 6 +++--- agenta-backend/agenta_backend/tasks/evaluations.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/agenta-backend/agenta_backend/services/llm_apps_service.py b/agenta-backend/agenta_backend/services/llm_apps_service.py index e9c597e0a3..964d1bff35 100644 --- a/agenta-backend/agenta_backend/services/llm_apps_service.py +++ b/agenta-backend/agenta_backend/services/llm_apps_service.py @@ -178,9 +178,9 @@ async def batch_invoke( "delay_between_batches" ] # Delay between batches (in seconds) - list_of_app_outputs: List[ - InvokationResult - ] = [] # Outputs after running all batches + list_of_app_outputs: List[InvokationResult] = ( + [] + ) # Outputs after running all batches openapi_parameters = await get_parameters_from_openapi(uri + "/openapi.json") async def run_batch(start_idx: int): diff --git a/agenta-backend/agenta_backend/tasks/evaluations.py b/agenta-backend/agenta_backend/tasks/evaluations.py index 2408824ccb..9f907a6b78 100644 --- a/agenta-backend/agenta_backend/tasks/evaluations.py +++ b/agenta-backend/agenta_backend/tasks/evaluations.py @@ -96,6 +96,7 @@ def evaluate( loop.run_until_complete(DBEngine().init_db()) app = loop.run_until_complete(fetch_app_by_id(app_id)) app_variant_db = loop.run_until_complete(fetch_app_variant_by_id(variant_id)) + assert app_variant_db, f"App variant with id {variant_id} not found!" app_variant_parameters = app_variant_db.config.parameters testset_db = loop.run_until_complete(fetch_testset_by_id(testset_id)) new_evaluation_db = loop.run_until_complete( From bc30ee7321bba08dc030d554932671fe8ef4b7d9 Mon Sep 17 00:00:00 2001 From: Mahmoud Mabrouk Date: Thu, 15 Feb 2024 10:58:36 +0100 Subject: [PATCH 11/23] format --- agenta-backend/agenta_backend/services/llm_apps_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agenta-backend/agenta_backend/services/llm_apps_service.py b/agenta-backend/agenta_backend/services/llm_apps_service.py index 964d1bff35..e9c597e0a3 100644 --- a/agenta-backend/agenta_backend/services/llm_apps_service.py +++ b/agenta-backend/agenta_backend/services/llm_apps_service.py @@ -178,9 +178,9 @@ async def batch_invoke( "delay_between_batches" ] # Delay between batches (in seconds) - list_of_app_outputs: List[InvokationResult] = ( - [] - ) # Outputs after running all batches + list_of_app_outputs: List[ + InvokationResult + ] = [] # Outputs after running all batches openapi_parameters = await get_parameters_from_openapi(uri + "/openapi.json") async def run_batch(start_idx: int): From 9e7c59c4413f96c81adb53ff092eb7a52fef3286 Mon Sep 17 00:00:00 2001 From: Mahmoud Mabrouk Date: Thu, 15 Feb 2024 10:59:57 +0100 Subject: [PATCH 12/23] m --- agenta-backend/agenta_backend/tasks/evaluations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agenta-backend/agenta_backend/tasks/evaluations.py b/agenta-backend/agenta_backend/tasks/evaluations.py index 9f907a6b78..eb5a6e28d3 100644 --- a/agenta-backend/agenta_backend/tasks/evaluations.py +++ b/agenta-backend/agenta_backend/tasks/evaluations.py @@ -96,7 +96,9 @@ def evaluate( loop.run_until_complete(DBEngine().init_db()) app = loop.run_until_complete(fetch_app_by_id(app_id)) app_variant_db = loop.run_until_complete(fetch_app_variant_by_id(variant_id)) - assert app_variant_db, f"App variant with id {variant_id} not found!" + assert ( + app_variant_db is not None + ), f"App variant with id {variant_id} not found!" app_variant_parameters = app_variant_db.config.parameters testset_db = loop.run_until_complete(fetch_testset_by_id(testset_id)) new_evaluation_db = loop.run_until_complete( From bbb178909431b08b476025f1b9897f79b28d4ccf Mon Sep 17 00:00:00 2001 From: Mahmoud Mabrouk Date: Thu, 15 Feb 2024 11:19:42 +0100 Subject: [PATCH 13/23] added missing dependency --- docker-compose.test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 8be8cfcd99..f42cb94414 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -43,7 +43,7 @@ services: "--log-level", "info", "--root-path", - "/api", + "/api" ] labels: - "traefik.http.routers.backend.rule=PathPrefix(`/api/`)" @@ -132,6 +132,7 @@ services: depends_on: - rabbitmq - redis + - mongo extra_hosts: - host.docker.internal:host-gateway networks: From 59ed33e87bf47db750ea69b36028487c3ac26377 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 11:03:36 +0100 Subject: [PATCH 14/23] Update - added mongo to celery_worker depends_on --- docker-compose.gh.yml | 1 + docker-compose.prod.yml | 5 +++-- docker-compose.yml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.gh.yml b/docker-compose.gh.yml index 99d338ed4a..83d66b4b22 100644 --- a/docker-compose.gh.yml +++ b/docker-compose.gh.yml @@ -145,6 +145,7 @@ services: - ./agenta-backend/agenta_backend:/app/agenta_backend - /var/run/docker.sock:/var/run/docker.sock depends_on: + - mongo - rabbitmq - redis extra_hosts: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 7df348cc13..3425e8ed74 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -145,8 +145,9 @@ services: - ./agenta-backend/agenta_backend:/app/agenta_backend - /var/run/docker.sock:/var/run/docker.sock depends_on: - - rabbitmq - - redis + - mongo + - rabbitmq + - redis extra_hosts: - "host.docker.internal:host-gateway" networks: diff --git a/docker-compose.yml b/docker-compose.yml index e7c416aee2..5085c63711 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -149,6 +149,7 @@ services: - ./agenta-backend/agenta_backend:/app/agenta_backend - /var/run/docker.sock:/var/run/docker.sock depends_on: + - mongo - rabbitmq - redis extra_hosts: From 64d3e48480145d1c9ef2bae2a0df03143ef6be64 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 11:41:13 +0100 Subject: [PATCH 15/23] Update - revert database mode back to v2 --- docker-compose.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 81ea3c22eb..255b5d1094 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -22,7 +22,7 @@ services: - DOMAIN_NAME=http://localhost - CELERY_BROKER_URL=amqp://guest@rabbitmq// - CELERY_RESULT_BACKEND=redis://redis:6379/0 - - DATABASE_MODE=test + - DATABASE_MODE=v2 - FEATURE_FLAG=oss - OPENAI_API_KEY=${OPENAI_API_KEY} - AGENTA_TEMPLATE_REPO=agentaai/templates_v2 From 800f4cb966bbaa41f0f8fb0f73c34a4a1c3b1241 Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Thu, 15 Feb 2024 11:56:07 +0100 Subject: [PATCH 16/23] remove organization files not needed anymore --- .../models/api/organization_models.py | 30 ------- .../routers/organization_router.py | 82 ------------------- 2 files changed, 112 deletions(-) delete mode 100644 agenta-backend/agenta_backend/models/api/organization_models.py delete mode 100644 agenta-backend/agenta_backend/routers/organization_router.py diff --git a/agenta-backend/agenta_backend/models/api/organization_models.py b/agenta-backend/agenta_backend/models/api/organization_models.py deleted file mode 100644 index 8dac03abd5..0000000000 --- a/agenta-backend/agenta_backend/models/api/organization_models.py +++ /dev/null @@ -1,30 +0,0 @@ -from datetime import datetime -from bson import ObjectId -from typing import Optional, List -from pydantic import BaseModel, Field - - -class TimestampModel(BaseModel): - created_at: datetime = Field(datetime.now()) - updated_at: datetime = Field(datetime.now()) - - -class Organization(BaseModel): - id: Optional[str] - name: str - description: Optional[str] - type: Optional[str] - owner: str - members: Optional[List[str]] - invitations: Optional[List] - is_paying: Optional[bool] - - -class OrganizationUpdate(BaseModel): - name: Optional[str] - description: Optional[str] - - -class OrganizationOutput(BaseModel): - id: str - name: str diff --git a/agenta-backend/agenta_backend/routers/organization_router.py b/agenta-backend/agenta_backend/routers/organization_router.py deleted file mode 100644 index 29036203b8..0000000000 --- a/agenta-backend/agenta_backend/routers/organization_router.py +++ /dev/null @@ -1,82 +0,0 @@ -"""Routes for image-related operations (push, remove). -Does not deal with the instanciation of the images -""" - -import os -import logging -from fastapi import HTTPException, Request -from agenta_backend.utils.common import APIRouter -from agenta_backend.services.selectors import get_user_own_org -from agenta_backend.models.api.organization_models import ( - OrganizationOutput, - Organization, -) -from agenta_backend.services import db_manager - -if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: - from agenta_backend.commons.services.selectors import ( - get_user_and_org_id, - ) # noqa pylint: disable-all -else: - from agenta_backend.services.selectors import get_user_and_org_id - - -router = APIRouter() -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) - - -@router.get("/", response_model=list[Organization], operation_id="list_organizations") -async def list_organizations( - request: Request, -): - """ - Returns a list of organizations associated with the user's session. - - Args: - stoken_session (SessionContainer): The user's session token. - - Returns: - list[Organization]: A list of organizations associated with the user's session. - - Raises: - HTTPException: If there is an error retrieving the organizations from the database. - """ - - try: - user_org_data: dict = await get_user_and_org_id(request.state.user_id) - organizations_db = await db_manager.get_organizations_by_list_ids( - user_org_data["organization_ids"] - ) - response = [ - Organization( - id=str(org.id), - name=str(org.name), - description=str(org.description), - owner=str(org.owner), - is_paying=org.is_paying, - ).dict(exclude_unset=True) - for org in organizations_db - ] - - return response - - except Exception as e: - raise HTTPException( - status_code=500, - detail=str(e), - ) - - -@router.get("/own/", response_model=OrganizationOutput, operation_id="get_own_org") -async def get_user_organization( - request: Request, -): - try: - user_org_data: dict = await get_user_and_org_id(request.state.user_id) - org_db = await get_user_own_org(user_org_data["uid"]) - if org_db is None: - raise HTTPException(404, detail="User does not have an organization") - return OrganizationOutput(id=str(org_db.id), name=org_db.name) - except Exception as e: - raise HTTPException(status_code=500, detail=str(e)) From 50cfa28bdd9747906a7075bfc3b4678d764b9e42 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 13:01:27 +0100 Subject: [PATCH 17/23] Update - added mongo_express service back to test compose --- docker-compose.test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 255b5d1094..1644d0221b 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -61,6 +61,21 @@ services: networks: - agenta-network + mongo_express: + image: mongo-express:0.54.0 + environment: + ME_CONFIG_MONGODB_ADMINUSERNAME: username + ME_CONFIG_MONGODB_ADMINPASSWORD: password + ME_CONFIG_MONGODB_SERVER: mongo + ports: + - "8081:8081" + networks: + - agenta-network + depends_on: + mongo: + condition: service_healthy + restart: always + mongo: image: mongo:5.0 container_name: agenta-mongo-test From e842f34e84014d0877e4904f3eae65688686f84d Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 15 Feb 2024 13:02:50 +0100 Subject: [PATCH 18/23] Update - resolve failing to start test compose in github --- docker-compose.test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 1644d0221b..65058140fb 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -130,7 +130,6 @@ services: - ./agenta-backend/agenta_backend:/app/agenta_backend - /var/run/docker.sock:/var/run/docker.sock depends_on: - - mongo - rabbitmq - redis extra_hosts: From 22f57a8ba51e9b04df2f26870c38450cadf7b784 Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Thu, 15 Feb 2024 13:58:02 +0100 Subject: [PATCH 19/23] adjust check --- agenta-web/src/components/AppSelector/AppSelector.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agenta-web/src/components/AppSelector/AppSelector.tsx b/agenta-web/src/components/AppSelector/AppSelector.tsx index 584315bb1a..2829d24629 100644 --- a/agenta-web/src/components/AppSelector/AppSelector.tsx +++ b/agenta-web/src/components/AppSelector/AppSelector.tsx @@ -293,8 +293,8 @@ const AppSelector: React.FC = () => { onClick={() => { if ( isDemo() && - !selectedOrg?.is_paying && - apps.length >= 3 + selectedOrg?.is_paying == false && + apps.length > 2 ) { showMaxAppError() } else { From c2315628f1a520bf18c5a7ced098d7e3a129a39d Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Thu, 15 Feb 2024 16:20:48 +0100 Subject: [PATCH 20/23] Update docker-compose.test.yml --- docker-compose.test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 65058140fb..490866e05a 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -132,6 +132,8 @@ services: depends_on: - rabbitmq - redis + - mongo: + condition: service_healthy extra_hosts: - host.docker.internal:host-gateway networks: From b74079f7c6e36f7cef06f20290eae119b726a9fd Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Thu, 15 Feb 2024 16:25:47 +0100 Subject: [PATCH 21/23] Update docker-compose.test.yml --- docker-compose.test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 94caae0360..5e35d212fd 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -132,8 +132,7 @@ services: depends_on: - rabbitmq - redis - - mongo: - condition: service_healthy + - mongo extra_hosts: - host.docker.internal:host-gateway networks: From 3287c5c946099386222ed0d99342ddb8f1e3235f Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Thu, 15 Feb 2024 16:31:17 +0100 Subject: [PATCH 22/23] Update docker-compose.test.yml --- docker-compose.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 5e35d212fd..f42cb94414 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -22,7 +22,7 @@ services: - DOMAIN_NAME=http://localhost - CELERY_BROKER_URL=amqp://guest@rabbitmq// - CELERY_RESULT_BACKEND=redis://redis:6379/0 - - DATABASE_MODE=v2 + - DATABASE_MODE=test - FEATURE_FLAG=oss - OPENAI_API_KEY=${OPENAI_API_KEY} - AGENTA_TEMPLATE_REPO=agentaai/templates_v2 From 492c8d47b6b4718812a4c5c844710d232098db8b Mon Sep 17 00:00:00 2001 From: Akrem Abayed Date: Thu, 15 Feb 2024 16:38:51 +0100 Subject: [PATCH 23/23] add database mode to celery --- docker-compose.test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index f42cb94414..3fd1585b7f 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -126,6 +126,7 @@ services: - CELERY_BROKER_URL=amqp://guest@rabbitmq// - CELERY_RESULT_BACKEND=redis://redis:6379/0 - FEATURE_FLAG=oss + - DATABASE_MODE=test volumes: - ./agenta-backend/agenta_backend:/app/agenta_backend - /var/run/docker.sock:/var/run/docker.sock