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.45 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 m}from"./chunk-DZIEWBQ3.js";import{createXai as n}from"@ai-sdk/xai";import{generateText as g,streamText as p}from"ai";var x=["grok-4","grok-4-0709","grok-4-latest","grok-3","grok-3-latest","grok-3-fast","grok-3-fast-latest","grok-3-mini","grok-3-mini-latest","grok-3-mini-fast","grok-3-mini-fast-latest","grok-2-vision-1212","grok-2-vision","grok-2-vision-latest","grok-2-image-1212","grok-2-image","grok-2-image-latest","grok-2-1212","grok-2","grok-2-latest","grok-vision-beta","grok-beta"],d=x.map(e=>({name:e,displayName:e})),u={name:"xai",displayName:"\u{1F916} xAI (Grok)",models:d},f=async(e,a)=>{try{let t=e.providerSettings,r=t?.apiKey||e.apiKey;if(!r)throw new Error("API key is required for xAI");let o=t?.baseURL||"https://api.x.ai/v1",s=n({apiKey:r,baseURL:o}),i=p({model:s(e.model),prompt:a,temperature:e.temperature||.7,maxOutputTokens:e.maxTokens||2048});return{textStream:i.textStream,fullResponse:i.text}}catch(t){throw new Error(`Error calling xAI streaming API: ${t instanceof Error?t.message:String(t)}`)}},I={name:"xai",displayName:"\u{1F916} xAI (Grok)",async streamChat(e,a,t={}){let r=e.providerSettings||{},o=r.apiKey||e.apiKey,s=r.baseURL||"https://api.x.ai/v1";if(!o)throw new Error("API key is required for xAI");let i=n({apiKey:o,baseURL:s});return p({model:i(e.model),messages:a,temperature:e.temperature||t.temperature||.7,maxOutputTokens:e.maxTokens||t.maxTokens||2048}).textStream}},h=async e=>{let a=Date.now();try{let t=e.credentials.providerSettings,r=n({apiKey:e.credentials.apiKey,baseURL:t?.baseURL}),o=await g({model:r(e.credentials.model),system:e.systemPrompt,prompt:e.userPrompt}),s=Date.now()-a;return{command:m(o.text),generationTime:s}}catch(t){throw new Error(`xAI exec generation failed: ${t}`)}};export{d as a,u as b,f as c,I as d,h as e}; /* 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-VZTFFEJU.js.map