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

f/switch to pg #959

Draft
wants to merge 297 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
297 commits
Select commit Hold shift + click to select a range
c6285aa
feat(memory-store): Normalize workflows table
creatorrr Dec 17, 2024
efebc06
fix(memory-store): Fix workflows table
creatorrr Dec 17, 2024
a4aac2c
feat(agents-api): add agent queries tests
Ahmad-mtos Dec 17, 2024
b139014
feat(memory-store): Add search plsql functions
creatorrr Dec 17, 2024
ba11683
fix(memory-store): Improve search plsql functions
creatorrr Dec 17, 2024
2d6cad0
feat: Add developer queries, create db connection pool
whiterabbit1983 Dec 17, 2024
f62b3c7
chore: Apply formating
whiterabbit1983 Dec 17, 2024
fb5755a
feat: Make dsn parameter optional
whiterabbit1983 Dec 17, 2024
6d8887d
fix: Fix tests
whiterabbit1983 Dec 17, 2024
495492d
test: Add more developers tests
whiterabbit1983 Dec 17, 2024
ce3dbc1
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 17, 2024
e89837e
Merge pull request #968 from julep-ai/f/developers-queries
whiterabbit1983 Dec 17, 2024
fc65e12
Merge remote-tracking branch 'origin/f/switch-to-pg' into f/test-pg-q…
Ahmad-mtos Dec 17, 2024
bd83d4f
feat(agents-api): Add sqlvalidator lint check
creatorrr Dec 17, 2024
c85c2fe
Merge branch 'f/switch-to-pg' into f/add-entry-queries
Vedantsahai18 Dec 17, 2024
8b6b0d9
wip(agents-api): Add session sql queries
creatorrr Dec 17, 2024
065c7d2
refactor: Lint agents-api (CI)
creatorrr Dec 17, 2024
2eb10d3
chore: developers and user refactor + add test for entry queries + bu…
Vedantsahai18 Dec 18, 2024
b064234
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 18, 2024
a728129
feat(agents-api): Fix tests for sessions
creatorrr Dec 18, 2024
372f320
refactor: Lint agents-api (CI)
creatorrr Dec 18, 2024
919c03a
feat(agents-api): implement agent queries and tests
Ahmad-mtos Dec 18, 2024
2b95fc2
Merge branch 'f/switch-to-pg' into f/test-pg-queries
Ahmad-mtos Dec 18, 2024
6f2ca23
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 18, 2024
c9d3139
Merge branch 'f/session-queries' into f/add-entry-queries
creatorrr Dec 18, 2024
5f9d5cc
fix(agents-api): misc fixes
Ahmad-mtos Dec 18, 2024
451a88f
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 18, 2024
94637ed
Merge pull request #971 from julep-ai/f/test-pg-queries
Ahmad-mtos Dec 18, 2024
2b907ef
wip(agents-api): Entry queries
creatorrr Dec 18, 2024
2b8686c
refactor: Lint agents-api (CI)
creatorrr Dec 18, 2024
94aa3ce
fix(agents-api): change modelname to model in BaseEntry
Ahmad-mtos Dec 18, 2024
a5d4301
Merge pull request #966 from julep-ai/f/add-entry-queries
Ahmad-mtos Dec 18, 2024
64a34cd
feat(agents-api): add agent queries tests
Ahmad-mtos Dec 17, 2024
8cc2ae3
feat(agents-api): implement agent queries and tests
Ahmad-mtos Dec 18, 2024
e745acc
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 18, 2024
2f392f7
fix(agents-api): misc fixes
Ahmad-mtos Dec 18, 2024
0579f3c
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 18, 2024
46a3b39
Merge branch 'f/switch-to-pg' into f/session-queries
creatorrr Dec 18, 2024
1b7a022
wip
Ahmad-mtos Dec 18, 2024
db31801
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 18, 2024
638fefb
chore: minor refactors
Vedantsahai18 Dec 18, 2024
2ba91ad
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 18, 2024
30b5763
fix(memory-store): Change association structure of files and docs
creatorrr Dec 19, 2024
116edf8
wip(agents-api): Add file sql queries
Vedantsahai18 Dec 19, 2024
57e453f
feat(memory-store,agents-api): Move is_leaf handling to postgres
creatorrr Dec 19, 2024
47c3fc9
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 19, 2024
14efb8b
Merge pull request #973 from julep-ai/x/doc-file-owner-migration
Vedantsahai18 Dec 19, 2024
cc2a5bf
chore: bug fixes for file queries + added tests
Vedantsahai18 Dec 19, 2024
f974fa0
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 19, 2024
bbdbb4b
fix(agents-api): fix sessions and agents queries / tests
Ahmad-mtos Dec 19, 2024
8361e7d
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 19, 2024
e158f3a
feat(agents-api): Remove auto_blob_store in favor of interceptor base…
creatorrr Dec 19, 2024
ca5f4e2
fix(agents-api): Minor fixes
creatorrr Dec 19, 2024
e5394fc
feat(agents-api): add entries tests
Ahmad-mtos Dec 19, 2024
619f973
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 19, 2024
0042b08
Merge pull request #970 from julep-ai/f/session-queries
Ahmad-mtos Dec 19, 2024
d3b222e
wip(agents-api,memory-store): Tasks queries
creatorrr Dec 19, 2024
978fd01
Merge branch 'f/switch-to-pg' into f/file-queries
Vedantsahai18 Dec 20, 2024
c88e8d7
chore: fix conflicts
Vedantsahai18 Dec 20, 2024
41739ee
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 20, 2024
0e32cbe
Merge pull request #974 from julep-ai/f/file-queries
Vedantsahai18 Dec 20, 2024
6c77490
wip(agents-api): Doc queries
Vedantsahai18 Dec 20, 2024
b427e38
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 20, 2024
d0d9f5c
Merge branch 'f/switch-to-pg' into f/task-queries
Ahmad-mtos Dec 20, 2024
48439d4
chore: Move ti queries directory
whiterabbit1983 Dec 18, 2024
7b6c502
feat: Add prepare chat context query
whiterabbit1983 Dec 19, 2024
ca12d65
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 19, 2024
0aecd61
feat: Add SQL validation
whiterabbit1983 Dec 19, 2024
0d288c4
chore: Import other required queries
whiterabbit1983 Dec 20, 2024
473387b
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 20, 2024
15659c5
chore: Move queries to another folder
whiterabbit1983 Dec 20, 2024
8a44cde
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 20, 2024
44122ca
feat: Add create tools query
whiterabbit1983 Dec 20, 2024
b19a001
feat: Add delete tool query
whiterabbit1983 Dec 20, 2024
e7d3079
feat: Add get tool query
whiterabbit1983 Dec 20, 2024
83f58ac
feat: Add list tools query
whiterabbit1983 Dec 20, 2024
59b24ac
feat: Add patch tool query
whiterabbit1983 Dec 20, 2024
32dbbba
fix: Fix return types
whiterabbit1983 Dec 20, 2024
281e1a8
feat: Add update tool query
whiterabbit1983 Dec 20, 2024
93673b7
fix: fixed the CRD doc queries + added tests
Vedantsahai18 Dec 20, 2024
7b0be5c
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 20, 2024
dc0ec36
wip: initial set of exceptions added
Vedantsahai18 Dec 20, 2024
32d67bc
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 20, 2024
831e950
chore: added embedding reading + doctrings updates
Vedantsahai18 Dec 20, 2024
74add36
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 20, 2024
249513d
chore: updated migrations + added indices support
Vedantsahai18 Dec 21, 2024
d7d9cd4
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 21, 2024
3600a92
Merge branch 'f/switch-to-pg' into f/doc-queries
creatorrr Dec 21, 2024
2900786
fix(memory-store): Remove redundant indices
creatorrr Dec 21, 2024
1a0fe16
feat(agents-api, memory-store): Add tasks queries and tests, and othe…
Ahmad-mtos Dec 21, 2024
e18756e
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 21, 2024
76819e1
Merge branch 'f/switch-to-pg' into f/simplify-blob-store
creatorrr Dec 21, 2024
1982583
Merge pull request #977 from julep-ai/f/simplify-blob-store
creatorrr Dec 21, 2024
004461c
Update async_s3.py
creatorrr Dec 21, 2024
b8cf8ce
Merge branch 'f/switch-to-pg' into f/task-queries
whiterabbit1983 Dec 21, 2024
ba86224
Merge pull request #978 from julep-ai/f/task-queries
whiterabbit1983 Dec 21, 2024
c2d54a4
fix: Miscellaneous fixes
creatorrr Dec 21, 2024
6a52a40
WIP
whiterabbit1983 Dec 21, 2024
8db396f
feat: Add executions queries
whiterabbit1983 Dec 21, 2024
65641cb
Merge branch 'f/switch-to-pg' into f/doc-queries
Vedantsahai18 Dec 21, 2024
f80ff87
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 21, 2024
747aceb
fix: Fix search_by_text; remove tools.task_version column
creatorrr Dec 22, 2024
b946119
fix: Fix canonical name collisions in tests
creatorrr Dec 22, 2024
4fc4f0e
refactor: Lint agents-api (CI)
creatorrr Dec 22, 2024
e2181fb
fix: Fix search by embedding
creatorrr Dec 22, 2024
934db8a
refactor: Lint agents-api (CI)
creatorrr Dec 22, 2024
791a8a9
Merge pull request #979 from julep-ai/f/doc-queries
creatorrr Dec 23, 2024
39589d2
wip
Ahmad-mtos Dec 23, 2024
3ae8d9e
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 23, 2024
daa41d6
chore: configure `users` router with pg queries
HamadaSalhab Dec 23, 2024
9b69b06
Merge branch 'f/configure-routers' of https://github.com/julep-ai/jul…
HamadaSalhab Dec 23, 2024
96e9b0e
chore: configure `tasks` router with pg queries
HamadaSalhab Dec 23, 2024
d580873
refactor: Lint agents-api (CI)
HamadaSalhab Dec 23, 2024
14b5761
wip
Ahmad-mtos Dec 23, 2024
bb9dd4a
Merge remote-tracking branch 'origin/f/executions-queries' into f/con…
Ahmad-mtos Dec 23, 2024
9ebd4ef
Merge remote-tracking branch 'origin/f/tools-queries' into f/configur…
Ahmad-mtos Dec 23, 2024
5887e12
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 23, 2024
ebe9922
chore: configure `sessions` router with pg queries
HamadaSalhab Dec 23, 2024
19e96ba
chore: configure `healthz` router with pg queries
HamadaSalhab Dec 23, 2024
d3e8831
chore: configure `files` router with pg queries
HamadaSalhab Dec 23, 2024
9853846
chore: add `executions` pg queries in `tasks` router
HamadaSalhab Dec 23, 2024
e976060
refactor: Lint agents-api (CI)
HamadaSalhab Dec 23, 2024
8d40526
fix(agents-api): Make query functions async
Ahmad-mtos Dec 23, 2024
b339e03
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 23, 2024
14d838d
chore: await asynchronous query functions in all routers
HamadaSalhab Dec 23, 2024
3bc5875
fix(agents-api): await async functions in routers
Ahmad-mtos Dec 23, 2024
969e38c
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 23, 2024
9d0068e
chore: Move ti queries directory
whiterabbit1983 Dec 18, 2024
780100b
feat: Add prepare chat context query
whiterabbit1983 Dec 19, 2024
c9fc757
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 19, 2024
1d2bd9a
feat: Add SQL validation
whiterabbit1983 Dec 19, 2024
1bc8fe3
chore: Import other required queries
whiterabbit1983 Dec 20, 2024
2975407
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 20, 2024
ba3027b
chore: Move queries to another folder
whiterabbit1983 Dec 20, 2024
5c060ac
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 20, 2024
47b7c7e
feat: Add create tools query
whiterabbit1983 Dec 20, 2024
b774589
feat: Add delete tool query
whiterabbit1983 Dec 20, 2024
b2806ac
feat: Add get tool query
whiterabbit1983 Dec 20, 2024
cf184e0
feat: Add list tools query
whiterabbit1983 Dec 20, 2024
53b65a1
feat: Add patch tool query
whiterabbit1983 Dec 20, 2024
3299d54
fix: Fix return types
whiterabbit1983 Dec 20, 2024
5e94d33
feat: Add update tool query
whiterabbit1983 Dec 20, 2024
0252a88
WIP
whiterabbit1983 Dec 21, 2024
d209e77
feat: Add tools args from metadata query
whiterabbit1983 Dec 23, 2024
8b54c80
fix(agents-api): Fix fixtures and initialization for app postgres client
creatorrr Dec 23, 2024
dfa5785
refactor: Lint agents-api (CI)
creatorrr Dec 23, 2024
583bf66
fix: Remove sql validation, fix tests
whiterabbit1983 Dec 23, 2024
128cc2f
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 23, 2024
3d6d023
fix: Fix awaitable and type hint
whiterabbit1983 Dec 23, 2024
1c97bc3
chore: Update type annotations
whiterabbit1983 Dec 23, 2024
358b60b
Merge pull request #982 from julep-ai/f/tools-queries
whiterabbit1983 Dec 23, 2024
60239fd
feat(agents-api): Add routes tests + misc fixes for queries
Ahmad-mtos Dec 23, 2024
5f3adc6
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 23, 2024
830206b
feat(agents-api): added docs hybrid search
Vedantsahai18 Dec 24, 2024
5f4aebc
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 24, 2024
d16a693
chore: skip dearch test + search queries optimized
Vedantsahai18 Dec 24, 2024
23235f4
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 24, 2024
34586d2
Merge pull request #985 from julep-ai/f/dsearch-queries
Vedantsahai18 Dec 24, 2024
6408232
Merge remote-tracking branch 'origin/f/switch-to-pg' into f/configure…
Ahmad-mtos Dec 24, 2024
11734e4
fix(agents-api): fix merge conflicts errors
Ahmad-mtos Dec 24, 2024
e1be81b
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 24, 2024
eadc291
fix(agents-api): Random fixes; make sure content-length is valid
creatorrr Dec 24, 2024
77903ef
refactor: Lint agents-api (CI)
creatorrr Dec 24, 2024
e015a51
Merge pull request #986 from julep-ai/f/configure-routers
Ahmad-mtos Dec 24, 2024
2f836d6
chore(agents-api): remove cozo related stuff
Ahmad-mtos Dec 24, 2024
c53319e
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 24, 2024
c68556f
feat(agents-api): added initial file routes patches for s3
Vedantsahai18 Dec 25, 2024
087a793
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 25, 2024
7913187
fix(agents-api): Fix failing file tests
creatorrr Dec 25, 2024
32dfd5f
chore: minor fix
Vedantsahai18 Dec 25, 2024
c37fcfc
Merge pull request #990 from julep-ai/f/file-routes
Vedantsahai18 Dec 25, 2024
1482eb7
feat: Add executions queries
whiterabbit1983 Dec 24, 2024
fb202c3
fix: Apply small fixes
whiterabbit1983 Dec 24, 2024
224ff5c
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 24, 2024
e929013
feat: Add create execution transition and remove update execution que…
whiterabbit1983 Dec 25, 2024
b766057
fix: Remove invalid import
whiterabbit1983 Dec 25, 2024
0a87266
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 25, 2024
13e4629
fix: Revert create execution
whiterabbit1983 Dec 25, 2024
ffc131b
fix: Add error handling
whiterabbit1983 Dec 25, 2024
9f20476
fix: Apply small fixes
whiterabbit1983 Dec 25, 2024
b24e4a6
fix: Fix test
whiterabbit1983 Dec 25, 2024
98d763b
fix: Fix query variables
whiterabbit1983 Dec 25, 2024
7ed5fda
fix: Fix query
whiterabbit1983 Dec 25, 2024
651c798
fix(agents-api): Fix tools tests
HamadaSalhab Dec 25, 2024
45dad2a
refactor: Lint agents-api (CI)
HamadaSalhab Dec 25, 2024
fb8d97f
fix(agents-api): Fix Tasks test
HamadaSalhab Dec 25, 2024
19d949f
Merge branch 'x/fix-tools-tests' of https://github.com/julep-ai/julep…
HamadaSalhab Dec 25, 2024
2e96022
refactor: Lint agents-api (CI)
HamadaSalhab Dec 25, 2024
ce47442
fix: Fix results mappings
whiterabbit1983 Dec 25, 2024
6646882
Merge pull request #992 from julep-ai/x/fix-tools-tests
Ahmad-mtos Dec 25, 2024
857bb96
Merge pull request #988 from julep-ai/f/executions-queries
Ahmad-mtos Dec 25, 2024
7ab2bb1
Merge branch 'f/switch-to-pg' into f/migrate-workflows-to-pg
Ahmad-mtos Dec 25, 2024
7798826
chore: remove cozo completely, and integrate postgres
Ahmad-mtos Dec 25, 2024
c0acb49
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 25, 2024
3caf682
Merge pull request #989 from julep-ai/f/migrate-workflows-to-pg
Ahmad-mtos Dec 25, 2024
eaada88
chore: misc refactor + fixed list file route test
Vedantsahai18 Dec 25, 2024
88ca072
refactor: Lint agents-api (CI)
Vedantsahai18 Dec 25, 2024
6a5fe63
chore: misc checks
Vedantsahai18 Dec 25, 2024
e155bb5
fix(agents-api): Fix update task query
Ahmad-mtos Dec 26, 2024
d5a9106
fix(migrations): Fix latest_executions not working for zero transitions
creatorrr Dec 26, 2024
f0deed9
fix(agents-api): Update TODO stuff
creatorrr Dec 26, 2024
0991b4c
fix: Fix migration
whiterabbit1983 Dec 26, 2024
594891a
fix: Remove unused parameters and fix queries
whiterabbit1983 Dec 26, 2024
4780439
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 26, 2024
9eff86e
fix: Fix list transitions query
whiterabbit1983 Dec 26, 2024
b115cab
fix: Fix list executions transitions query and add a test
whiterabbit1983 Dec 26, 2024
268fd3f
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 26, 2024
e962645
fix: Use transitions table
whiterabbit1983 Dec 26, 2024
4e1c975
Merge pull request #993 from julep-ai/f/executions-queries
whiterabbit1983 Dec 26, 2024
f4d449b
fix(agents-api): resolve conflicts
Ahmad-mtos Dec 26, 2024
b87f1f8
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 26, 2024
cde3773
fix(agents-api): Fixed create update queries and get task
Ahmad-mtos Dec 26, 2024
31ca260
misc
Ahmad-mtos Dec 26, 2024
3b188f3
refactor: Lint agents-api (CI)
Ahmad-mtos Dec 26, 2024
c038e97
fix(agents-api): Fix failing tests
creatorrr Dec 26, 2024
7011246
refactor: Lint agents-api (CI)
creatorrr Dec 26, 2024
15f5a89
fix(agents-api): Ghost in the machine
creatorrr Dec 26, 2024
798c625
refactor: Lint agents-api (CI)
creatorrr Dec 26, 2024
35344f1
fix(agents-api): fix get task query
Ahmad-mtos Dec 26, 2024
b5a8313
fix(agents-api): add agents_api_transitions to docker compose
Ahmad-mtos Dec 26, 2024
9b9bd73
Merge pull request #994 from julep-ai/x/fix-temporal-workflows
whiterabbit1983 Dec 26, 2024
59d3487
chore(agents-api): Remove tools from default system message
HamadaSalhab Dec 26, 2024
718d612
chore(agents-api): Swap `situation` and `system_template` values in `…
HamadaSalhab Dec 26, 2024
23de839
fix(agents-api): Misc fixes for chat endpoint
HamadaSalhab Dec 27, 2024
40c1a82
refactor: Lint agents-api (CI)
HamadaSalhab Dec 27, 2024
9e82981
Remove `sqlglot`
HamadaSalhab Dec 27, 2024
97982b6
Merge pull request #996 from julep-ai/c/session-situation-system-temp…
HamadaSalhab Dec 27, 2024
bf6f4d7
fix: fixed execution queries test
Vedantsahai18 Dec 27, 2024
fbb33c4
fix(agents-api): Fix tests for workflows
creatorrr Dec 27, 2024
d2cf26c
Merge pull request #998 from julep-ai/x/fix-test-workflow
whiterabbit1983 Dec 27, 2024
a3b8ec9
fix: Fix get task
whiterabbit1983 Dec 26, 2024
4824818
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 26, 2024
29aaf9a
chore: Re-activate tests, apply small fixes along the way
whiterabbit1983 Dec 26, 2024
e511078
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 26, 2024
b748469
fix: Await create pool
whiterabbit1983 Dec 27, 2024
742b1ef
fix: Apply various fixes to chat routes
whiterabbit1983 Dec 27, 2024
06fda32
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 27, 2024
88ba8bc
chore: Remove extra safety
whiterabbit1983 Dec 27, 2024
35e639c
chore: Set up Go migrate
whiterabbit1983 Dec 27, 2024
5839f6e
chore: Skip all execution workflow tests
whiterabbit1983 Dec 27, 2024
b3ffeaf
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 27, 2024
f06439f
chore: Comment out docs routes tests
whiterabbit1983 Dec 27, 2024
fece441
chore: Unskip tests
whiterabbit1983 Dec 27, 2024
ea37837
fix: Apply small fixes to docs logic
whiterabbit1983 Dec 27, 2024
c5377b9
fix: Add exception handling
whiterabbit1983 Dec 27, 2024
f13ab99
fix: Remove assertions
whiterabbit1983 Dec 27, 2024
4a3e14d
refactor: Lint agents-api (CI)
whiterabbit1983 Dec 27, 2024
505a25d
fix(agents-api): Fix tests for workflows
creatorrr Dec 27, 2024
2a186ba
refactor(agents-api): Refactors
creatorrr Dec 27, 2024
33ac790
Merge pull request #995 from julep-ai/x/fix-tests
creatorrr Dec 27, 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
3 changes: 2 additions & 1 deletion agents-api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Local database files
cozo.db
cozo*
.cozo*
temporal.db
*.bak
*.dat
Expand Down
4 changes: 1 addition & 3 deletions agents-api/agents_api/activities/demo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Callable

from temporalio import activity

from ..env import testing
Expand All @@ -14,6 +12,6 @@ async def mock_demo_activity(a: int, b: int) -> int:
return a + b


demo_activity: Callable[[int, int], int] = activity.defn(name="demo_activity")(
demo_activity = activity.defn(name="demo_activity")(
demo_activity if not testing else mock_demo_activity
)
1 change: 0 additions & 1 deletion agents-api/agents_api/activities/execute_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from beartype import beartype
from box import Box, BoxList
from fastapi import HTTPException
from fastapi.background import BackgroundTasks
from temporalio import activity

Expand Down
9 changes: 5 additions & 4 deletions agents-api/agents_api/activities/truncation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
def get_extra_entries(messages: list[Entry], token_count_threshold: int) -> list[UUID]:
raise NotImplementedError()

if not len(messages):
return messages
# if not len(messages):
# return messages

_token_cnt, _offset = 0, 0
# _token_cnt, _offset = 0, 0
# if messages[0].role == Role.system:
# token_cnt, offset = messages[0].token_count, 1

Expand All @@ -36,7 +36,8 @@ def get_extra_entries(messages: list[Entry], token_count_threshold: int) -> list
@activity.defn
@beartype
async def truncation(session_id: str, token_count_threshold: int) -> None:
session_id = UUID(session_id)
raise NotImplementedError()
# session_id = UUID(session_id)

# delete_entries(
# get_extra_entries(
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/common/utils/cozo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@


@beartype
def uuid_int_list_to_uuid4(data: list[int]) -> UUID:
def uuid_int_list_to_uuid(data: list[int]) -> UUID:
return UUID(bytes=b"".join([i.to_bytes(1, "big") for i in data]))
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/agent/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"""

from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import Agent, CreateAgentRequest
from ...common.utils.cozo import cozo_process_mutate_data
Expand Down Expand Up @@ -78,7 +79,7 @@ def create_agent(
Agent: The newly created agent record.
"""

agent_id = agent_id or uuid4()
agent_id = agent_id or uuid7()

# Extract the agent data from the payload
data.metadata = data.metadata or {}
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/docs/create_doc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Any, Literal, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateDocRequest, Doc
from ...common.utils.cozo import cozo_process_mutate_data
Expand Down Expand Up @@ -58,7 +59,7 @@ def create_doc(
data (CreateDocRequest): The content of the document.
"""

doc_id = str(doc_id or uuid4())
doc_id = str(doc_id or uuid7())
owner_id = str(owner_id)

if isinstance(data.content, str):
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/entry/create_entries.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateEntryRequest, Entry, Relation
from ...common.utils.cozo import cozo_process_mutate_data
Expand Down Expand Up @@ -58,7 +59,7 @@ def create_entries(
for item in data_dicts:
item["content"] = content_to_json(item["content"] or [])
item["session_id"] = session_id
item["entry_id"] = item.pop("id", None) or str(uuid4())
item["entry_id"] = item.pop("id", None) or str(uuid7())
item["created_at"] = (item.get("created_at") or utcnow()).timestamp()

cols, rows = cozo_process_mutate_data(data_dicts)
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/entry/get_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pydantic import ValidationError

from ...autogen.openapi_model import History
from ...common.utils.cozo import uuid_int_list_to_uuid4 as fix_uuid
from ...common.utils.cozo import uuid_int_list_to_uuid as fix_uuid
from ..utils import (
cozo_query,
partialclass,
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/execution/create_execution.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Annotated, Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateExecutionRequest, Execution
from ...common.utils.cozo import cozo_process_mutate_data
Expand Down Expand Up @@ -47,7 +48,7 @@ def create_execution(
execution_id: UUID | None = None,
data: Annotated[CreateExecutionRequest | dict, dict_like(CreateExecutionRequest)],
) -> tuple[list[str], dict]:
execution_id = execution_id or uuid4()
execution_id = execution_id or uuid7()

developer_id = str(developer_id)
task_id = str(task_id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import (
CreateTransitionRequest,
Expand Down Expand Up @@ -38,7 +39,7 @@ def _create_execution_transition(
update_execution_status: bool = False,
task_id: UUID | None = None,
) -> tuple[list[str | None], dict]:
transition_id = transition_id or uuid4()
transition_id = transition_id or uuid7()
data.metadata = data.metadata or {}
data.execution_id = execution_id

Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/files/create_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import base64
import hashlib
from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateFileRequest, File
from ...metrics.counters import increase_counter
Expand Down Expand Up @@ -79,7 +80,7 @@ def create_file(
developer_id (UUID): The unique identifier for the developer creating the file.
"""

file_id = file_id or uuid4()
file_id = file_id or uuid7()
file_data = data.model_dump(exclude={"content"})

content_bytes = base64.b64decode(data.content)
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/session/create_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"""

from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateSessionRequest, Session
from ...metrics.counters import increase_counter
Expand Down Expand Up @@ -57,7 +58,7 @@ def create_session(
Constructs and executes a datalog query to create a new session in the database.
"""

session_id = session_id or uuid4()
session_id = session_id or uuid7()

data.metadata = data.metadata or {}
session_data = data.model_dump(exclude={"auto_run_tools", "disable_cache"})
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/task/create_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"""

from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import (
CreateTaskRequest,
Expand Down Expand Up @@ -74,7 +75,7 @@ def create_task(
data.metadata = data.metadata or {}
data.input_schema = data.input_schema or {}

task_id = task_id or uuid4()
task_id = task_id or uuid7()
task_spec = task_to_spec(data)

# Prepares the update data by filtering out None values and adding user_id and developer_id.
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/tools/create_tools.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""This module contains functions for creating tools in the CozoDB database."""

from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateToolRequest, Tool
from ...metrics.counters import increase_counter
Expand Down Expand Up @@ -70,7 +71,7 @@ def create_tools(
tools_data = [
[
str(agent_id),
str(uuid4()),
str(uuid7()),
tool.type,
tool.name,
getattr(tool, tool.type) and getattr(tool, tool.type).model_dump(),
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/models/user/create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"""

from typing import Any, TypeVar
from uuid import UUID, uuid4
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError
from uuid_extensions import uuid7

from ...autogen.openapi_model import CreateUserRequest, User
from ...metrics.counters import increase_counter
Expand Down Expand Up @@ -80,7 +81,7 @@ def create_user(
pd.DataFrame: A DataFrame containing the result of the query execution.
"""

user_id = user_id or uuid4()
user_id = user_id or uuid7()
data.metadata = data.metadata or {}
user_data = data.model_dump()

Expand Down
4 changes: 2 additions & 2 deletions agents-api/agents_api/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pydantic import BaseModel
from requests.exceptions import ConnectionError, Timeout

from ..common.utils.cozo import uuid_int_list_to_uuid4
from ..common.utils.cozo import uuid_int_list_to_uuid
from ..env import do_verify_developer, do_verify_developer_owns_resource

P = ParamSpec("P")
Expand All @@ -36,7 +36,7 @@ def fix_uuid(
fixed = {
**item,
**{
attr: uuid_int_list_to_uuid4(item[attr])
attr: uuid_int_list_to_uuid(item[attr])
for attr in id_attrs
if isinstance(item[attr], list)
},
Expand Down
7 changes: 4 additions & 3 deletions agents-api/agents_api/routers/docs/create_doc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Annotated
from uuid import UUID, uuid4
from uuid import UUID

from fastapi import BackgroundTasks, Depends
from starlette.status import HTTP_201_CREATED
from temporalio.client import Client as TemporalClient
from uuid_extensions import uuid7

from ...activities.types import EmbedDocsPayload
from ...autogen.openapi_model import CreateDocRequest, Doc, ResourceCreatedResponse
Expand Down Expand Up @@ -82,7 +83,7 @@ async def create_user_doc(
data=data,
)

embed_job_id = uuid4()
embed_job_id = uuid7()

await run_embed_docs_task(
developer_id=x_developer_id,
Expand Down Expand Up @@ -113,7 +114,7 @@ async def create_agent_doc(
data=data,
)

embed_job_id = uuid4()
embed_job_id = uuid7()

await run_embed_docs_task(
developer_id=x_developer_id,
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/routers/sessions/chat.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Annotated, Optional
from uuid import UUID, uuid4
from uuid import UUID

from fastapi import BackgroundTasks, Depends, Header, HTTPException, status
from starlette.status import HTTP_201_CREATED
from uuid_extensions import uuid7

from ...autogen.openapi_model import (
ChatInput,
Expand Down Expand Up @@ -236,7 +237,7 @@ async def chat(
ChunkChatResponse if chat_input.stream else MessageChatResponse
)
chat_response: ChatResponse = chat_response_class(
id=uuid4(),
id=uuid7(),
created_at=utcnow(),
jobs=jobs,
docs=doc_references,
Expand Down
Loading
Loading