(prompt: string)
| 188 | } |
| 189 | |
| 190 | async completePrompt(prompt: string): Promise<string> { |
| 191 | try { |
| 192 | // Create params object with optional draft model |
| 193 | const params: any = { |
| 194 | model: this.getModel().id, |
| 195 | messages: [{ role: "user", content: prompt }], |
| 196 | temperature: this.options.modelTemperature ?? LMSTUDIO_DEFAULT_TEMPERATURE, |
| 197 | stream: false, |
| 198 | } |
| 199 | |
| 200 | // Add draft model if speculative decoding is enabled and a draft model is specified |
| 201 | if (this.options.lmStudioSpeculativeDecodingEnabled && this.options.lmStudioDraftModelId) { |
| 202 | params.draft_model = this.options.lmStudioDraftModelId |
| 203 | } |
| 204 | |
| 205 | let response |
| 206 | try { |
| 207 | response = await this.client.chat.completions.create(params) |
| 208 | } catch (error) { |
| 209 | throw handleOpenAIError(error, this.providerName) |
| 210 | } |
| 211 | return response.choices[0]?.message.content || "" |
| 212 | } catch (error) { |
| 213 | throw new Error( |
| 214 | "Please check the LM Studio developer logs to debug what went wrong. You may need to load the model with a larger context length to work with Roo Code's prompts.", |
| 215 | ) |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | export async function getLmStudioModels(baseUrl = "http://localhost:1234") { |
nothing calls this directly
no test coverage detected