MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / completePrompt

Method completePrompt

src/api/providers/lm-studio.ts:190–217  ·  view source on GitHub ↗
(prompt: string)

Source from the content-addressed store, hash-verified

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
220export async function getLmStudioModels(baseUrl = "http://localhost:1234") {

Callers

nothing calls this directly

Calls 3

getModelMethod · 0.95
handleOpenAIErrorFunction · 0.90
createMethod · 0.45

Tested by

no test coverage detected