OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Move config defaults into `config.py`

Open rbren opened this issue 1 year ago • 4 comments

What problem or use case are you trying to solve? Throughout the app, we use config.get_or_default. This means different callers could be getting the same setting with different defaults, causing inconsistent behavior

Describe the UX of the solution you'd like Inside of config.py, set every possible configuration variable at startup. Then everyone just accesses config.foo, or config.get("foo"), or something like that.

This also makes config.py a good source of truth on all the available configuration options.

rbren avatar Mar 30 '24 14:03 rbren

Do you mean move those parameters into config file?

DEFAULT_API_KEY = config.get_or_none("LLM_API_KEY")
DEFAULT_BASE_URL = config.get_or_none("LLM_BASE_URL")
DEFAULT_WORKSPACE_DIR = config.get_or_default("WORKSPACE_DIR", os.path.join(os.getcwd(), "workspace"))
LLM_MODEL = config.get_or_default("LLM_MODEL", "gpt-4-0125-preview")

yufansong avatar Mar 30 '24 19:03 yufansong

Yup exactly. We've also got some env vars for things like DEBUG, EMBEDDINGS...

Would be nice to collect it all in one place, and to ensure that everyone is using the same values.

rbren avatar Mar 30 '24 23:03 rbren

Here's a good example of why this would be helpful 😄 https://github.com/OpenDevin/OpenDevin/pull/475/files

rbren avatar Apr 01 '24 02:04 rbren

Yeah, I know it. A single source of truth file is important and necessary. I agree with this refactor. Will do it recently when I have time. It should be very easy.

yufansong avatar Apr 01 '24 02:04 yufansong