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 3.36 kB
"use strict";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 _cerebras = require('@ai-sdk/cerebras');var _ai = require('ai');var d=["llama3.1-8b","llama3.1-70b","llama3.3-70b"],b= exports.b =d.map(e=>({name:e,displayName:e})),x= exports.c ={name:"cerebras",displayName:"\u{1F9E0} Cerebras",models:b},g= exports.d =async(e,a)=>{try{let r=e.providerSettings,t=_optionalChain([r, 'optionalAccess', _ => _.apiKey])||e.apiKey;if(!t)throw new Error("API key is required for Cerebras");let s=_optionalChain([r, 'optionalAccess', _2 => _2.baseURL])||"https://api.cerebras.ai/v1",o=_cerebras.createCerebras.call(void 0, {apiKey:t,baseURL:s}),n=_ai.streamText.call(void 0, {model:o(e.model),prompt:a,temperature:e.temperature||.7,maxOutputTokens:e.maxTokens||2048});return{textStream:n.textStream,fullResponse:n.text}}catch(r){throw new Error(`Error calling Cerebras streaming API: ${r instanceof Error?r.message:String(r)}`)}},h= exports.e ={name:"cerebras",displayName:"\u{1F9E0} Cerebras",async streamChat(e,a,r={}){let t=e.providerSettings||{},s=t.apiKey||e.apiKey;if(!s)throw new Error("API key is required for Cerebras");let o=_cerebras.createCerebras.call(void 0, {apiKey:s,baseURL:t.baseURL||"https://api.cerebras.ai/v1"});return _ai.streamText.call(void 0, {model:o(e.model),messages:a,temperature:e.temperature||r.temperature||.7,maxOutputTokens:e.maxTokens||r.maxTokens||2048}).textStream}},f= exports.f =async e=>{let a=Date.now();try{let r=e.credentials.providerSettings,t=_optionalChain([r, 'optionalAccess', _3 => _3.apiKey])||e.credentials.apiKey;if(!t)throw new Error("API key is required for Cerebras");let s=_cerebras.createCerebras.call(void 0, {apiKey:t,baseURL:_optionalChain([r, 'optionalAccess', _4 => _4.baseURL])||"https://api.cerebras.ai/v1"}),o=await _ai.generateText.call(void 0, {model:s(e.credentials.model),system:e.systemPrompt,prompt:e.userPrompt}),n=Date.now()-a;return{command:_chunkYTPAJ6Q2cjs.a.call(void 0, o.text),generationTime:n}}catch(r){throw new Error(`Cerebras exec generation failed: ${r}`)}};exports.a = d; exports.b = b; exports.c = x; exports.d = g; exports.e = h; exports.f = 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-7IO5BLNF.cjs.map