Fix setOptions() to properly handle modelOptions (#975)

For #974

- Adds an else to the check for this.modelOptions
- Allows the modelOptions to be updated when the model is already
  initialized
This commit is contained in:
jordantgh 2023-09-20 22:13:51 +01:00 committed by GitHub
parent 8580f1c3d3
commit d13a7b1a74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,6 +59,12 @@ class OpenAIClient extends BaseClient {
typeof modelOptions.presence_penalty === 'undefined' ? 1 : modelOptions.presence_penalty,
stop: modelOptions.stop,
};
} else {
// Update the modelOptions if it already exists
this.modelOptions = {
...this.modelOptions,
...modelOptions,
};
}
if (process.env.OPENROUTER_API_KEY) {