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

Method completePrompt

src/api/providers/mistral.ts:196–223  ·  view source on GitHub ↗
(prompt: string)

Source from the content-addressed store, hash-verified

194 }
195
196 async completePrompt(prompt: string): Promise<string> {
197 const { id: model, temperature } = this.getModel()
198
199 try {
200 const response = await this.client.chat.complete({
201 model,
202 messages: [{ role: "user", content: prompt }],
203 temperature,
204 })
205
206 const content = response.choices?.[0]?.message.content
207
208 if (Array.isArray(content)) {
209 // Only return text content, filter out thinking content for non-streaming
210 return (content as ContentChunkWithThinking[])
211 .filter((c) => c.type === "text" && c.text)
212 .map((c) => c.text || "")
213 .join("")
214 }
215
216 return content || ""
217 } catch (error) {
218 const errorMessage = error instanceof Error ? error.message : String(error)
219 const apiError = new ApiProviderError(errorMessage, this.providerName, model, "completePrompt")
220 TelemetryService.instance.captureException(apiError)
221 throw new Error(`Mistral completion error: ${errorMessage}`)
222 }
223 }
224}

Callers

nothing calls this directly

Calls 3

getModelMethod · 0.95
captureExceptionMethod · 0.65
StringInterface · 0.50

Tested by

no test coverage detected