Skip to content

Commit

Permalink
Use convertmodelname to avoid 422 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tgenaitay committed Dec 12, 2024
1 parent 86b40c7 commit a3fc66b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/llm/llms/Scaleway.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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;

0 comments on commit a3fc66b

Please sign in to comment.