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

Pydantic-based configuration and setting objects #6321

Merged
merged 30 commits into from
Jan 17, 2025

Conversation

csmith49
Copy link
Collaborator

@csmith49 csmith49 commented Jan 16, 2025

End-user friendly description of the problem this fixes or functionality that this introduces

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions

This PR standardizes configuration objects to use pydantic.BaseModel objects over data classes. These changes were originally from #6176, but needed to be reverted in #6214 due to typing issues with Settings (which are now fixed).

Other changes:

  • Certain api_key-type fields, especially in AppConfig and LLMConfig, are now SecretStr instead of str. The values can only be accessed by calling a field.get_secret_value() function, which complicates some accesses but ensures the key won't be leaked by, e.g., serializing config objects during logging.
  • Minor clean-up of config parsing from environment variables and TOML files.
  • Fixes to tests.
  • Minor updates to serialization in evaluation.

Link of any specific issues this addresses

#6015

@csmith49 csmith49 marked this pull request as ready for review January 16, 2025 21:40
Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

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

Thank you for this!

Meanwhile I also want to simplify the llm config (it doesn't need a nested version of itself): #6281 ), then it should be easier to work with.

@enyst
Copy link
Collaborator

enyst commented Jan 17, 2025

@csmith49 Please feel free to merge this PR whenever you see fit.

If there are conflicts with the other (although there might not be), no problem, I'll fix that tomorrow.

@csmith49 csmith49 merged commit a120872 into All-Hands-AI:main Jan 17, 2025
13 checks passed
csmith49 added a commit to csmith49/OpenHands that referenced this pull request Jan 19, 2025
Co-authored-by: Calvin Smith <[email protected]>
Co-authored-by: Graham Neubig <[email protected]>
Co-authored-by: Engel Nyst <[email protected]>
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.

3 participants