1001 Commits
Author SHA1 Message Date
Swifty b96d22b19e [AGPT-631] Fix docker setup (#186)
* Fixing docker setup

* Added comment back in

* formatting
2024-04-04 17:38:06 +02:00
Nicholas Tindle 867fad8baa feat: updates to our dockercompose for discussion (#177) 2024-04-04 17:38:06 +02:00
Zamil Majdyandmajdyz f2dbfa7e7c [AGPT-621] Moving on with code generation with a buggy code (Ruff - PyRight failure) (#181)
To prevent frustrated tester, we should let buggy code to be generated instead of failing the project generation (if it failed on the linter) by appending a # TODO line on the code.

---------

Co-authored-by: majdyz <[email protected]>
2024-04-04 17:38:06 +02:00
Nicholas Tindle 3bcfb7ebdf fix: run validate and formate and also fix the param used (#184) 2024-04-04 17:38:06 +02:00
Nicholas Tindle 0d48ab7f21 Add support for enhancing errors with context aware details (#180)
* fix: minor annoyance

* feat: v1 of error enhancement

* feat: refactor the initial implementation

* fix: linting 🙄

* feat: more loggin

* nit: typehinting
2024-04-04 17:38:06 +02:00
SwiftyOS 9bef9e7eba fix prisma query 2024-04-04 17:38:06 +02:00
Zamil Majdyandmajdyz dda4efce00 [AGPT-593] Avoid persisting request/response with no fields - Part 2 (#179)
Co-authored-by: majdyz <[email protected]>
2024-04-04 17:38:06 +02:00
Aarushi cc9b5f4591 [AGPT-596] Create .github/workflows and related deployment file (#175)
* Create .github/workflows and related deployment file

* Update packager.py
2024-04-04 17:38:06 +02:00
Zamil Majdyandmajdyz 8df7f7350f [AGPT-594] Introduce Event Logging (#169)
* Introduce event logging, captured event: All non-Get HTTP operations.
* Refactor routes.py on each API: removed redundant try-catch for unknown exception, use JsonResponse
* Fix broken api_test.py due to DB seeding being removed.

---------

Co-authored-by: majdyz <[email protected]>
2024-04-04 17:38:06 +02:00
Swifty 54bb30e2b8 [AGPT-510] Debugging Part 1: Auto Resume points, debug command start (#153)
* Add debug commands to codex main module

* Refactor debug command and add WhatToDebug model

* Refactor debug command and add explore_database function

* Add Interview field to Specification model

* Removed need for resume points table

* Formatting od debug messages

* poetry lock update

* Add migrations
2024-04-04 17:38:06 +02:00
Reinier van der Leer 0a55c40e4c feat(deploy): Switch generated requirements.txt to Poetry (#164)
- Add `create_pyproject` and `poetry_lock` subroutines in packager.py
- Replace step to create requirements.txt with step to create pyproject.toml and poetry.lock
- Add default value `None` to `python_path` parameter on `execute_command` utility function
- Update generated Dockerfile and README.md for switch to Poetry
2024-04-04 17:38:06 +02:00
Aarushi ee90e2d6aa Update health check to use db user and db name. (#173) 2024-04-04 17:38:06 +02:00
Zamil Majdyandmajdyz c429815fab Avoid persisting request/response with no fields (#176)
Co-authored-by: majdyz <[email protected]>
2024-04-04 17:38:06 +02:00
Reinier van der Leer 3bd5f4cb92 feat(deploy): Use gitpython for Git operations in packager (#168)
- Rewrite `git_init` subroutine in `deploy.packager` to use `gitpython` rather than `subcommand.run(["git", ...])`
- Add `gitpython` dependency
2024-04-04 17:38:06 +02:00
Nicholas Tindle d78622d65b fix: add migrations to docker image 2024-03-29 20:50:49 -05:00
Nicholas Tindle c13fcd7491 Merge pull request #150 from Significant-Gravitas/dev
Main <- Dev
2024-03-29 20:35:21 -05:00
Nicholas Tindle 827125ac26 Merge branch 'main' into dev 2024-03-29 19:06:51 -05:00
Reinier van der Leer 5906b3a0cf feat(cli): Add log statements to serve command for transparency 2024-03-29 15:06:33 +01:00
Reinier van der Leer 4eebc88766 fix(cli): Reduce load time
.. by moving module-level imports into the entrypoints where they are used
2024-03-29 15:04:34 +01:00
Reinier van der Leer 5a70fd60ad fix(compile): Fix server DB schema generation & code fixing mechanism (#171)
Apparently the generated DB schema is duplicated across every `CompiledRoute`.
Combining the schemas of N routes with M tables will result in N-fold duplication and `prisma generate` failure.
In turn, this breaks code fixing for server.py, resulting in broken deployments.

Tempfix, applied in this commit: use the schema from only one of the `CompiledRoutes`.
Long-term fix: clean up Codex' DB structure.
2024-03-29 20:50:23 +07:00
Zamil Majdyandmajdyz 38afbf3d4f [AGPT-566] Improve function signature in prompt by providing arg and return description from the generated function (#151)
Fixing the promised Todo on parsing the description on generated function
---------

Co-authored-by: majdyz <[email protected]>
2024-03-29 15:30:41 +07:00
Reinier van der Leer 0b6a3ef8ed fix(compile): Fix requirements resolution for hardcoded project dependencies (#167)
The hardcoded dependencies `fastapi`, `pydantic`, `uvicorn` and `prisma` need special treatment,
because if they are included in the `packages` of a generated function,
those requirements are not scrutinized during code validation, allowing invalid versions.
2024-03-29 14:45:35 +07:00
Reinier van der Leer 228eb2b892 fix(develop/validation): Raise log level for failed validation during code reformatting 2024-03-29 06:57:24 +01:00
Reinier van der Leer 839ae23101 fix(compile): Resolve multiplicate dependencies -> fix static code analysis (#161)
- Move resolution of multiplicate dependencies from deploy to compile
- Rename `generate_requirements_txt` to `requirements_txt_from_packages`
2024-03-28 10:02:58 +01:00
AarushiandSwifty 131cebf81c Rebuild docker containers automatically when files changes (#159)
* adding app to docker compose

* fixing tests locally

* setting up watch and build

---------

Co-authored-by: Swifty <[email protected]>
2024-03-28 08:51:20 +00:00
Zamil Majdyandmajdyz 6d7e39347c Fix PyRight setup concurrency issue (#162)
Co-authored-by: majdyz <[email protected]>
2024-03-27 12:48:07 -05:00
Zamil Majdyandmajdyz ac86a16b90 Fix PyRight setup concurrency issue (#163)
Co-authored-by: majdyz <[email protected]>
2024-03-27 12:47:52 -05:00
AarushiandSwifty 624d1fcec5 [AGPT-589] Use docker compose to run full app (#157)
* adding app to docker compose

---------

Co-authored-by: Swifty <[email protected]>
2024-03-27 15:38:18 +00:00
Zamil Majdyandmajdyz 0a4ca2cd8a Add json validation error on pyright (#158) (#160)
Add json validation error on pyright

---------

Co-authored-by: majdyz <[email protected]>
2024-03-27 10:14:51 -05:00
Reinier van der Leer 36597885a3 feat(deploy): Include version specifiers in generated requirements.txt (#155)
If a package is specified multiple times, it is resolved to a requirement for the highest mentioned version.
2024-03-27 16:07:16 +01:00
Zamil Majdyandmajdyz 7f2732bb6b Add json validation error on pyright (#158)
Add json validation error on pyright

---------

Co-authored-by: majdyz <[email protected]>
2024-03-27 16:02:01 +01:00
Reinier van der Leer ec40f6f8c7 fix(common): Fix error state handling in execute_command (#154)
By extension, this fixes code validation by raising an error when the process (e.g. `pip install`) exits with a non-zero status.
2024-03-27 10:43:35 +01:00
Reinier van der Leer 5a776c911a fix(deploy): Deprecate pipreqs as a secondary package guesser (#149)
* fix(deploy): Deprecate `pipreqs` as a secondary package guesser

   The develop stage already outputs a list of packages required by the application,
and `pipreqs` is unreliable.

   - Remove usage of `pipreqs` from deploy.packager
   - Remove `pipreqs` dependency

* tweak incantations regarding imports & requirements
2024-03-27 10:38:30 +01:00
Zamil Majdy bcd91ad2cb fix(compile): Fix propagation of Packages (#152) 2024-03-26 15:53:02 +01:00
Nicholas Tindle a01f9675a4 Add Prisma migration and Prod Deployment (#142)
* feat: deploy tutorial

* fix: lint document

* fix: lint prod

* feat: migrate codex

* feat: prisma migrations

* fix: remove old init

* fix: merge cloudbuilds

* fix: add a migration that wasn't included in the init :'(
2024-03-25 13:12:44 -05:00
Toran Bruce Richards 487d84a4ea Delete LICENSE (#147) 2024-03-25 17:06:53 +01:00
Swifty 646e47e1bd Merge pull request #140 from Significant-Gravitas/dev
Main <- Dev
2024-03-25 17:00:17 +01:00
Swifty f238c6eb2b Merge branch 'main' into dev 2024-03-25 16:59:06 +01:00
Swifty e769312bac [AGPT-582] Add cost caculations (#146)
* Add costs command to retrieve and display cost analytics

* Update imports in compile.py

* Fix import issue in compile.py

* Remove unnecessary code in compile.py

* Refactor compile.py: Format code and import statements

* Refactor code to use async/await for CodeValidator
2024-03-25 16:55:05 +01:00
Zamil Majdyandmajdyz 0df3d5dd22 Add some stability patches (#148)
Changes:

prisma format
Suppress linting error on reformat_code command.
Update exception error messages
Add code validator test
Make reformat_code maintain code line ordering 

---------

Co-authored-by: majdyz <[email protected]>
2024-03-25 22:53:15 +07:00
Zamil Majdyandmajdyz fa72f11b22 [AGPT-580] Support async subprocess execution (#145)
Subprocess execution implementation (for Ruff & PyRight) is currently a blocking call. This doesn't work well with the event-loop used by the fastapi.

Scope:

Make AiBlock.validate async
Make subprocess execution async.

---------

Co-authored-by: majdyz <[email protected]>
2024-03-25 18:22:18 +04:00
d379a0c363 [AGPT-571] Integrate PyRight (#141)
Integrating PyRight project-based code-linting. This will allow us to detect:
* Misuse of async functions.
* Misuse of optional type and other annotated types (currently disabled)
* Wrong usage of pydantic and prisma model.
* Wrong usage of third-party library.
* Use of undeclared field
* Use of uninstalled third-party library (which will prompt LLM to add the requirement list)

Known trade-off:

Setting-up PyRight requires building a full-project (generate the Prisma model code, installing 3rd-party library, compiling the function with the object dependency) this slows down the code-validation during the code-validation step.

---------

Co-authored-by: majdyz <[email protected]>
Co-authored-by: SwiftyOS <[email protected]>
2024-03-22 16:51:47 +04:00
Swifty b19c426946 [AGPT-547] Systematic prompt template perfomance tool (#144)
* Update Interview and LLMCallAttempt models

* Refactor LLMCallAttempt model

* Refactor code and update logging IDs

* Refactor AIBlock class and handle exception in start_interview

* Add template analytics

* Refactor analytics.py to use get_template_performance() instead of load_data()

* Add migration lock file and analytics functionality

* Pr coments

* Add model field to AIBlock and LLMCallTemplate
2024-03-22 10:58:28 +01:00
Swifty 885153d7fe Refactor route_decorator in compile.py (#143) 2024-03-21 11:44:46 -05:00
Reinier van der Leer f3a2f4023a refactor(deploy): Clean up & improve generated docker setup 2024-03-21 11:15:53 +01:00
Reinier van der Leer 8682d54905 lint(deploy): remove disabled DB port config from generated docker compose file 2024-03-21 11:03:14 +01:00
Reinier van der Leer b3f1845db9 Make app port configurable through PORT env var 2024-03-21 10:56:18 +01:00
Zamil Majdyandmajdyz 92416fadac [AGPT-556] Overhaul code-validation design + Add PyRight in commented mode (#139)
This is a large but a much needed change to allow more sophisticated static code analysis to be added.

PyRight (used by pylance) will allow us to detect:

Misuse of async functions.
Misuse of optional type and other annotated types.
Wrong usage of pydantic and prisma model.
Wrong usage of third-party library.
The overhaul is required to allow us retrying while fixing the code as a project (not only as a function) and allow us to keep adding non-LLM fixes to it so that we can avoid wasting the retry.

The scope of this PR is still a refactoring and the adding of the PyRight linter, so this PR try to keep the existing behaviour.
The enablement and more tuning on the linter will be done in the followup PR.

---------

Co-authored-by: majdyz <[email protected]>
2024-03-21 13:28:17 +04:00
Nicholas Tindle 2440576b16 fix: service account 2024-03-20 15:43:12 -05:00
Nicholas Tindle 8be5e3f33d feat: add cloudbuild.prod.yml 2024-03-20 12:10:05 -05:00