Merge pull request #3338 from tgenaitay/scaleway-conversion
Use convertModelName to avoid 422 errors
This commit is contained in:
commit
f990c53bdd
1 changed files with 10 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import OpenAI from "./OpenAI";
|
||||
|
||||
import { LLMOptions } from "../../index.js";
|
||||
import { LLMOptions, CompletionOptions, ChatMessage } from "../../index.js";
|
||||
import { ChatCompletionCreateParams } from "openai/resources/index";
|
||||
|
||||
|
||||
class Scaleway extends OpenAI {
|
||||
|
|
@ -22,6 +23,14 @@ class Scaleway extends OpenAI {
|
|||
protected _convertModelName(model: string) {
|
||||
return Scaleway.MODEL_IDS[model] || this.model;
|
||||
}
|
||||
protected _convertArgs(options: CompletionOptions, messages: ChatMessage[]): ChatCompletionCreateParams {
|
||||
// Convert model name in the options before passing to parent
|
||||
const modifiedOptions = {
|
||||
...options,
|
||||
model: this._convertModelName(options.model)
|
||||
};
|
||||
return super._convertArgs(modifiedOptions, messages);
|
||||
}
|
||||
}
|
||||
|
||||
export default Scaleway;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue