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

Unified Configuration File in TOML Format #1174

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

similato87
Copy link
Collaborator

@similato87 similato87 commented Jun 19, 2024

PR Introduction: Unified Configuration File in TOML Format

Feature Description

Based on issue #1165, this PR introduces a unified configuration file in TOML format for the gpt-engineer project. This file will centralize various project settings, including:

  • API keys for OpenAPI and model configurations
  • Linting switches
  • File extension settings for git filters
  • Self-healing mechanism parameters (e.g., retry times)
  • Additional settings suggested by the community

The configuration file will be persistent on disk and presented to users upon each application run, with an option to bypass opening the file while being notified of its existence and purpose.

Motivation and Application

The project manages configurations through multiple files, complicating maintenance and user experience. A unified configuration file will simplify management, enhance maintainability, and provide a consistent method for setting and reviewing configurations. The TOML format ensures readability and ease of use.

Implementation Plan

  1. Create config.toml: Located in the project root directory, loaded at the start of gpte execution.
  2. CLI Arguments: Consider moving some command-line arguments to the configuration file.
  3. Use project_config.py: Adapted to parse the new configuration.
  4. Update file_selector.py: Remove the part for old linting option.
  5. Update steps.py: Get or set the configs in the main function when needed.
  6. .....

@similato87 similato87 linked an issue Jun 19, 2024 that may be closed by this pull request
@viborc viborc added the enhancement New feature or request label Aug 1, 2024
Copy link
Collaborator

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

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

Had these old pending review comments

is_file_selection = true

# Git Filter Configuration
[git_filter]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest this section be renamed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fully agreed. Once all the functions are finalized, we'll rename this section and revise all the names in a subsequent commit. For now, I've just placed some placeholders here to help identify and locate all configurations.

config.toml Outdated
Comment on lines 5 to 9
[api]
# API key for OpenAPI
# OPENAI_API_KEY=Your personal OpenAI API key from https://platform.openai.com/account/api-keys
OPENAI_API_KEY = "your_api_key_here"
ANTHROPIC_API_KEY = "your_anthropic_api_key_here"
Copy link
Collaborator

@ErikBjare ErikBjare Jun 24, 2024

Choose a reason for hiding this comment

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

I'd suggest not adding this here, since the configuration file is checked into git. Let users handle it with env vars/dotenv imo, or by a separate config file (~/.config/gpt-engineer/config.toml).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ATheorell and I have agreed to keep all the current behaviour intact while providing an additional option to toggle all configurations in a unified way. The current interfaces, like CLI commands and env files, will still have higher priority. If the user doesn't provide one, GPT-engineer will default to using the config.toml file, offering a more convenient way for users to view and adjust all configurations simultaneously. This approach ensures flexibility while maintaining ease of use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Additionally, the reason for placing the config.toml file in the root directory is to accommodate users who might not be very tech-savvy. Having a one-stop configuration file in the root can save them a lot of time and make the setup process much more straightforward.

@@ -0,0 +1,34 @@
# config.toml
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused, isn't this configuration file gpt-engineer specific?

It would probably be a confusingly general name for most projects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fully agreed. I will do that in the following commits.

@similato87 similato87 marked this pull request as draft October 1, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Implement a Unified Configuration File for Project Settings
3 participants