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

Use convertModelName to avoid 422 errors #3338

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading