Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluations in backend #1137

Merged
merged 489 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
489 commits
Select commit Hold shift + click to select a range
a334553
cleanup evaluate.ts from old functions
MohammedMaaz Jan 2, 2024
8e3b50f
more human evals resources
aakrem Jan 2, 2024
cdb1c50
more resources for human evaluation
aakrem Jan 2, 2024
d836506
more human evals resources
aakrem Jan 2, 2024
7b55fb0
format
aakrem Jan 2, 2024
f04a995
Cleanup - added extra-hosts to celery_worker compose service
aybruhm Jan 2, 2024
76b2326
remove annotations
aakrem Jan 2, 2024
98ca02a
Merge branch 'evaluations-in-backend' into evaluations-tests
aybruhm Jan 2, 2024
07f0587
Update - modified test_create_evaluation
aybruhm Jan 2, 2024
809bfd2
Cleanup - added extra-hosts to celery_worker compose service
aybruhm Jan 2, 2024
107548a
more fixes
aakrem Jan 2, 2024
f87d21b
Merge branch 'evaluations-in-backend' into evaluations-tests
aybruhm Jan 2, 2024
26294fd
:art: Format - ran black
aybruhm Jan 2, 2024
bd636ee
fixed missing pages in annotations
MohammedMaaz Jan 2, 2024
a82e04c
Merge pull request #1122 from Agenta-AI/evaluations-tests
aakrem Jan 2, 2024
6136099
fetch human evaluations scenarios
aakrem Jan 2, 2024
92e5c14
fix results and update evaluation
aakrem Jan 2, 2024
7422743
UI improvements: empty component | duration counter | compare table h…
MohammedMaaz Jan 2, 2024
022976b
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
e4b0eab
fix delete human eval
aakrem Jan 2, 2024
95ef4ef
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
42f8492
fix 500 on single model result
aakrem Jan 2, 2024
626b1cc
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
3ff30b2
fix results for single model
aakrem Jan 2, 2024
69b813a
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
1c6ced4
add a direct-use attribute for evaluators
aakrem Jan 2, 2024
fd8b11e
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
7a32360
add logic to failed evals
aakrem Jan 2, 2024
c76cc3d
ui fixes | imporvements | refactoring
MohammedMaaz Jan 2, 2024
7731157
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
57b9dca
created at updated at for evaluator config
aakrem Jan 2, 2024
cd29d16
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 2, 2024
c823104
Feat - implemented batch invoke rpm rate-limiting logic
aybruhm Jan 3, 2024
ca3e151
Merge branch 'main' into evaluations-in-backend
aybruhm Jan 3, 2024
d343b2a
:art: Format - ran black
aybruhm Jan 3, 2024
d05265c
:art: Format - ran prettier
aybruhm Jan 3, 2024
2c902fd
Cleanup - remove redundant code
aybruhm Jan 3, 2024
9d4678a
Feat - created llm run rate limit api model
aybruhm Jan 3, 2024
1e8ecd5
Update agenta-backend/agenta_backend/routers/human_evaluation_router.py
aybruhm Jan 3, 2024
7ec73f9
Merge pull request #1140 from Agenta-AI/sync-main-with-evaluations
aakrem Jan 3, 2024
f584f75
remove ai critique table
aakrem Jan 3, 2024
9eb28bc
Feat - created llm run rate limit type
aybruhm Jan 3, 2024
a127ec6
Update - remove default values in llm run rate limit api model
aybruhm Jan 3, 2024
6f35a30
Update - modified batch_invoke function
aybruhm Jan 3, 2024
a28be48
Update - added extra inputs for evaluation run rate limit
aybruhm Jan 3, 2024
73a4653
Update - pass in rate_limit api model dict
aybruhm Jan 3, 2024
38b593a
:art: Format - ran black and prettier
aybruhm Jan 3, 2024
3a5a193
Merge branch 'evaluations-in-backend' into evaluation-rate-limiting
aybruhm Jan 3, 2024
6429d7f
Update - wrapped entire logic in try-except block
aybruhm Jan 3, 2024
06f5379
Update - include rate_limit data in create_evaluation testcase
aybruhm Jan 3, 2024
d732b06
installed beanie
devgenix Jan 3, 2024
bc61f0a
fixed prettier whitespace issue
MohammedMaaz Jan 3, 2024
04ca8bf
refactor models to use beanie
devgenix Jan 3, 2024
f706856
set engine to use beanie ODM
devgenix Jan 3, 2024
47dbd65
invoked databse on application startup event
devgenix Jan 3, 2024
392a7de
first refcator update template to work with beanie odm
devgenix Jan 3, 2024
fb143e2
Update - added switch form item to show advanced rate-limit configura…
aybruhm Jan 3, 2024
1584608
:art: Format - ran prettier
aybruhm Jan 3, 2024
7ff2297
comparison logic
aakrem Jan 4, 2024
29fa6da
black
aakrem Jan 4, 2024
cbd89ba
refactor db_engine to return engine
devgenix Jan 4, 2024
10e39e3
refactor db_manager to use beanie odm
devgenix Jan 4, 2024
1792609
refactor commons to use beanie odm
devgenix Jan 4, 2024
7b3b446
Refactor - migrate selectors service from odmantic to beanie
aybruhm Jan 4, 2024
3dfdf04
Merge pull request #1148 from Agenta-AI/evaluation-rate-limiting
aakrem Jan 4, 2024
7fdb8c6
Refactor - switch to beanie odm and referenced documents using link
aybruhm Jan 4, 2024
134556a
comparison results
aakrem Jan 4, 2024
9ea844a
black
aakrem Jan 4, 2024
636c6c4
fix evaluations scenarios
aakrem Jan 4, 2024
d11b567
Refactor - migrate to beanie and fix bugs that arose in: creating app…
aybruhm Jan 4, 2024
dfa918f
Update - modified webhook test evaluator settings template
aybruhm Jan 5, 2024
6daaa04
Refactor - migrate to beanie and fix bugs that arose in: evaluators, …
aybruhm Jan 5, 2024
90072f3
fix evaluations getting same output from llm
aakrem Jan 5, 2024
523f193
fail evaluation in case empty params or empty inputs
aakrem Jan 5, 2024
8afe250
fix build
aakrem Jan 5, 2024
f81f1a5
Update - bump packages in agenta-cli poetry.lock
aybruhm Jan 5, 2024
836e6aa
Refactor - migrate to beanie and fix bugs that arose in human evaluat…
aybruhm Jan 5, 2024
89fca56
:art: Format - ran black
aybruhm Jan 5, 2024
582a857
Merge branch 'evaluations-in-backend' into 1139-migrate-to-beanie
aybruhm Jan 5, 2024
3ff3c20
Refactor - migrate odmantic to beanie in backend testcases
aybruhm Jan 5, 2024
9d8549b
add direct use in evaluator config
aakrem Jan 5, 2024
23aa548
comparisonResult type
MohammedMaaz Jan 5, 2024
fedc982
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 5, 2024
8e4fe8f
remove direct-use
aakrem Jan 5, 2024
90277bc
small method refactor
aakrem Jan 5, 2024
4a76e0a
add ready to use evaluators
aakrem Jan 5, 2024
777fb49
Update - modified logic to aggregate results for single model test
aybruhm Jan 6, 2024
8fda5d6
Update - change from evaluation to annotations
aybruhm Jan 6, 2024
bb23323
Update - save variant configuration and default variant parameters
aybruhm Jan 6, 2024
fa234ec
Update - refactor testcases
aybruhm Jan 6, 2024
12328d8
Update - clean up unused codes
aybruhm Jan 6, 2024
17190f2
Update - modified event db manager and db engine
aybruhm Jan 6, 2024
ff82a36
:art: Format - ran black
aybruhm Jan 6, 2024
fdf5eb2
Update- modified main lifespan
aybruhm Jan 6, 2024
fd8559c
Update - modified auto_webhook_test evaluator service
aybruhm Jan 7, 2024
d307e4d
Update - modified conftest
aybruhm Jan 7, 2024
2005016
:art: Format - ran black
aybruhm Jan 7, 2024
e5e4887
Cleanup - remove todo note
aybruhm Jan 7, 2024
9512e96
Update - modified query for fetching evaluation scenarios
aybruhm Jan 7, 2024
53d1dcf
Update - make use of app variant config parameters
aybruhm Jan 7, 2024
4636a49
Refactor - renamed db settings collection to name
aybruhm Jan 7, 2024
e74417a
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 8, 2024
7188d97
feature: evaluation comparison on frontend
MohammedMaaz Jan 8, 2024
321a41f
bug fix in compare - remove variant | null checks in compare page
MohammedMaaz Jan 8, 2024
26de2c9
Update - remove traceback debug
aybruhm Jan 8, 2024
e94493e
Merge branch 'evaluations-in-backend' into 1139-migrate-to-beanie
aybruhm Jan 8, 2024
2fa578d
Merge pull request #1149 from Agenta-AI/1139-migrate-to-beanie
aybruhm Jan 8, 2024
548b3ce
Merge branch 'main' into evaluations-in-backend
aybruhm Jan 8, 2024
03e7efa
Cleanup - remove redundant db/api models and code
aybruhm Jan 8, 2024
71c7100
Merge pull request #1168 from Agenta-AI/cleanup-evaluations
aybruhm Jan 8, 2024
0b753a5
Cleanup - refactor user_service to make use of beanie odm
aybruhm Jan 8, 2024
c16f0c4
fixed bug in evaluation_config not read correctly in aggregated_results
MohammedMaaz Jan 8, 2024
206ae00
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 8, 2024
c52a78a
Merge branch 'main' into sub-issue-1167/-cypress-tests-for-new-evalua…
bekossy Jan 8, 2024
41b4f76
fixed TS error in DynamicFormField
MohammedMaaz Jan 8, 2024
a191f3f
reverted dev.dockerFile code suppression
MohammedMaaz Jan 8, 2024
b92766f
removed previous e2e tests
bekossy Jan 8, 2024
f0d9e1e
test: single model test
bekossy Jan 8, 2024
0708310
crud test for evaluators
bekossy Jan 8, 2024
aac9858
improvements in previous tests
bekossy Jan 8, 2024
013a2a9
test: CRUD operation for evaluation and comparison
bekossy Jan 8, 2024
6ea59ae
test: eval scenarios
bekossy Jan 8, 2024
1eb0785
Merge branch 'evaluations-in-backend' into sub-issue-1167/-cypress-te…
bekossy Jan 8, 2024
4001f41
improve test descriptions
bekossy Jan 9, 2024
f8d1976
assertion error fix
bekossy Jan 9, 2024
b47822c
commented out code causing tests to fail
bekossy Jan 9, 2024
3e89a6f
formatter fix
bekossy Jan 9, 2024
3be23e2
Fixed BE issue in create annotation
MohammedMaaz Jan 9, 2024
02c4189
@aakrem This does not exist in python
mmabrouk Jan 9, 2024
cf6bd5f
fix naming and docstring
mmabrouk Jan 9, 2024
5109e24
conditional for dayjs to prevent cypress errors
bekossy Jan 9, 2024
ed013e3
EvaluationDB now uses one variant instead of multiple
mmabrouk Jan 9, 2024
274fec6
fixed human eval
mmabrouk Jan 9, 2024
b678e44
Update - rename fine_one to find_one
aybruhm Jan 9, 2024
6c0210f
refactored cals to create_new_evaluation
mmabrouk Jan 9, 2024
3536beb
fix get_image_by_id
aakrem Jan 9, 2024
5e25072
fix call
mmabrouk Jan 9, 2024
bc4f789
Refactor evaluation functions to accept inputs and output
mmabrouk Jan 9, 2024
edd16ca
refactor evaluations
mmabrouk Jan 9, 2024
0153041
Merge pull request #1170 from Agenta-AI/sub-issue-1167/-cypress-tests…
mmabrouk Jan 9, 2024
edcec0c
fix llm app service
mmabrouk Jan 9, 2024
1af641b
fix llm calls and refactor
mmabrouk Jan 9, 2024
546da39
bf
mmabrouk Jan 9, 2024
c70dd4f
bf
mmabrouk Jan 9, 2024
e5e7837
fixed failure state
mmabrouk Jan 9, 2024
dce3597
chat fix
mmabrouk Jan 9, 2024
0dfa3de
fix chat
mmabrouk Jan 9, 2024
f1cfea5
formatting
mmabrouk Jan 9, 2024
33a91d8
refactor
mmabrouk Jan 9, 2024
ecb574a
format
mmabrouk Jan 9, 2024
fb0bcce
Merge pull request #1172 from Agenta-AI/refactor-evaluations-backend
mmabrouk Jan 9, 2024
057d93f
merge main
mmabrouk Jan 9, 2024
10e3328
Merge pull request #1173 from Agenta-AI/merge_main_eval
mmabrouk Jan 9, 2024
0b76e7f
minor
mmabrouk Jan 9, 2024
935b3ec
Merge branch 'evaluations-in-backend' of https://github.com/agenta-ai…
mmabrouk Jan 9, 2024
4d09aed
Feat - created migrations module directory
aybruhm Jan 9, 2024
6d1ba47
Cleanup - remove duplicate field deletable in ImageDB document
aybruhm Jan 9, 2024
27f119f
add creating ready to use evaluators when starting from cli
aakrem Jan 10, 2024
a1cde2b
move evaluators creation to add_variant_from_image
aakrem Jan 10, 2024
6489daa
Update - added old evaluation db models
aybruhm Jan 10, 2024
55aa3fe
Update - added old evaluation db models to beanie
aybruhm Jan 10, 2024
515db5e
Feat - created migration file
aybruhm Jan 10, 2024
b4b35df
Update - modified migration script
aybruhm Jan 10, 2024
a7f0e3a
misc fixes
MohammedMaaz Jan 10, 2024
e1d9319
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 10, 2024
873fb19
Feat - created initial migration to rename reference fields
aybruhm Jan 10, 2024
3ca00ad
Cleanup - remove old db models
aybruhm Jan 10, 2024
91c6e4f
Cleanup - remove old db models
aybruhm Jan 10, 2024
d9691f6
add logic for sending lm keys without saving them
aakrem Jan 10, 2024
afb95ad
fixed chat based testset for new evaluations
MohammedMaaz Jan 10, 2024
5bbadfe
added lm_providers_keys field in create evaluation payload
MohammedMaaz Jan 10, 2024
bcb0df2
fixes
aakrem Jan 11, 2024
87eacc9
small refactor
aakrem Jan 11, 2024
4d7d06a
Merge pull request #1181 from Agenta-AI/lm-keys
aakrem Jan 11, 2024
4911109
rename open_ai to openai
aakrem Jan 11, 2024
0bb3742
only redirect for no llm keys in case of ai critiquie
MohammedMaaz Jan 11, 2024
eeaf2ab
Merge branch 'evaluations-in-backend' of https://github.com/Agenta-AI…
MohammedMaaz Jan 11, 2024
72d6802
made evaluator columns header consistent across screens
MohammedMaaz Jan 11, 2024
fa02500
Update - added logic to migrate old evaluation scenario to new auto/h…
aybruhm Jan 11, 2024
aa45abd
:art: Format - ran black
aybruhm Jan 11, 2024
090002a
Update - modified evaluations revamp migration logic
aybruhm Jan 11, 2024
6ce0592
Merge pull request #1179 from Agenta-AI/schemas-migrations
mmabrouk Jan 11, 2024
89c355e
Merge branch 'main' into main-to-evaluations-in-backend
aakrem Jan 11, 2024
1b3f505
Merge pull request #1187 from Agenta-AI/main-to-evaluations-in-backend
aakrem Jan 11, 2024
2e7fc64
fix for the new lm app response
aakrem Jan 11, 2024
a4fd1c0
fixed issue with inputs in eval
mmabrouk Jan 11, 2024
434b2e6
Merge pull request #1188 from Agenta-AI/fix_inputs_issue
mmabrouk Jan 11, 2024
623e97d
Feat - created migration file to change odmantic reference to link
aybruhm Jan 12, 2024
b7833ed
Update - conclude iterative migraiton logic to change odmantic refere…
aybruhm Jan 12, 2024
109fbc8
row click improved | empty state ui in results page
MohammedMaaz Jan 12, 2024
60da49f
Update - set default version to old evaluation models
aybruhm Jan 12, 2024
08a89ac
Update - added cleanup codes
aybruhm Jan 12, 2024
f3e07b5
Update - renamed current evaluation, scenarios collection with 'new_'…
aybruhm Jan 12, 2024
a352d1d
Update - modified migration for evaluations revamp
aybruhm Jan 12, 2024
3e8cbce
Update - modified logic to migrate old evaluation scenario
aybruhm Jan 12, 2024
9f8f798
Update - refactor migrate old evaluation scenario logic
aybruhm Jan 12, 2024
784adea
Update - added print debug statements
aybruhm Jan 12, 2024
5afb7b9
Update - modified migrate old evaluation scenario logic
aybruhm Jan 12, 2024
7b3d664
Update - cleanup evaluation service and modified evaluations revamp m…
aybruhm Jan 13, 2024
01a32e3
Feat - created evaluation scenarios revamp migration
aybruhm Jan 13, 2024
d7c481a
Update - remove evaluation scenario logic from evaluation revamp migr…
aybruhm Jan 13, 2024
b38eca0
Update - switch timestamp between 3rd and 4th migration files
aybruhm Jan 13, 2024
657ce5b
Update - modified steps to allow creation of human evaluations
aybruhm Jan 13, 2024
dd8fe7b
Update - broke down human evaluation scenarios migration logic
aybruhm Jan 13, 2024
ea18aa9
Update - modified step 2 logic in evaluations revamp migration
aybruhm Jan 13, 2024
508416c
Update - cleanup and format evaluations revamp migration
aybruhm Jan 13, 2024
2774ff9
Update - modified logic to include evaluator result for evaluation re…
aybruhm Jan 13, 2024
01ce41e
Update - modified evaluator config db model
aybruhm Jan 13, 2024
85ae65f
Update - tiny cleanup and format
aybruhm Jan 13, 2024
d989fbb
Update - tiny cleanup and format
aybruhm Jan 13, 2024
7943810
Feat - created migration logic to aggregated evaluation scenarios res…
aybruhm Jan 13, 2024
42eb6c9
Update - swtich timestamp between migration 4 and 5
aybruhm Jan 13, 2024
f057095
Update - added status to evaluation
aybruhm Jan 13, 2024
5071ff2
Merge pull request #1191 from Agenta-AI/reference-fields-migration
aakrem Jan 14, 2024
7e3083b
Update - modified logic to get_numeric_value for aggregated results
aybruhm Jan 15, 2024
a7590e6
Update - modify logic to assign evaluations to their respective users
aybruhm Jan 15, 2024
6f2e95b
Merge pull request #1205 from Agenta-AI/reference-fields-migration
aakrem Jan 15, 2024
cea8101
Merge branch 'main' into evaluations-in-backend
mmabrouk Jan 16, 2024
ec0f59d
Update - rename AppEnvironmentDB collection name and modified query t…
aybruhm Jan 16, 2024
944d774
Update - modified migration 2 and 5 files
aybruhm Jan 16, 2024
6146555
add backup script to save time
aakrem Jan 16, 2024
6100cc9
reverted dev.dockerfile
mmabrouk Jan 16, 2024
b555eca
Merge branch 'evaluations-in-backend' of https://github.com/agenta-ai…
mmabrouk Jan 16, 2024
5565981
Update - modified logic to allow a/b evaluation to be separate after …
aybruhm Jan 16, 2024
26f7442
Update - fix merge conflicts
aybruhm Jan 16, 2024
a61d70f
Update - modified logic to allow a/b evaluation to be separate after …
aybruhm Jan 16, 2024
52abb7e
Merge branch 'evaluations-in-backend' into migration-issues-fix
aybruhm Jan 16, 2024
4e5e85f
bug fix in deletion of environments
mmabrouk Jan 16, 2024
a227847
format
mmabrouk Jan 16, 2024
eceec6e
Refactor - simplified logic to evaluation migration
aybruhm Jan 17, 2024
0c850cc
Refactor - simplify logic for evaluation scenarios
aybruhm Jan 17, 2024
757f668
Merge pull request #1214 from Agenta-AI/migration-issues-fix
aakrem Jan 17, 2024
14fe290
Update - put a 2 seconds sleept
aybruhm Jan 17, 2024
08676a0
Merge branch 'migration-issues-fix' into evaluations-in-backend
aybruhm Jan 17, 2024
cf41da4
Update - update results aggregation logic
aybruhm Jan 17, 2024
9405860
fix aggregations
aakrem Jan 17, 2024
e3318b4
Update - modified evaluations revamp migration
aybruhm Jan 17, 2024
ff281fb
Update - added backward compatibility for old templates
aybruhm Jan 17, 2024
1dc2082
Update - modify code to create custom code evaluator config
aybruhm Jan 17, 2024
3a223b3
Update - fix update app variant db manager
aybruhm Jan 17, 2024
cd55f03
add migration for exact match evaluator
aakrem Jan 17, 2024
6e6ab60
improve evaluator name
aakrem Jan 17, 2024
52de18e
remove verbose print
aakrem Jan 17, 2024
2829131
Merge branch 'Agenta-AI:evaluations-in-backend' into evaluations-in-b…
aybruhm Jan 17, 2024
d206a4c
ignore evals with deleted apps
aakrem Jan 17, 2024
887d5e9
move human evals to separated migrations
aakrem Jan 17, 2024
29fa37e
Merge branch 'main' into main-to-evaluations-in-backend
aakrem Jan 17, 2024
1415ab6
Merge pull request #1217 from Agenta-AI/main-to-evaluations-in-backend
aakrem Jan 17, 2024
12d06e8
format
aakrem Jan 17, 2024
027d477
format backend
aakrem Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions .github/workflows/run-backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,33 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Start Docker Compose
run: docker-compose -f "docker-compose.test.yml" up -d --build
- name: Set Environment Variables
run: |
echo "OPENAI_API_KEY=${{ secrets.NEXT_PUBLIC_OPENAI_API_KEY }}" >> $GITHUB_ENV

- name: Install Curl
run: sudo apt install curl -y

- name: Start Docker Compose
run: OPENAI_API_KEY=${{ secrets.NEXT_PUBLIC_OPENAI_API_KEY }} ENVIRONMENT=github docker-compose -f "docker-compose.test.yml" up -d --build

- name: Restart Backend Service To Fetch Template Images
run: docker container restart agenta-backend-test

- name: Check Templates Exists
run: |
sleep 10 && curl -i http://localhost/api/containers/templates/

- name: Wait for Backend Service
run: |
while true; do
if curl -s http://localhost:8000/openapi.json; then
break
fi
sleep 5
done
sleep 10 && curl -i http://localhost/api/openapi.json

- name: Run tests
run: docker exec agenta-backend-test pytest
run: sleep 10 && docker exec agenta-backend-test pytest

- name: Docker logs
if: always() #
run: docker ps -q | xargs -I {} docker logs {}

- name: Stop Docker Compose
run: docker-compose down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ agenta-web/cypress/screenshots/
agenta-web/cypress/videos/
.nextjs_cache/

rabbitmq_data
17 changes: 17 additions & 0 deletions agenta-backend/agenta_backend/celery_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
from kombu import Exchange, Queue

BROKER_URL = os.getenv("CELERY_BROKER_URL")
CELERY_RESULT_BACKEND = os.getenv("CELERY_RESULT_BACKEND")
CELERY_TASK_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ["json"]
CELERY_RESULT_SERIALIZER = "json"
CELERY_TIMEZONE = "UTC"

CELERY_QUEUES = (
Queue(
"agenta_backend.tasks.evaluations.evaluate",
Exchange("agenta_backend.tasks.evaluations.evaluate"),
routing_key="agenta_backend.tasks.evaluations.evaluate",
),
)
15 changes: 15 additions & 0 deletions agenta-backend/agenta_backend/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import os
import asyncio
from contextlib import asynccontextmanager

from agenta_backend.config import settings
from agenta_backend import celery_config
from agenta_backend.routers import (
app_router,
container_router,
environment_router,
evaluation_router,
human_evaluation_router,
evaluators_router,
observability_router,
organization_router,
testset_router,
Expand All @@ -16,6 +20,7 @@
configs_router,
health_router,
)
from agenta_backend.models.db_engine import DBEngine

if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]:
from agenta_backend.commons.services import templates_manager
Expand All @@ -25,13 +30,19 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from celery import Celery


origins = [
"http://localhost:3000",
"http://localhost:3001",
"http://0.0.0.0:3000",
"http://0.0.0.0:3001",
]

celery_app = Celery("agenta_app")
celery_app.config_from_object(celery_config)


@asynccontextmanager
async def lifespan(application: FastAPI, cache=True):
Expand All @@ -41,6 +52,8 @@ async def lifespan(application: FastAPI, cache=True):
application: FastAPI application.
cache: A boolean value that indicates whether to use the cached data or not.
"""
# initialize the database
await DBEngine().init_db()
await templates_manager.update_and_sync_templates(cache=cache)
yield

Expand Down Expand Up @@ -72,6 +85,8 @@ async def lifespan(application: FastAPI, cache=True):
app.include_router(app_router.router, prefix="/apps")
app.include_router(variants_router.router, prefix="/variants")
app.include_router(evaluation_router.router, prefix="/evaluations")
app.include_router(human_evaluation_router.router, prefix="/human-evaluations")
app.include_router(evaluators_router.router, prefix="/evaluators")
app.include_router(testset_router.router, prefix="/testsets")
app.include_router(container_router.router, prefix="/containers")
app.include_router(environment_router.router, prefix="/environments")
Expand Down
Loading
Loading