OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Better Key+Model management/UX

Open rbren opened this issue 1 year ago • 5 comments

What problem or use case are you trying to solve? Users often choose a model, without having specified the necessary key for that model.

Describe the UX of the solution you'd like

  • If LLM_MODEL is set in the backend, default the UI to that model
    • otherwise, force the user to choose a model before starting
  • Whenever the user chooses a model in the UI, prompt them for an API key (and optionally base URL)

Do you have thoughts on the technical implementation?

  • Save model, API key, base url to localStorage
    • each model should have its own settings
    • e.g.
    localStorage.add('models', JSON.stringify({
      'gpt-4': {
        'api_key': 'sk-...',
        'api_base': 'http://localhost:4000',
      },
    })
    

**Describe alternatives you've considered**

**Additional context**

rbren avatar Mar 30 '24 15:03 rbren

@rbren a small doubt, show we save the model details only if the user interacts with the UI or even if he sets it up in the backend.

Yashwanth-Chandrakumar avatar Mar 30 '24 15:03 Yashwanth-Chandrakumar

IMO we should not send the backend API key back to the frontend, ever.

Only details entered into the frontend should be saved in localstorage.

rbren avatar Mar 30 '24 16:03 rbren

Ok thank you.

Yashwanth-Chandrakumar avatar Mar 30 '24 16:03 Yashwanth-Chandrakumar

In the config if the LLM_MODEL is not set, defaultly gpt-4-0125-preview gets assigned do i need to change this behaviour.

Yashwanth-Chandrakumar avatar Apr 01 '24 05:04 Yashwanth-Chandrakumar

Good point. I think we want to keep that default for running main.py directly, but maybe not for the server?

rbren avatar Apr 01 '24 14:04 rbren

This is doing pretty well now. Still room for improvement, but I'm going to close this one.

rbren avatar Apr 09 '24 20:04 rbren