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

Refactor #864

Closed
wants to merge 151 commits into from
Closed

Refactor #864

wants to merge 151 commits into from

Conversation

ATheorell
Copy link
Collaborator

And here it comes! The request to merge the refactored gpt-engineer into main.

Main changes:

  • Agent classes working as main interface to applications
  • Most operations now in-memory (though executions are still on disk)
  • No longer a unified Step interface
  • New file structure
  • Much better test coverage
  • and probably much more that I fail to think of now!

Reviews highly appreciated!

ATheorell and others added 30 commits November 6, 2023 14:09
Merging to refactor branch so that we can work async on the missing functionality
.langchain.db Outdated
Copy link
Collaborator

@ErikBjare ErikBjare Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this added intentionally?

Edit: I assume not, given it's in the .gitignore, change made in #882

Comment on lines 10 to 12
- collect: Collect send learning data for analysis and improvement.
- collect: Collect send learning tools for analysis and improvement.
- file_selector: Selecting files using GUI and terminal-based file explorer.
- learning: Tools and data structures for data collection.
- learning: Tools and tools structures for tools collection.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a search-replace gone wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed


Note:
This function is only called if consent is given to share data.
This function is only called if consent is given to share tools.
Copy link
Collaborator

@ErikBjare ErikBjare Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of these s/data/tools that seems to be a mistake, might want to grep the diff for tools and go through them all.

Edit: I did so in #882

@ErikBjare ErikBjare mentioned this pull request Dec 1, 2023
Comment on lines +30 to +64
Attributes:
path (str): The file path where the `Agent` will operate, used for version management and
file operations.
version_manager (BaseVersionManager): An object that adheres to the VersionManagerInterface,
responsible for version control of the generated code. Defaults to `VersionManager`
if not provided. PROBABLY GIT SHOULD BE USED IN THE DEFAULT
step_bundle (StepBundleInterface): Workflows of code generation steps that define the behavior of gen_code and
improve.
ai (AI): Manages calls to the LLM.

Methods:
__init__(self, path: str, version_manager: VersionManagerInterface = None,
step_bundle: StepBundleInterface = None, ai: AI = None):
Initializes a new instance of the Agent class with the provided path, version manager,
step bundle, and AI. It falls back to default instances if specific components are not provided.

init(self, prompt: str) -> Code:
Generates a new piece of code using the AI and step bundle based on the provided prompt.
It also snapshots the generated code using the version manager.

Parameters:
prompt (str): A string prompt that guides the code generation process.

Returns:
Code: An instance of the `Code` class containing the generated code.

improve(self, prompt: str) -> Code:
Improves an existing piece of code using the AI and step bundle based on the provided prompt.
It also snapshots the improved code using the version manager.

Parameters:
prompt (str): A string prompt that guides the code improvement process.

Returns:
Code: An instance of the `Code` class containing the improved code.
Copy link
Collaborator

@ErikBjare ErikBjare Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious: why aren't these generated with things like autodoc?

The project has a lot of docstrings which seem a pain to manually maintain and keep up-to-date, which autodoc would simplify massively (at the cost of not getting it exactly how you want it, which imo is a good thing as it prevents bikeshedding).

Reminds me of this video

Edit: I realize now that you do use autodoc, but it isn't really working (and would still duplicate a lot of work):

image

If of interest, I could take a stab at cleaning this up (after this PR is merged).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be amazing if you could have a shot at this once we merge.

self.preprompts_holder = preprompts_holder or PrepromptsHolder(PREPROMPTS_PATH)

@classmethod
def with_default_config(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to do anything different than __init__, can be removed.

@ErikBjare ErikBjare mentioned this pull request Dec 2, 2023
@ATheorell
Copy link
Collaborator Author

Closing this in favor of the super PR #886

@ATheorell ATheorell closed this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants