import{logger as e}from"../../../logger/index.mjs";import{AIProvider as t,generateText as n}from"@intlayer/ai";import{readFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";import{fileURLToPath as o}from"node:url";const s=r(a(i(o(import.meta.url)),`./PROMPT.md`),`utf-8`),c={provider:t.OPENAI,model:`gpt-4o-mini`,temperature:.7},l=async({text:t,aiConfig:r,applicationContext:i,contextBefore:a,currentLine:o,contextAfter:c})=>{let l=s.replace(`{{applicationContext}}`,i??``).replace(`{{contextBefore}}`,a??``).replace(`{{currentLine}}`,o??``).replace(`{{contextAfter}}`,c??``),{text:u,usage:d}=await n({...r,messages:[{role:`system`,content:l},{role:`assistant`,content:t}]});return e.info(`${d?.totalTokens??0} tokens used in the request`),{autocompletion:u,tokenUsed:d?.totalTokens??0}};export{c as aiDefaultOptions,l as autocomplete};
//# sourceMappingURL=index.mjs.map