(prompt: string)
| 205 | } |
| 206 | |
| 207 | async completePrompt(prompt: string): Promise<string> { |
| 208 | const { id: model, maxTokens: max_tokens, temperature } = await this.fetchModel() |
| 209 | |
| 210 | const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [{ role: "system", content: prompt }] |
| 211 | |
| 212 | const completionParams: RequestyChatCompletionParams = { |
| 213 | model, |
| 214 | max_tokens, |
| 215 | messages: openAiMessages, |
| 216 | temperature: temperature, |
| 217 | } |
| 218 | |
| 219 | let response: OpenAI.Chat.ChatCompletion |
| 220 | try { |
| 221 | response = await this.client.chat.completions.create(completionParams) |
| 222 | } catch (error) { |
| 223 | throw handleOpenAIError(error, this.providerName) |
| 224 | } |
| 225 | return response.choices[0]?.message.content || "" |
| 226 | } |
| 227 | } |
nothing calls this directly
no test coverage detected