UNPKG

rawi

Version:

Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into

4 lines 2.49 kB
/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */ import{a as n}from"./chunk-DZIEWBQ3.js";import{createMistral as m}from"@ai-sdk/mistral";import{generateText as p,streamText as l}from"ai";var d=["ministral-3b-latest","ministral-8b-latest","mistral-large-latest","mistral-medium-latest","mistral-medium-2508","mistral-medium-2505","mistral-small-latest","pixtral-large-latest","magistral-small-2507","magistral-medium-2507","magistral-small-2506","magistral-medium-2506","pixtral-12b-2409","open-mistral-7b","open-mixtral-8x7b","open-mixtral-8x22b"],c=d.map(t=>({name:t,displayName:t})),M={name:"mistral",displayName:"\u{1F7E0} Mistral AI",models:c},f=async(t,a)=>{try{let e=t.providerSettings,r=e?.apiKey||t.apiKey;if(!r)throw new Error("API key is required for Mistral");let s=e?.baseURL||"https://api.mistral.ai/v1",i=m({apiKey:r,baseURL:s}),o=l({model:i(t.model),prompt:a,temperature:t.temperature||.7,maxOutputTokens:t.maxTokens||2048});return{textStream:o.textStream,fullResponse:o.text}}catch(e){throw new Error(`Error calling Mistral streaming API: ${e instanceof Error?e.message:String(e)}`)}},h={name:"mistral",displayName:"\u{1F7E0} Mistral AI",async streamChat(t,a,e={}){let s=(t.providerSettings||{}).apiKey||t.apiKey;if(!s)throw new Error("API key is required for Mistral");let i=m({apiKey:s});return l({model:i(t.model),messages:a,temperature:t.temperature||e.temperature||.7,maxOutputTokens:t.maxTokens||e.maxTokens||2048}).textStream}},P=async t=>{let a=Date.now();try{let r=t.credentials.providerSettings?.apiKey||t.credentials.apiKey;if(!r)throw new Error("API key is required for Mistral");let s=m({apiKey:r}),i=await p({model:s(t.credentials.model),system:t.systemPrompt,prompt:t.userPrompt}),o=Date.now()-a;return{command:n(i.text),generationTime:o}}catch(e){throw new Error(`Mistral exec generation failed: ${e}`)}};export{d as a,c as b,M as c,f as d,h as e,P as f}; /* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */ //# sourceMappingURL=chunk-OY42LAGY.js.map