MCPcopy Create free account
hub / github.com/developersdigest/llm-answer-engine / rephraseInput

Function rephraseInput

express-api/index.js:31–43  ·  view source on GitHub ↗
(inputString)

Source from the content-addressed store, hash-verified

29 console.log(`2. Destructured request data`);
30 // 8. Define rephrase function
31 async function rephraseInput(inputString) {
32 console.log(`4. Rephrasing input`);
33 // 9. Rephrase input using Groq
34 const groqResponse = await openai.chat.completions.create({
35 model: "mixtral-8x7b-32768",
36 messages: [
37 { role: "system", content: "You are a rephraser and always respond with a rephrased version of the input that is given to a search engine API. Always be succint and use the same words as the input. ONLY RETURN THE REPHRASED VERSION OF THE INPUT." },
38 { role: "user", content: inputString },
39 ],
40 });
41 console.log(`5. Rephrased input and got answer from Groq`);
42 return groqResponse.choices[0].message.content;
43 }
44 // 10. Define search engine function
45 async function searchEngineForSources(message) {
46 console.log(`3. Initializing Search Engine Process`);

Callers 1

searchEngineForSourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected