(rawModel: LLMInstanceInfo | LLMInfo)
| 35 | } |
| 36 | |
| 37 | export const parseLMStudioModel = (rawModel: LLMInstanceInfo | LLMInfo): ModelInfo => { |
| 38 | // Handle both LLMInstanceInfo (from loaded models) and LLMInfo (from downloaded models) |
| 39 | const contextLength = "contextLength" in rawModel ? rawModel.contextLength : rawModel.maxContextLength |
| 40 | |
| 41 | const modelInfo: ModelInfo = Object.assign({}, lMStudioDefaultModelInfo, { |
| 42 | description: `${rawModel.displayName} - ${rawModel.path}`, |
| 43 | contextWindow: contextLength, |
| 44 | supportsPromptCache: true, |
| 45 | supportsImages: rawModel.vision, |
| 46 | maxTokens: contextLength, |
| 47 | }) |
| 48 | |
| 49 | return modelInfo |
| 50 | } |
| 51 | |
| 52 | export async function getLMStudioModels(baseUrl = "http://localhost:1234"): Promise<Record<string, ModelInfo>> { |
| 53 | // clear the set of models that have full details loaded |
no outgoing calls
no test coverage detected