UNPKG

rawi

Version:

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

1 lines 4.03 kB
{"version":3,"sources":["/home/mkabumattar/withrawi/rawi/dist/chunk-P47BPYQX.cjs","../src/core/providers/lmstudio.provider.ts"],"names":["lmstudioModelIds","lmstudioModels","name","lmstudioProvider","streamWithLMStudio","credentials","prompt","baseURL","lmstudio","createLMStudio","result","streamText","error"],"mappings":"AAAA;ACAA,4CAAuD,wBAC9B,IAWnBA,CAAAA,CAAmB,CACvB,oCAAA,CACA,mBAAA,CACA,mBAAA,CACA,oBAAA,CACA,oBAAA,CACA,mBAAA,CACA,oBAAA,CACA,oBAAA,CACA,oBAAA,CACA,iBAAA,CACA,gCAAA,CACA,gCAAA,CACA,8BAAA,CACA,+BAAA,CACA,2BAAA,CACA,6BAAA,CACA,oCAAA,CACA,sCAAA,CACA,6BAAA,CACA,wBAAA,CACA,wBAAA,CACA,oBAAA,CACA,iBAAA,CACA,eAAA,CACA,eAAA,CACA,gBAAA,CACA,sBAAA,CACA,oBAAA,CACA,gBAAA,CACA,cACF,CAAA,CAEaC,CAAAA,aAA8BD,CAAAA,CAAiB,GAAA,CAAKE,CAAAA,EAAAA,CAAU,CACzE,IAAA,CAAAA,CAAAA,CACA,WAAA,CAAaA,CACf,CAAA,CAAE,CAAA,CAEWC,CAAAA,aAAmB,CAC9B,IAAA,CAAM,UAAA,CACN,WAAA,CAAa,qBAAA,CACb,MAAA,CAAQF,CACV,CAAA,CAEaG,CAAAA,aAAqB,KAAA,CAChCC,CAAAA,CACAC,CAAAA,CAAAA,EAC+B,CAC/B,GAAI,CAIF,IAAMC,CAAAA,iBAHWF,CAAAA,mBAAY,gBAAA,6BAGH,SAAA,EAAW,0BAAA,CAE/BG,CAAAA,CAAWC,8CAAAA,CACf,OAAA,CAAAF,CAAAA,CACA,IAAA,CAAM,UACR,CAAC,CAAA,CAEKG,CAAAA,CAASC,4BAAAA,CACb,KAAA,CAAOH,CAAAA,CAAS,SAAA,CAAUH,CAAAA,CAAY,KAAK,CAAA,CAC3C,MAAA,CAAAC,CAAAA,CACA,WAAA,CAAaD,CAAAA,CAAY,WAAA,EAAe,EAAA,CACxC,SAAA,CAAWA,CAAAA,CAAY,SAAA,EAAa,IACtC,CAAC,CAAA,CAED,MAAO,CACL,UAAA,CAAYK,CAAAA,CAAO,UAAA,CACnB,YAAA,CAAcA,CAAAA,CAAO,IACvB,CACF,CAAA,KAAA,CAASE,CAAAA,CAAO,CACd,MAAM,IAAI,KAAA,CACR,CAAA,uCAAA,EACEA,EAAAA,WAAiB,KAAA,CAAQA,CAAAA,CAAM,OAAA,CAAU,MAAA,CAAOA,CAAK,CACvD,CAAA,CAAA;ADpF4wC","file":"/home/mkabumattar/withrawi/rawi/dist/chunk-P47BPYQX.cjs","sourcesContent":[null,"import {createOpenAICompatible as createLMStudio} from '@ai-sdk/lmstudio';\nimport {streamText} from 'ai';\nimport type {\n LooseToStrict,\n ModelInfo,\n RawiCredentials,\n StreamingResponse,\n} from '../shared/index.js';\n\ntype LooseLMStudioModelId = string;\nexport type LMStudioModelId = LooseToStrict<LooseLMStudioModelId>;\n\nconst lmstudioModelIds = [\n 'deepseek/deepseek-r1-0528-qwen3-8b',\n 'google/gemma-3-1b',\n 'google/gemma-2-9b',\n 'google/gemma-3-12b',\n 'google/gemma-3-27b',\n 'google/gemma-3-4b',\n 'ibm/granite-3.1-8b',\n 'ibm/granite-3.2-8b',\n 'meta/llama-3.3-70b',\n 'microsoft/phi-4',\n 'microsoft/phi-4-mini-reasoning',\n 'microsoft/phi-4-reasoning-plus',\n 'mistralai/codestral-22b-v0.1',\n 'mistralai/devstral-small-2505',\n 'mistralai/magistral-small',\n 'mistralai/mathstral-7b-v0.1',\n 'mistralai/mistral-7b-instruct-v0.3',\n 'mistralai/mistral-nemo-instruct-2407',\n 'mistralai/mistral-small-3.2',\n 'qwen/qwen2.5-coder-14b',\n 'qwen/qwen2.5-coder-32b',\n 'qwen/qwen2.5-vl-7b',\n 'qwen/qwen3-1.7b',\n 'qwen/qwen3-4b',\n 'qwen/qwen3-8b',\n 'qwen/qwen3-14b',\n 'qwen/qwen3-235b-a22b',\n 'qwen/qwen3-30b-a3b',\n 'qwen/qwen3-32b',\n 'qwen/qwq-32b',\n] as const;\n\nexport const lmstudioModels: ModelInfo[] = lmstudioModelIds.map((name) => ({\n name,\n displayName: name,\n}));\n\nexport const lmstudioProvider = {\n name: 'lmstudio' as const,\n displayName: '🟣 LM Studio',\n models: lmstudioModels,\n} as const;\n\nexport const streamWithLMStudio = async (\n credentials: RawiCredentials,\n prompt: string,\n): Promise<StreamingResponse> => {\n try {\n const settings = credentials.providerSettings as\n | {baseURL?: string}\n | undefined;\n const baseURL = settings?.baseURL || 'http://localhost:1234/v1';\n\n const lmstudio = createLMStudio({\n baseURL,\n name: 'lmstudio',\n });\n\n const result = streamText({\n model: lmstudio.chatModel(credentials.model),\n prompt,\n temperature: credentials.temperature || 0.7,\n maxTokens: credentials.maxTokens || 2048,\n });\n\n return {\n textStream: result.textStream,\n fullResponse: result.text,\n };\n } catch (error) {\n throw new Error(\n `Error calling LM Studio streaming API: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n};\n"]}