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

Replace sources selection with new selection List/Dictionary & FOSS model support #51

Open
w0rp opened this issue Jul 20, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@w0rp
Copy link
Member

w0rp commented Jul 20, 2024

NOTE: This is a breaking change, and we're early enough into the project to make these breaking.

Solving this issue will help to solve #21 and we should throw in making the URL for the APIs configurable as to support FOSS OpenAI compatible APIs.

We currently configure sources like so in Vim:

let g:neural = {
\   'source': {
\       'openai': {
\           'api_key': $OPENAI_API_KEY,
\       },
\   },
\}

And also in Lua:

require('neural').setup({
  ui = {
    animated_sign_enabled = false,
  },
  source = {
    openai = {
      api_key = vim.env.OPENAI_API_KEY,
    },
  },
})

We then select a source like so:

g:neural.selected                                           *g:neural.selected*
                                                        *vim.g.neural.selected*
Type: |String|
Default: `'openai'`

Selects a source for Neural to use. Possible values are:

1. `'openai'` - OpenAI
2. `'chatgpt'` - ChatGPT

Expressed in Lua syntax alone, we should instead make our sources configurable this way:

require('neural').setup({
  ui = {
    animated_sign_enabled = false,
  },
  source = {
    type = 'openai',
    api_key = vim.env.OPENAI_API_KEY,
    url = 'https://custom-url.com',
  },
})

Setting the source itself should set the selection. We need to add a url setting to the existing sources to make it possible to select FOSS models. We should additionally support this in future, but not now (separate issue).

All possible fields should always support defaults at all times, and the type should determine the default values we select. The values should be printed back to the user so you can see exactly what is selected, including when you :echo g:neural.

require('neural').setup({
  ui = {
    animated_sign_enabled = false,
  },
  source = {
    {
      type = 'openai',
      url = 'https://custom-url-1.com',
    },
    {
      type = 'openai',
      url = 'https://custom-url-2.com',
    },
  },
})
@w0rp w0rp added the enhancement New feature or request label Jul 20, 2024
@w0rp
Copy link
Member Author

w0rp commented Jul 20, 2024

The plugin could explain back to the user automatically when no source is selected that they need to set one, and point them to the documentation on how to do so.

@Jorenar
Copy link

Jorenar commented Aug 6, 2024

It would be also helpful when using enterprise instances

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
None yet
Development

No branches or pull requests

3 participants