MCPcopy Create free account
hub / github.com/RomanHotsiy/commitgpt / getAnswer

Method getAnswer

client.ts:13–30  ·  view source on GitHub ↗
(question: string)

Source from the content-addressed store, hash-verified

11
12export class ChatGPTClient {
13 async getAnswer(question: string): Promise<string> {
14 const { model, maxTokens, temperature } = await getPromptOptions();
15
16 try {
17 const result = await openai.createCompletion({
18 model,
19 prompt: question,
20 max_tokens: maxTokens,
21 temperature,
22 });
23 return result.data.choices[0].text;
24 } catch (e) {
25 console.error(e?.response ?? e);
26 throw e;
27 }
28
29 // @ts-ignore
30 }
31}

Callers 1

getMessagesFunction · 0.80

Calls 1

getPromptOptionsFunction · 0.85

Tested by

no test coverage detected