smoltalk 0.12.1 → 0.13.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.
- package/README.md +4 -2
- package/dist/client.d.ts +1 -0
- package/dist/client.js +4 -0
- package/dist/clients/mlx.d.ts +15 -0
- package/dist/clients/mlx.js +19 -0
- package/dist/clients/openai.js +5 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/modelData.d.ts +0 -8
- package/dist/modelData.js +0 -68
- package/dist/modelRefresh.d.ts +10 -0
- package/dist/modelRefresh.js +78 -0
- package/dist/models.d.ts +2 -1
- package/dist/models.js +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/util/provider.d.ts +1 -0
- package/dist/util/provider.js +2 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -197,8 +197,8 @@ Two provider notes:
|
|
|
197
197
|
| `model` | `ModelName` | **Required.** The model to use (e.g. `"gpt-4o"`, `"gemini-2.0-flash-lite"`). |
|
|
198
198
|
| `messages` | `Message[]` | **Required.** The conversation messages to send. |
|
|
199
199
|
| `apiKey` | `{ openAi?, google?, anthropic?, ollama?, openRouter?, deepInfra?, liteLlm?, openAiCompat? }` | API keys, nested by provider. Each falls back to its conventional env var (`OPENAI_API_KEY`, `GEMINI_API_KEY`, `ANTHROPIC_API_KEY`, `OPENROUTER_API_KEY`, `DEEPINFRA_API_KEY`, `LITELLM_API_KEY`, `OPENAI_COMPAT_API_KEY`). Ollama has no env-var fallback for the key. |
|
|
200
|
-
| `baseUrl` | `{ ollama?, openRouter?, deepInfra?, liteLlm?, openAiCompat? }` | Custom base URLs. `ollama` defaults to `$OLLAMA_HOST` then `http://localhost:11434`; `openRouter`/`deepInfra` defaults are baked in; `liteLlm`/`openAiCompat` require an explicit URL (or `LITELLM_BASE_URL` / `OPENAI_COMPAT_BASE_URL` env). |
|
|
201
|
-
| `provider` | `Provider` | Override provider detection. One of `"openai"`, `"openai-responses"`, `"google"`, `"ollama"`, `"anthropic"`, `"openrouter"`, `"deepinfra"`, `"litellm"`, `"openai-compat"`, or any provider registered via `registerProvider()`. |
|
|
200
|
+
| `baseUrl` | `{ ollama?, openRouter?, deepInfra?, liteLlm?, openAiCompat?, mlx? }` | Custom base URLs. `ollama` defaults to `$OLLAMA_HOST` then `http://localhost:11434`; `openRouter`/`deepInfra` defaults are baked in; `mlx` defaults to `$MLX_BASE_URL` then `http://127.0.0.1:8080/v1`; `liteLlm`/`openAiCompat` require an explicit URL (or `LITELLM_BASE_URL` / `OPENAI_COMPAT_BASE_URL` env). |
|
|
201
|
+
| `provider` | `Provider` | Override provider detection. One of `"openai"`, `"openai-responses"`, `"google"`, `"ollama"`, `"anthropic"`, `"openrouter"`, `"deepinfra"`, `"litellm"`, `"openai-compat"`, `"mlx"`, or any provider registered via `registerProvider()`. |
|
|
202
202
|
| `logLevel` | `LogLevel` | Logging verbosity: `"debug"`, `"info"`, `"warn"`, `"error"`. |
|
|
203
203
|
| `tools` | `{ name, description?, schema }[]` | Tool definitions. `schema` is a Zod object schema. |
|
|
204
204
|
| `responseFormat` | `ZodType` | Zod schema for structured output. The response is parsed and validated against this schema. |
|
|
@@ -254,6 +254,7 @@ model ids aren't in the smoltalk registry.
|
|
|
254
254
|
| `"deepinfra"` | DeepInfra hosted models | `apiKey.deepInfra` (or `DEEPINFRA_API_KEY`) | `usage.estimated_cost` |
|
|
255
255
|
| `"litellm"` | Your own LiteLLM proxy | `apiKey.liteLlm` + `baseUrl.liteLlm` (or `LITELLM_API_KEY` / `LITELLM_BASE_URL`) | `x-litellm-response-cost` header (non-stream only) |
|
|
256
256
|
| `"openai-compat"` | Any OpenAI-shape backend (vLLM, TGI, LM Studio…) | `apiKey.openAiCompat` + `baseUrl.openAiCompat` (or `OPENAI_COMPAT_API_KEY` / `OPENAI_COMPAT_BASE_URL`) | Best-effort: reads `usage.cost`/`estimated_cost`/`cost_usd` if present |
|
|
257
|
+
| `"mlx"` | An MLX server on localhost (`mlx_lm.server`, or `agency local serve`) | none — `baseUrl.mlx` or `MLX_BASE_URL` (default `http://127.0.0.1:8080/v1`); no API key | Always `0` |
|
|
257
258
|
|
|
258
259
|
```ts
|
|
259
260
|
import { textSync, userMessage } from "smoltalk";
|
|
@@ -275,6 +276,7 @@ const r = await textSync({
|
|
|
275
276
|
| `deepinfra` | ✅ | ✅ | ❌ (uses per-model endpoints, not OpenAI shape) | ❌ |
|
|
276
277
|
| `litellm` | ✅ | ✅ | ✅ (if the upstream model supports it) | ✅ (if upstream supports it) |
|
|
277
278
|
| `openai-compat` | ✅ | ✅ | ✅ (backend-dependent) | depends on backend |
|
|
279
|
+
| `mlx` | ✅ | ❌ | ❌ | ❌ |
|
|
278
280
|
|
|
279
281
|
Smoltalk surfaces a clear `failure(...)` from `embed()`/`image()` for the
|
|
280
282
|
unsupported combinations rather than silently dropping the call.
|
package/dist/client.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./clients/openaiCompat.js";
|
|
|
8
8
|
export * from "./clients/openrouter.js";
|
|
9
9
|
export * from "./clients/deepinfra.js";
|
|
10
10
|
export * from "./clients/litellm.js";
|
|
11
|
+
export * from "./clients/mlx.js";
|
|
11
12
|
import { BaseClient } from "./clients/baseClient.js";
|
|
12
13
|
import { SmolClientConfig } from "./types.js";
|
|
13
14
|
export declare function registerProvider(providerName: string, clientClass: typeof BaseClient): void;
|
package/dist/client.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./clients/openaiCompat.js";
|
|
|
8
8
|
export * from "./clients/openrouter.js";
|
|
9
9
|
export * from "./clients/deepinfra.js";
|
|
10
10
|
export * from "./clients/litellm.js";
|
|
11
|
+
export * from "./clients/mlx.js";
|
|
11
12
|
import { SmolAnthropic } from "./clients/anthropic.js";
|
|
12
13
|
import { SmolGoogle } from "./clients/google.js";
|
|
13
14
|
import { SmolOllama } from "./clients/ollama.js";
|
|
@@ -17,6 +18,7 @@ import { SmolOpenAiCompat } from "./clients/openaiCompat.js";
|
|
|
17
18
|
import { SmolOpenRouter } from "./clients/openrouter.js";
|
|
18
19
|
import { SmolDeepInfra } from "./clients/deepinfra.js";
|
|
19
20
|
import { SmolLiteLlm } from "./clients/litellm.js";
|
|
21
|
+
import { SmolMlx } from "./clients/mlx.js";
|
|
20
22
|
import { getModel, isTextModel } from "./models.js";
|
|
21
23
|
import { SmolError } from "./smolError.js";
|
|
22
24
|
import { resolveApiKey, resolveProvider } from "./util/provider.js";
|
|
@@ -103,6 +105,8 @@ export function getClient(config) {
|
|
|
103
105
|
return new SmolLiteLlm(clientConfig);
|
|
104
106
|
case "openai-compat":
|
|
105
107
|
return new SmolOpenAiCompat(clientConfig);
|
|
108
|
+
case "mlx":
|
|
109
|
+
return new SmolMlx(clientConfig);
|
|
106
110
|
default:
|
|
107
111
|
if (provider in registeredProviders) {
|
|
108
112
|
const ClientClass = registeredProviders[provider];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SmolOpenAiCompat } from "./openaiCompat.js";
|
|
2
|
+
import type { SmolConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Client for an MLX server on localhost, usually started with `mlx_lm.server`
|
|
5
|
+
* (or `agency local serve`). The server speaks the OpenAI chat format, so this
|
|
6
|
+
* is the openai-compat client with three things fixed: the base URL has a
|
|
7
|
+
* default, no API key is needed, and the cost is always zero.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SmolMlx extends SmolOpenAiCompat {
|
|
10
|
+
protected resolveClientOptions(config: SmolConfig): {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
baseURL: string;
|
|
13
|
+
};
|
|
14
|
+
protected resolveCostUsd(): number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SmolOpenAiCompat } from "./openaiCompat.js";
|
|
2
|
+
import { resolveBaseUrl } from "../util/provider.js";
|
|
3
|
+
/**
|
|
4
|
+
* Client for an MLX server on localhost, usually started with `mlx_lm.server`
|
|
5
|
+
* (or `agency local serve`). The server speaks the OpenAI chat format, so this
|
|
6
|
+
* is the openai-compat client with three things fixed: the base URL has a
|
|
7
|
+
* default, no API key is needed, and the cost is always zero.
|
|
8
|
+
*/
|
|
9
|
+
export class SmolMlx extends SmolOpenAiCompat {
|
|
10
|
+
resolveClientOptions(config) {
|
|
11
|
+
// resolveBaseUrl always returns a value for "mlx" (it has a default).
|
|
12
|
+
const baseURL = resolveBaseUrl("mlx", config);
|
|
13
|
+
// The OpenAI SDK refuses an empty key. The local server never reads it.
|
|
14
|
+
return { apiKey: "mlx-local", baseURL };
|
|
15
|
+
}
|
|
16
|
+
resolveCostUsd() {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/clients/openai.js
CHANGED
|
@@ -179,7 +179,11 @@ export class SmolOpenAi extends BaseClient {
|
|
|
179
179
|
throw new SmolContentPolicyError("Content blocked by OpenAI content filter");
|
|
180
180
|
}
|
|
181
181
|
const message = completion.choices[0].message;
|
|
182
|
-
|
|
182
|
+
// mlx_lm.server omits `content` entirely on a tool-call reply, where OpenAI
|
|
183
|
+
// sends an explicit null. Coerce the missing case to null so `output`
|
|
184
|
+
// honors its declared `string | null` type (a no-op for real OpenAI, whose
|
|
185
|
+
// content is already string | null).
|
|
186
|
+
const output = message.content ?? null;
|
|
183
187
|
const _toolCalls = message.tool_calls;
|
|
184
188
|
const toolCalls = [];
|
|
185
189
|
if (_toolCalls) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/modelData.d.ts
CHANGED
|
@@ -30,11 +30,3 @@ export declare function parseModelDataBlob(raw: string): Result<ModelDataBlob>;
|
|
|
30
30
|
export declare function deepMergeEntry<T>(base: T, overlay: T): T;
|
|
31
31
|
export declare function mergeModelData(base: ModelType[], overlay: ModelType[]): ModelType[];
|
|
32
32
|
export declare function mergeHostedTools(base: HostedTool[], overlay: HostedTool[]): HostedTool[];
|
|
33
|
-
export declare const DEFAULT_MODEL_DATA_URL = "https://raw.githubusercontent.com/egonSchiele/smoltalk/main/packages/smoltalk/data/model-data.json";
|
|
34
|
-
export type Fetcher = (url: string, signal?: AbortSignal) => Promise<string>;
|
|
35
|
-
export type RefreshOptions = {
|
|
36
|
-
url?: string;
|
|
37
|
-
fetcher?: Fetcher;
|
|
38
|
-
signal?: AbortSignal;
|
|
39
|
-
};
|
|
40
|
-
export declare function refreshModels(opts?: RefreshOptions): Promise<Result<ModelDataBlob>>;
|
package/dist/modelData.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
2
|
import { success, failure } from "./types/result.js";
|
|
5
3
|
export const SUPPORTED_SCHEMA_VERSION = 1;
|
|
6
4
|
const EnvelopeSchema = z.object({
|
|
@@ -154,69 +152,3 @@ export function mergeModelData(base, overlay) {
|
|
|
154
152
|
export function mergeHostedTools(base, overlay) {
|
|
155
153
|
return mergeByKey(base, overlay, (t) => `${t.provider}:${t.name}`);
|
|
156
154
|
}
|
|
157
|
-
export const DEFAULT_MODEL_DATA_URL = "https://raw.githubusercontent.com/egonSchiele/smoltalk/main/packages/smoltalk/data/model-data.json";
|
|
158
|
-
const MAX_BYTES = 10_000_000;
|
|
159
|
-
const TIMEOUT_MS = 15_000;
|
|
160
|
-
function enforceSizeCap(text) {
|
|
161
|
-
if (Buffer.byteLength(text, "utf8") > MAX_BYTES) {
|
|
162
|
-
throw new Error(`Model data exceeds the ${MAX_BYTES}-byte cap`);
|
|
163
|
-
}
|
|
164
|
-
return text;
|
|
165
|
-
}
|
|
166
|
-
// The default fetcher supports remote https:// URLs and local file:// URLs.
|
|
167
|
-
// file:// lets users point at a self-hosted on-disk catalog (and powers the
|
|
168
|
-
// integration test). Any other scheme is rejected.
|
|
169
|
-
async function defaultFetcher(url, signal) {
|
|
170
|
-
if (url.startsWith("file://")) {
|
|
171
|
-
const path = fileURLToPath(url);
|
|
172
|
-
const text = await readFile(path, "utf8");
|
|
173
|
-
return enforceSizeCap(text);
|
|
174
|
-
}
|
|
175
|
-
if (url.startsWith("https://")) {
|
|
176
|
-
const res = await fetch(url, { signal });
|
|
177
|
-
if (!res.ok) {
|
|
178
|
-
throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
|
179
|
-
}
|
|
180
|
-
return enforceSizeCap(await res.text());
|
|
181
|
-
}
|
|
182
|
-
throw new Error(`Unsupported model-data URL scheme (expected https:// or file://): ${url}`);
|
|
183
|
-
}
|
|
184
|
-
export async function refreshModels(opts = {}) {
|
|
185
|
-
let url = DEFAULT_MODEL_DATA_URL;
|
|
186
|
-
if (process.env.SMOLTALK_MODEL_DATA_URL) {
|
|
187
|
-
url = process.env.SMOLTALK_MODEL_DATA_URL;
|
|
188
|
-
}
|
|
189
|
-
if (opts.url) {
|
|
190
|
-
url = opts.url;
|
|
191
|
-
}
|
|
192
|
-
let fetcher = defaultFetcher;
|
|
193
|
-
if (opts.fetcher) {
|
|
194
|
-
fetcher = opts.fetcher;
|
|
195
|
-
}
|
|
196
|
-
// Always drive the fetcher off our own controller so the timeout can abort
|
|
197
|
-
// it. Forward an externally-supplied signal into the same controller so both
|
|
198
|
-
// the timeout and the caller can cancel.
|
|
199
|
-
const controller = new AbortController();
|
|
200
|
-
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
201
|
-
if (opts.signal) {
|
|
202
|
-
if (opts.signal.aborted) {
|
|
203
|
-
controller.abort();
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
opts.signal.addEventListener("abort", () => controller.abort(), {
|
|
207
|
-
once: true,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
let raw;
|
|
212
|
-
try {
|
|
213
|
-
raw = await fetcher(url, controller.signal);
|
|
214
|
-
}
|
|
215
|
-
catch (err) {
|
|
216
|
-
return failure(`Could not fetch model data from ${url}: ${String(err)}`);
|
|
217
|
-
}
|
|
218
|
-
finally {
|
|
219
|
-
clearTimeout(timer);
|
|
220
|
-
}
|
|
221
|
-
return parseModelDataBlob(raw);
|
|
222
|
-
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ModelDataBlob } from "./modelData.js";
|
|
2
|
+
import { Result } from "./types/result.js";
|
|
3
|
+
export declare const DEFAULT_MODEL_DATA_URL = "https://raw.githubusercontent.com/egonSchiele/smoltalk/main/packages/smoltalk/data/model-data.json";
|
|
4
|
+
export type Fetcher = (url: string, signal?: AbortSignal) => Promise<string>;
|
|
5
|
+
export type RefreshOptions = {
|
|
6
|
+
url?: string;
|
|
7
|
+
fetcher?: Fetcher;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
};
|
|
10
|
+
export declare function refreshModels(opts?: RefreshOptions): Promise<Result<ModelDataBlob>>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetching refreshed model data from a remote or on-disk catalog.
|
|
3
|
+
*
|
|
4
|
+
* Split out of modelData.ts so that module — and therefore models.ts, and
|
|
5
|
+
* therefore the model registry — carries no Node dependency. Everything here
|
|
6
|
+
* needs a Node runtime (node:fs, Buffer, process.env); everything in
|
|
7
|
+
* modelData.ts is pure and bundles for the browser.
|
|
8
|
+
*/
|
|
9
|
+
import { readFile } from "node:fs/promises";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { parseModelDataBlob } from "./modelData.js";
|
|
12
|
+
import { failure } from "./types/result.js";
|
|
13
|
+
export const DEFAULT_MODEL_DATA_URL = "https://raw.githubusercontent.com/egonSchiele/smoltalk/main/packages/smoltalk/data/model-data.json";
|
|
14
|
+
const MAX_BYTES = 10_000_000;
|
|
15
|
+
const TIMEOUT_MS = 15_000;
|
|
16
|
+
function enforceSizeCap(text) {
|
|
17
|
+
if (Buffer.byteLength(text, "utf8") > MAX_BYTES) {
|
|
18
|
+
throw new Error(`Model data exceeds the ${MAX_BYTES}-byte cap`);
|
|
19
|
+
}
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
// The default fetcher supports remote https:// URLs and local file:// URLs.
|
|
23
|
+
// file:// lets users point at a self-hosted on-disk catalog (and powers the
|
|
24
|
+
// integration test). Any other scheme is rejected.
|
|
25
|
+
async function defaultFetcher(url, signal) {
|
|
26
|
+
if (url.startsWith("file://")) {
|
|
27
|
+
const path = fileURLToPath(url);
|
|
28
|
+
const text = await readFile(path, "utf8");
|
|
29
|
+
return enforceSizeCap(text);
|
|
30
|
+
}
|
|
31
|
+
if (url.startsWith("https://")) {
|
|
32
|
+
const res = await fetch(url, { signal });
|
|
33
|
+
if (!res.ok) {
|
|
34
|
+
throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
|
35
|
+
}
|
|
36
|
+
return enforceSizeCap(await res.text());
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Unsupported model-data URL scheme (expected https:// or file://): ${url}`);
|
|
39
|
+
}
|
|
40
|
+
export async function refreshModels(opts = {}) {
|
|
41
|
+
let url = DEFAULT_MODEL_DATA_URL;
|
|
42
|
+
if (process.env.SMOLTALK_MODEL_DATA_URL) {
|
|
43
|
+
url = process.env.SMOLTALK_MODEL_DATA_URL;
|
|
44
|
+
}
|
|
45
|
+
if (opts.url) {
|
|
46
|
+
url = opts.url;
|
|
47
|
+
}
|
|
48
|
+
let fetcher = defaultFetcher;
|
|
49
|
+
if (opts.fetcher) {
|
|
50
|
+
fetcher = opts.fetcher;
|
|
51
|
+
}
|
|
52
|
+
// Always drive the fetcher off our own controller so the timeout can abort
|
|
53
|
+
// it. Forward an externally-supplied signal into the same controller so both
|
|
54
|
+
// the timeout and the caller can cancel.
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
57
|
+
if (opts.signal) {
|
|
58
|
+
if (opts.signal.aborted) {
|
|
59
|
+
controller.abort();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
opts.signal.addEventListener("abort", () => controller.abort(), {
|
|
63
|
+
once: true,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let raw;
|
|
68
|
+
try {
|
|
69
|
+
raw = await fetcher(url, controller.signal);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return failure(`Could not fetch model data from ${url}: ${String(err)}`);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
}
|
|
77
|
+
return parseModelDataBlob(raw);
|
|
78
|
+
}
|
package/dist/models.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type ModelDataBlob, type HostedTool, type HostedToolPrice } from "./modelData.js";
|
|
3
|
-
export declare const providers: readonly ["ollama", "openai", "openai-responses", "anthropic", "google", "replicate", "modal", "openrouter", "deepinfra", "litellm", "openai-compat", "groq"];
|
|
3
|
+
export declare const providers: readonly ["ollama", "openai", "openai-responses", "anthropic", "google", "replicate", "modal", "openrouter", "deepinfra", "litellm", "openai-compat", "groq", "mlx"];
|
|
4
4
|
export declare const ProviderSchema: z.ZodEnum<{
|
|
5
5
|
openai: "openai";
|
|
6
6
|
anthropic: "anthropic";
|
|
@@ -14,6 +14,7 @@ export declare const ProviderSchema: z.ZodEnum<{
|
|
|
14
14
|
litellm: "litellm";
|
|
15
15
|
"openai-compat": "openai-compat";
|
|
16
16
|
groq: "groq";
|
|
17
|
+
mlx: "mlx";
|
|
17
18
|
}>;
|
|
18
19
|
export type Provider = z.infer<typeof ProviderSchema>;
|
|
19
20
|
export type BaseModel = {
|
package/dist/models.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export type SmolConfig = {
|
|
|
44
44
|
deepInfra?: string;
|
|
45
45
|
liteLlm?: string;
|
|
46
46
|
openAiCompat?: string;
|
|
47
|
+
/** The MLX server started by `mlx_lm.server` (or `agency local serve`). Defaults to http://127.0.0.1:8080/v1 (or $MLX_BASE_URL). */
|
|
48
|
+
mlx?: string;
|
|
47
49
|
};
|
|
48
50
|
/** Log level for internal debug logging. */
|
|
49
51
|
logLevel?: LogLevel;
|
package/dist/util/provider.d.ts
CHANGED
package/dist/util/provider.js
CHANGED
|
@@ -64,6 +64,8 @@ export function resolveBaseUrl(provider, config) {
|
|
|
64
64
|
return b?.liteLlm || process.env.LITELLM_BASE_URL;
|
|
65
65
|
case "openai-compat":
|
|
66
66
|
return b?.openAiCompat || process.env.OPENAI_COMPAT_BASE_URL;
|
|
67
|
+
case "mlx":
|
|
68
|
+
return b?.mlx || process.env.MLX_BASE_URL || "http://127.0.0.1:8080/v1";
|
|
67
69
|
default:
|
|
68
70
|
return undefined;
|
|
69
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smoltalk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "A common interface for LLM APIs",
|
|
5
5
|
"homepage": "https://github.com/egonSchiele/smoltalk",
|
|
6
6
|
"files": [
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
+
"./models": {
|
|
16
|
+
"types": "./dist/models.d.ts",
|
|
17
|
+
"import": "./dist/models.js",
|
|
18
|
+
"require": "./dist/models.js"
|
|
19
|
+
},
|
|
15
20
|
"./testing": {
|
|
16
21
|
"types": "./dist/testing/index.d.ts",
|
|
17
22
|
"import": "./dist/testing/index.js",
|