-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Feat: Introduce class for SessionConfig rather than using a dict #5406
base: main
Are you sure you want to change the base?
Conversation
self.loop = asyncio.get_event_loop() | ||
self.settings = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable was not actually used anywhere so I removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is refactoring the existing dict, and it looks nice overall. However, it seems to conflict with what we tracked as the way forward here:
#3220
(please see comment)
For example, the PR defines duplicates of llm_model
etc attributes making it more clearly disconnected from the underlying config-based configuration. I know this is the current behavior - this PR makes more clear! 😅, but I would appreciate if @neubig and @rbren could take a look at where this is heading, and we can figure out the way forward.
Related question: are you considering multiple session_configs per user?
Allow me to note another detail, related to the above, but not quite the same: Currently, the UI settings offer to users only a handful of the settings the application actually has. To my knowledge, we are moving towards offering to users in the UI all or most of our settings. That will mean that this SessionConfig class would become a completely or almost completely duplicate hierarchy of our settings? I'd appreciate to take the time to think this one over. |
Hi! I don't have a huge amount of time to look at this today unfortunately... But basically what I have been saying for a while is:
I think it's definitely OK to have session-specific (or project-specific) settings as well that override global defaults. |
|
||
|
||
@dataclass | ||
class SessionConfig: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a bunch of Config
classes in core--should this go in there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think so, and once it goes there... it should probably do what the others do (or it will become more clear where the differences need to be)
It's not obvious to me why do we duplicate attributes like llm_model as opposed to giving this class an llm_config with a particular user-chosen model, but could be wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rationale for placing this here is that it is config that only really makes sense in the context of a web app - not for Headless / CLI. If the consensus is that it makes more sense in the core module, I will move it.
default_llm_config.model = session_config.llm_model or default_llm_config.model | ||
default_llm_config.api_key = session_config.llm_api_key or default_llm_config.api_key | ||
default_llm_config.base_url = session_config.llm_base_url or default_llm_config.base_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we're still mucking with the global defaults here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the current behavior though. 🤔 What do you think it should do?
default_llm_config.model = session_config.llm_model or default_llm_config.model | ||
default_llm_config.api_key = session_config.llm_api_key or default_llm_config.api_key | ||
default_llm_config.base_url = session_config.llm_base_url or default_llm_config.base_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we're still mucking with the global defaults here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do a deep copy of the global config when we create a session, so settings are not copied to the global shared object here.
I did not envision this one resulting in so much discussion! Here is the rationale / use case as briefly as I can: There are already 2 types of config:
Currently the session specific parameters are not formalized and represented by a dict. This PR really only formalizes them. The justification for not simply using the existing config classes here is:
I doubt we will ever offer a full listing of everything in the config.toml in the web ui:
If we later have config that makes sense in the context of a user rather than a session, I suggest we add such config at that time - in any case this is an interim step in that direction. |
Those are good points! Please let me take a simpler part of it all, LLMConfig. Currently, the UI only offers like three attributes, from all of it.
What do think about a session-based configuration that starts like:
|
I think you may be on to something here - If I understand you correctly, you refer to the issue where values that are specified in the WebUI seem to ignore any value from the config.toml / ENV. Maybe we do need to separate these out for Web - though the CLI and Headless modes still accept values from the config.toml at present AFAIK. Let me think a little more and update the proposal. |
Introduce class for SessionConfig rather than using a dict
Open Questions
To run this PR locally, use the following command: