(prompt: string)
| 193 | } |
| 194 | |
| 195 | async completePrompt(prompt: string): Promise<string> { |
| 196 | const { id: model, maxTokens: max_tokens, temperature } = await this.fetchModel() |
| 197 | |
| 198 | const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [{ role: "system", content: prompt }] |
| 199 | |
| 200 | const completionParams: UnboundChatCompletionParams = { |
| 201 | model, |
| 202 | max_tokens, |
| 203 | messages: openAiMessages, |
| 204 | temperature: temperature, |
| 205 | } |
| 206 | |
| 207 | let response: OpenAI.Chat.ChatCompletion |
| 208 | try { |
| 209 | response = await this.client.chat.completions.create(completionParams) |
| 210 | } catch (error) { |
| 211 | throw handleOpenAIError(error, this.providerName) |
| 212 | } |
| 213 | return response.choices[0]?.message.content || "" |
| 214 | } |
| 215 | } |
nothing calls this directly
no test coverage detected