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.
@@ -5,7 +5,7 @@ interface ValidationIssue {
5
5
  severity: "error" | "warning";
6
6
  }
7
7
  interface ValidateOptions {
8
- /** Promote warnings (unknown provider, unknown params) to errors. */
8
+ /** Report unknown providers/params as errors instead of allowing model-specific params through. */
9
9
  strict?: boolean;
10
10
  }
11
11
  /**
@@ -5,7 +5,7 @@ interface ValidationIssue {
5
5
  severity: "error" | "warning";
6
6
  }
7
7
  interface ValidateOptions {
8
- /** Promote warnings (unknown provider, unknown params) to errors. */
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.4.0",
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",
@@ -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
- };