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

Method completePrompt

src/api/providers/anthropic.ts:403–430  ·  view source on GitHub ↗
(prompt: string)

Source from the content-addressed store, hash-verified

401 }
402
403 async completePrompt(prompt: string) {
404 const { id: model, temperature } = this.getModel()
405
406 let message
407 try {
408 message = await this.client.messages.create({
409 model,
410 max_tokens: ANTHROPIC_DEFAULT_MAX_TOKENS,
411 thinking: undefined,
412 temperature,
413 messages: [{ role: "user", content: prompt }],
414 stream: false,
415 })
416 } catch (error) {
417 TelemetryService.instance.captureException(
418 new ApiProviderError(
419 error instanceof Error ? error.message : String(error),
420 this.providerName,
421 model,
422 "completePrompt",
423 ),
424 )
425 throw error
426 }
427
428 const content = message.content.find(({ type }) => type === "text")
429 return content?.type === "text" ? content.text : ""
430 }
431}

Callers

nothing calls this directly

Calls 4

getModelMethod · 0.95
captureExceptionMethod · 0.65
StringInterface · 0.50
createMethod · 0.45

Tested by

no test coverage detected