@memberjunction/ai-lmstudio 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +84 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # @memberjunction/ai-lm-studio
2
+
3
+ MemberJunction AI provider for LM Studio, enabling integration with locally-hosted models through LM Studio's OpenAI-compatible API. This package extends the OpenAI provider to connect to LM Studio's local inference server.
4
+
5
+ ## Architecture
6
+
7
+ ```mermaid
8
+ graph TD
9
+ A["LMStudioLLM<br/>(Provider)"] -->|extends| B["OpenAILLM<br/>(@memberjunction/ai-openai)"]
10
+ B -->|extends| C["BaseLLM<br/>(@memberjunction/ai)"]
11
+ A -->|connects to| D["LM Studio Server<br/>(localhost:1234/v1)"]
12
+ D -->|runs| E["Local Models<br/>(GGUF, GGML)"]
13
+ C -->|registered via| F["@RegisterClass"]
14
+
15
+ style A fill:#7c5295,stroke:#563a6b,color:#fff
16
+ style B fill:#2d6a9f,stroke:#1a4971,color:#fff
17
+ style C fill:#2d6a9f,stroke:#1a4971,color:#fff
18
+ style D fill:#2d8659,stroke:#1a5c3a,color:#fff
19
+ style E fill:#b8762f,stroke:#8a5722,color:#fff
20
+ style F fill:#b8762f,stroke:#8a5722,color:#fff
21
+ ```
22
+
23
+ ## Features
24
+
25
+ - **Local Model Hosting**: Run AI models locally without cloud dependencies
26
+ - **OpenAI Compatible**: Inherits all features from the OpenAI provider
27
+ - **Streaming**: Full streaming support for real-time responses
28
+ - **No API Key Required**: Connects to local server (API key parameter ignored)
29
+ - **Model Flexibility**: Use any model loaded in LM Studio (GGUF, GGML formats)
30
+ - **Privacy**: All data stays on your local machine
31
+ - **Configurable Endpoint**: Support for custom host and port settings
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ npm install @memberjunction/ai-lm-studio
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ```typescript
42
+ import { LMStudioLLM } from '@memberjunction/ai-lm-studio';
43
+
44
+ // API key is not used but required by the interface
45
+ const llm = new LMStudioLLM('not-used');
46
+
47
+ const result = await llm.ChatCompletion({
48
+ model: 'local-model', // Model loaded in LM Studio
49
+ messages: [
50
+ { role: 'system', content: 'You are a helpful assistant.' },
51
+ { role: 'user', content: 'Explain how local inference works.' }
52
+ ],
53
+ temperature: 0.7
54
+ });
55
+
56
+ if (result.success) {
57
+ console.log(result.data.choices[0].message.content);
58
+ }
59
+ ```
60
+
61
+ ## Configuration
62
+
63
+ The default endpoint is `http://localhost:1234/v1`. Configure via `SetAdditionalSettings` if using a different host/port.
64
+
65
+ ## How It Works
66
+
67
+ `LMStudioLLM` is a thin subclass of `OpenAILLM` that redirects API calls to LM Studio's local server endpoint. LM Studio provides an OpenAI-compatible API, so all chat, streaming, and parameter handling is inherited from the OpenAI provider.
68
+
69
+ ## Prerequisites
70
+
71
+ 1. Install [LM Studio](https://lmstudio.ai/)
72
+ 2. Download and load a model in LM Studio
73
+ 3. Start the local server (default: port 1234)
74
+ 4. Configure the provider in your MemberJunction application
75
+
76
+ ## Class Registration
77
+
78
+ Registered as `LMStudioLLM` via `@RegisterClass(BaseLLM, 'LMStudioLLM')`.
79
+
80
+ ## Dependencies
81
+
82
+ - `@memberjunction/ai` - Core AI abstractions
83
+ - `@memberjunction/ai-openai` - OpenAI provider (parent class)
84
+ - `@memberjunction/global` - Class registration
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/ai-lmstudio",
3
3
  "type": "module",
4
- "version": "4.0.0",
4
+ "version": "4.2.0",
5
5
  "description": "MemberJunction Wrapper for LM Studio AI - Local Inference Engine",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "typescript": "^5.9.3"
21
21
  },
22
22
  "dependencies": {
23
- "@memberjunction/ai": "4.0.0",
24
- "@memberjunction/global": "4.0.0",
23
+ "@memberjunction/ai": "4.2.0",
24
+ "@memberjunction/global": "4.2.0",
25
25
  "@lmstudio/sdk": "^1.5.0"
26
26
  },
27
27
  "repository": {