794 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
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
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
Zamil Majdyandmajdyz 6d7e39347c Fix PyRight setup concurrency issue (#162)
Co-authored-by: majdyz <[email protected]>
2024-03-27 12:48:07 -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
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
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
Zamil Majdyandmajdyz 78222a5f83 [AGPT-522] Fix Object serialization with additional methods (__init__, repr, and helper functions) (#134)
Lookup on the existing database table is already implemented, but this bug sometimes can get in the way.

---------

Co-authored-by: majdyz <[email protected]>
2024-03-19 17:01:01 -05:00
Toran Bruce Richards 1653a13288 Update git_init() call in packager.py to init in root directory rather than project folder. (#137) 2024-03-19 14:33:01 -05:00
Reinier van der Leer 6690bb76ac refactor(deploy): Clean up & improve generated docker setup
* Re-apply improvements from bb43387, with additional fixes:
  - Fix Prisma client generation
  - Fix `DATABASE_URL` in docker-compose.yml

* Simplify mechanism to wait for database availability before starting app container (introduced in a1963c9 through #133)
  - Remove deploy/wait-for-it.sh
2024-03-19 16:02:16 +01:00
Reinier van der LeerandSwiftyOS c06231d061 feat(deploy): Add instructions to run app to generated README (#131)
* Add instructions to run app to generated README

- Add `generate_readme` function to packager.py
- Fix usage/formatting of block strings in packager.py

* Add docstring to generate_readme

* Fix instructions regarding .env

* Change author in generated README to "AutoGPT" (remove mention of Codex)

* Update README generated by packager.py

Remove `cd` steps to go into and out of `project` folder. This is no longer needed since requirements.txt is now at the root level of the package.

* Update instructions in packager.py

---------

Co-authored-by: SwiftyOS <[email protected]>
2024-03-19 09:33:16 +01:00
Swifty a1963c97fd Add wait-for-it.sh script and update Dockerfile and docker-compose.ym… (#133)
* Add wait-for-it.sh script and update Dockerfile and docker-compose.yml***

* Update packager.py to use bash for wait-for-it.sh command
2024-03-19 09:27:52 +01:00
Toran Bruce Richards 9d28333782 AGPT-449 - Initialise a Git Repo with Generated Code (#120)
* Add Git user name and email to .env.example

* Add Git repository initialization and commit code in deploy step

* Extract git repository init to function.

* Update Git user configuration to only apply locally in newly initialized repository.

* Unset local Git user configuration after commiting

* Lint
2024-03-18 15:48:12 -05:00
Reinier van der Leer bb43387320 fix(deploy): Clean up & fix generated Docker setup
- Remove `ffmpeg` from `apt-get install` step
- Fix and deduplicate `COPY` statements: exclude irrelevant files and optimize for caching
- Add `DATABASE_URL` to `app` service in `docker-compose.yml`
2024-03-18 18:32:18 +01:00
Reinier van der Leer 61e263cb9e fix(deploy): Create .env as copy of .env.template
... rather than generating a new template and writing it to .env
2024-03-18 18:21:44 +01:00
SwiftyOS 7d0c56ec11 Add .env file and update packager.py 2024-03-18 17:24:51 +01:00
Swifty fef08c6bc6 [AGPT-516] add docker file (#130)
* Add Dockerfile and update docker-compose.yml

* Update system dependencies installation in packager.py

* Remove unused environment variable declaration
2024-03-18 17:19:06 +01:00
Reinier van der LeerandSwiftyOS 7d6e04a9b8 fix(deploy): [AGPT-515] Update generated project structure (#129)
* fix(deploy): [AGPT-515] Update generated project structure

Resolves [AGPT-515](https://linear.app/autogpt/issue/AGPT-515)

* Fixed file structure

---------

Co-authored-by: SwiftyOS <[email protected]>
2024-03-18 17:03:20 +01:00
SwiftyOS 90a319667e formatting 2024-03-18 16:54:18 +01:00
Swifty 675c30cc89 [AGPT-550] Issues in prisma schema generation (#128)
* Fix error handling in exec_external_on_contents function

* Add new models and update existing model in database schema

* Delete User-related models and enums

* Update code block delimiter in DatabaseGenerationBlock

* Refactor code for DatabaseEnums and DatabaseTable classes, and exec_external_on_contents function

* fix test

* Fix exec_external_on_contents function calls

* formatting

* Add database schema implementation requirements
2024-03-18 16:50:31 +01:00