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.75 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 _google = require('@ai-sdk/google');var _ai = require('ai');var p=["gemini-1.5-flash","gemini-1.5-flash-latest","gemini-1.5-flash-001","gemini-1.5-flash-002","gemini-1.5-flash-8b","gemini-1.5-flash-8b-latest","gemini-1.5-flash-8b-001","gemini-1.5-pro","gemini-1.5-pro-latest","gemini-1.5-pro-001","gemini-1.5-pro-002","gemini-2.0-flash","gemini-2.0-flash-001","gemini-2.0-flash-live-001","gemini-2.0-flash-lite","gemini-2.0-pro-exp-02-05","gemini-2.0-flash-thinking-exp-01-21","gemini-2.0-flash-exp","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite","gemini-2.5-pro-exp-03-25","gemini-2.5-flash-preview-04-17","gemini-exp-1206","gemma-3-12b-it","gemma-3-27b-it"],d= exports.a =p.map(e=>({name:e,displayName:e})),y= exports.b ={name:"google",displayName:"\u{1F534} Google (Gemini)",models:d},x= exports.c =async(e,r)=>{try{let o=e.providerSettings,i=_optionalChain([o, 'optionalAccess', _ => _.apiKey])||e.apiKey;if(!i)throw new Error("API key is required for Google");let t=_optionalChain([o, 'optionalAccess', _2 => _2.baseURL])||"https://generativelanguage.googleapis.com/v1beta",s=_google.createGoogleGenerativeAI.call(void 0, {apiKey:i,baseURL:t}),a=_ai.streamText.call(void 0, {model:s(e.model),prompt:r,temperature:e.temperature||.7,maxOutputTokens:e.maxTokens||2048});return{textStream:a.textStream,fullResponse:a.text}}catch(o){throw new Error(`Error calling Google AI streaming API: ${o instanceof Error?o.message:String(o)}`)}},G= exports.d ={name:"google",displayName:"\u{1F534} Google (Gemini)",async streamChat(e,r,o={}){let t=(e.providerSettings||{}).apiKey||e.apiKey;if(!t)throw new Error("API key is required for Google");let s=_google.createGoogleGenerativeAI.call(void 0, {apiKey:t});return _ai.streamText.call(void 0, {model:s(e.model),messages:r,temperature:e.temperature||o.temperature||.7,maxOutputTokens:e.maxTokens||o.maxTokens||2048}).textStream}},u= exports.e =async e=>{let r=Date.now();try{let o=e.credentials.providerSettings,i=_google.createGoogleGenerativeAI.call(void 0, {apiKey:e.credentials.apiKey,baseURL:_optionalChain([o, 'optionalAccess', _3 => _3.baseURL])}),t=await _ai.generateText.call(void 0, {model:i(e.credentials.model),system:e.systemPrompt,prompt:e.userPrompt}),s=Date.now()-r;return{command:_chunkYTPAJ6Q2cjs.a.call(void 0, t.text),generationTime:s}}catch(o){throw new Error(`Google exec generation failed: ${o}`)}};exports.a = d; exports.b = y; exports.c = x; exports.d = G; exports.e = u; /* 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-23ZSXDYA.cjs.map