Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Custom API URL is not working #177

Closed
ldubost opened this issue May 26, 2023 · 4 comments
Closed

Custom API URL is not working #177

ldubost opened this issue May 26, 2023 · 4 comments

Comments

@ldubost
Copy link
Contributor

ldubost commented May 26, 2023

The feature mentioned in #172 and #157 and commited in #161 is actually not working.
The setting from the CHATGPT_REVERSE_PROXY is ignored because it is added inside an options object like that:

  const clientOptions = {  // (Optional) Parameters as described in https://platform.openai.com/docs/api-reference/completions
    modelOptions: {
      model: CHATGPT_API_MODEL,  // The model is set to gpt-3.5-turbo by default
      temperature: CHATGPT_TEMPERATURE,
    },
    promptPrefix: wrapPrompt(CHATGPT_PROMPT_PREFIX),
    debug: false,
    options: {
      reverseProxyUrl: CHATGPT_REVERSE_PROXY
    },
  };

when it should be added directly in the clientOptions object like this:

  const clientOptions = {  // (Optional) Parameters as described in https://platform.openai.com/docs/api-reference/completions
    modelOptions: {
      model: CHATGPT_API_MODEL,  // The model is set to gpt-3.5-turbo by default
      temperature: CHATGPT_TEMPERATURE,
    },
    promptPrefix: wrapPrompt(CHATGPT_PROMPT_PREFIX),
    debug: false,
    reverseProxyUrl: CHATGPT_REVERSE_PROXY
  };

This has been verified on my installation where chatgpt is getting called even when a URL for localAI is specified.
After fixing the code, the setting is taken into account.

I'm sending a pull request very quickly.

@ldubost ldubost changed the title Customers API URL is not working Custom API URL is not working May 26, 2023
ldubost added a commit to ldubost/matrix-chatgpt-bot that referenced this issue May 26, 2023
@d13g4
Copy link

d13g4 commented May 29, 2023

can confirm, tried everything for a couple of hours until i noticed the option is ignored.

@seshubonam
Copy link

+1

max298 pushed a commit that referenced this issue Jun 1, 2023
@max298
Copy link
Collaborator

max298 commented Jun 1, 2023

Thank you for providing the fix @ldubost! I've just pushed a new tag v.3.1.2, could you verify if that resolves this issue?

@ldubost
Copy link
Contributor Author

ldubost commented Jun 1, 2023

I can confirm it works well with this version 3.1.2 ! I'm able to contact LocalAI !

@max298 max298 closed this as completed Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants