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 • 3.55 kB
JavaScript
Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/* 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. */
var _chunkYTPAJ6Q2cjs = require('./chunk-YTPAJ6Q2.cjs');var _mistral = require('@ai-sdk/mistral');var _ai = require('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= exports.b =d.map(t=>({name:t,displayName:t})),M= exports.c ={name:"mistral",displayName:"\u{1F7E0} Mistral AI",models:c},f= exports.d =async(t,a)=>{try{let e=t.providerSettings,r=_optionalChain([e, 'optionalAccess', _ => _.apiKey])||t.apiKey;if(!r)throw new Error("API key is required for Mistral");let s=_optionalChain([e, 'optionalAccess', _2 => _2.baseURL])||"https://api.mistral.ai/v1",i=_mistral.createMistral.call(void 0, {apiKey:r,baseURL:s}),o=_ai.streamText.call(void 0, {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= exports.e ={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=_mistral.createMistral.call(void 0, {apiKey:s});return _ai.streamText.call(void 0, {model:i(t.model),messages:a,temperature:t.temperature||e.temperature||.7,maxOutputTokens:t.maxTokens||e.maxTokens||2048}).textStream}},P= exports.f =async t=>{let a=Date.now();try{let r=_optionalChain([t, 'access', _3 => _3.credentials, 'access', _4 => _4.providerSettings, 'optionalAccess', _5 => _5.apiKey])||t.credentials.apiKey;if(!r)throw new Error("API key is required for Mistral");let s=_mistral.createMistral.call(void 0, {apiKey:r}),i=await _ai.generateText.call(void 0, {model:s(t.credentials.model),system:t.systemPrompt,prompt:t.userPrompt}),o=Date.now()-a;return{command:_chunkYTPAJ6Q2cjs.a.call(void 0, i.text),generationTime:o}}catch(e){throw new Error(`Mistral exec generation failed: ${e}`)}};exports.a = d; exports.b = c; exports.c = M; exports.d = f; exports.e = h; exports.f = P;
/* 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-OOLTO3KM.cjs.map
;