llm-strings 1.4.0 → 1.5.1
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/LICENSE +21 -0
- package/README.md +341 -330
- package/dist/ai-sdk.cjs +1 -1176
- package/dist/ai-sdk.d.cts +1 -1
- package/dist/ai-sdk.d.ts +1 -1
- package/dist/ai-sdk.js +1 -543
- package/dist/chunk-CT44CYBU.js +1 -0
- package/dist/chunk-JURQSYOT.js +1 -0
- package/dist/chunk-LIYUWJME.js +1 -0
- package/dist/chunk-M5ENVTNI.js +1 -0
- package/dist/index.cjs +1 -1351
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -22
- package/dist/normalize.cjs +1 -527
- package/dist/normalize.d.cts +1 -1
- package/dist/normalize.d.ts +1 -1
- package/dist/normalize.js +1 -7
- package/dist/parse.cjs +1 -159
- package/dist/parse.d.cts +4 -4
- package/dist/parse.d.ts +4 -4
- package/dist/parse.js +1 -9
- package/dist/{provider-core-B934MuhJ.d.cts → provider-core-CjpJ4qyF.d.cts} +35 -15
- package/dist/{provider-core-B934MuhJ.d.ts → provider-core-CjpJ4qyF.d.ts} +35 -15
- package/dist/providers.cjs +1 -1267
- package/dist/providers.d.cts +2 -2
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +1 -218
- package/dist/validate.cjs +1 -1334
- package/dist/validate.d.cts +1 -1
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +1 -9
- package/package.json +17 -2
- package/dist/chunk-5YTG2NRX.js +0 -42
- package/dist/chunk-76EFNZCF.js +0 -1043
- package/dist/chunk-DPVT3FFP.js +0 -116
- package/dist/chunk-OBLFZFNR.js +0 -175
package/dist/validate.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ interface ValidationIssue {
|
|
|
5
5
|
severity: "error" | "warning";
|
|
6
6
|
}
|
|
7
7
|
interface ValidateOptions {
|
|
8
|
-
/**
|
|
8
|
+
/** Report unknown providers/params as errors instead of allowing model-specific params through. */
|
|
9
9
|
strict?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
package/dist/validate.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface ValidationIssue {
|
|
|
5
5
|
severity: "error" | "warning";
|
|
6
6
|
}
|
|
7
7
|
interface ValidateOptions {
|
|
8
|
-
/**
|
|
8
|
+
/** Report unknown providers/params as errors instead of allowing model-specific params through. */
|
|
9
9
|
strict?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
package/dist/validate.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
validate
|
|
3
|
-
} from "./chunk-OBLFZFNR.js";
|
|
4
|
-
import "./chunk-DPVT3FFP.js";
|
|
5
|
-
import "./chunk-5YTG2NRX.js";
|
|
6
|
-
import "./chunk-76EFNZCF.js";
|
|
7
|
-
export {
|
|
8
|
-
validate
|
|
9
|
-
};
|
|
1
|
+
import{validate as o}from"./chunk-CT44CYBU.js";import"./chunk-JURQSYOT.js";import"./chunk-M5ENVTNI.js";import"./chunk-LIYUWJME.js";export{o as validate};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-strings",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"packageManager": "pnpm@11.1.1",
|
|
5
5
|
"description": "Parse and build LLM connection strings — like database URLs, but for LLM APIs",
|
|
6
6
|
"type": "module",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"build": "tsup",
|
|
78
78
|
"test": "vitest run",
|
|
79
79
|
"test:watch": "vitest",
|
|
80
|
+
"test:coverage": "vitest run --coverage",
|
|
80
81
|
"lint": "eslint .",
|
|
81
82
|
"format": "prettier --write .",
|
|
82
83
|
"format:check": "prettier --check .",
|
|
@@ -89,11 +90,24 @@
|
|
|
89
90
|
"keywords": [
|
|
90
91
|
"llm",
|
|
91
92
|
"connection-string",
|
|
93
|
+
"url",
|
|
92
94
|
"openai",
|
|
93
95
|
"anthropic",
|
|
96
|
+
"google",
|
|
97
|
+
"bedrock",
|
|
98
|
+
"mistral",
|
|
99
|
+
"cohere",
|
|
100
|
+
"groq",
|
|
94
101
|
"ai",
|
|
95
|
-
"parser"
|
|
102
|
+
"parser",
|
|
103
|
+
"validation",
|
|
104
|
+
"normalize",
|
|
105
|
+
"typescript"
|
|
96
106
|
],
|
|
107
|
+
"homepage": "https://github.com/justsml/llm-strings#readme",
|
|
108
|
+
"bugs": {
|
|
109
|
+
"url": "https://github.com/justsml/llm-strings/issues"
|
|
110
|
+
},
|
|
97
111
|
"repository": {
|
|
98
112
|
"type": "git",
|
|
99
113
|
"url": "git+https://github.com/justsml/llm-strings.git"
|
|
@@ -103,6 +117,7 @@
|
|
|
103
117
|
"@vitest/coverage-v8": "^4.0.18",
|
|
104
118
|
"eslint": "^10.0.0",
|
|
105
119
|
"prettier": "^3.0.0",
|
|
120
|
+
"terser": "^5.48.0",
|
|
106
121
|
"tsup": "^8.0.0",
|
|
107
122
|
"typescript": "^5.5.0",
|
|
108
123
|
"typescript-eslint": "^8.0.0",
|
package/dist/chunk-5YTG2NRX.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveHostAlias
|
|
3
|
-
} from "./chunk-76EFNZCF.js";
|
|
4
|
-
|
|
5
|
-
// src/parse.ts
|
|
6
|
-
function parse(connectionString) {
|
|
7
|
-
const url = new URL(connectionString);
|
|
8
|
-
if (url.protocol !== "llm:") {
|
|
9
|
-
throw new Error(
|
|
10
|
-
`Invalid scheme: expected "llm://", got "${url.protocol}//"`
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
const { host, alias: hostAlias } = resolveHostAlias(url.host);
|
|
14
|
-
const model = url.pathname.replace(/^\//, "");
|
|
15
|
-
const label = url.username || void 0;
|
|
16
|
-
const apiKey = url.password || void 0;
|
|
17
|
-
const params = {};
|
|
18
|
-
for (const [key, value] of url.searchParams) {
|
|
19
|
-
params[key] = value;
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
raw: connectionString,
|
|
23
|
-
host,
|
|
24
|
-
hostAlias,
|
|
25
|
-
model,
|
|
26
|
-
label,
|
|
27
|
-
apiKey,
|
|
28
|
-
params
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function build(config) {
|
|
32
|
-
const { host } = resolveHostAlias(config.host);
|
|
33
|
-
const auth = config.label || config.apiKey ? `${config.label ?? ""}${config.apiKey ? `:${config.apiKey}` : ""}@` : "";
|
|
34
|
-
const query = new URLSearchParams(config.params).toString();
|
|
35
|
-
const qs = query ? `?${query}` : "";
|
|
36
|
-
return `llm://${auth}${host}/${config.model}${qs}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
parse,
|
|
41
|
-
build
|
|
42
|
-
};
|