Elffuss BraidHub

kikocis/continue public

9c134d8c1202 · 1.2 KiBRawPermalink
1import OpenAI from "./OpenAI";
2
3import { LLMOptions, CompletionOptions, ChatMessage } from "../../index.js";
4import { ChatCompletionCreateParams } from "openai/resources/index";
5
6class Scaleway extends OpenAI {
7 static providerName = "scaleway";
8 static defaultOptions: Partial<LLMOptions> = {
9 apiBase: "https://api.scaleway.ai/v1/",
10 model: "qwen2.5-coder-32b-instruct",
11 useLegacyCompletionsEndpoint: false,
12 };
13
14 private static MODEL_IDS: { [name: string]: string } = {
15 "llama3.1-8b": "llama-3.1-8b-instruct",
16 "llama3.3-70b": "llama-3.3-70b-instruct",
17 "mistral-small3.1": "mistral-small-3.1-24b-instruct-2503",
18 "deepseek-r1-distill-llama-70b": "deepseek-r1-distill-llama-70b",
19 "qwen2.5-coder-32b": "qwen2.5-coder-32b-instruct",
20 };
21
22 protected _convertModelName(model: string) {
23 return Scaleway.MODEL_IDS[model] || this.model;
24 }
25 protected _convertArgs(
26 options: CompletionOptions,
27 messages: ChatMessage[],
28 ): ChatCompletionCreateParams {
29 // Convert model name in the options before passing to parent
30 const modifiedOptions = {
31 ...options,
32 model: this._convertModelName(options.model),
33 };
34 return super._convertArgs(modifiedOptions, messages);
35 }
36}
37
38export default Scaleway;