(prompt: string)
| 290 | } |
| 291 | |
| 292 | async completePrompt(prompt: string) { |
| 293 | const { id: model, temperature } = this.getModel() |
| 294 | |
| 295 | const message = await this.client.messages.create({ |
| 296 | model, |
| 297 | max_tokens: 16_384, |
| 298 | temperature: temperature ?? 1.0, |
| 299 | messages: [{ role: "user", content: prompt }], |
| 300 | stream: false, |
| 301 | }) |
| 302 | |
| 303 | const content = message.content.find(({ type }) => type === "text") |
| 304 | return content?.type === "text" ? content.text : "" |
| 305 | } |
| 306 | } |