weave-typescript 0.20.0 → 0.22.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/dist/weaveapi/chat/v1/chat.pb.d.ts +199 -0
- package/dist/weaveapi/chat/v1/chat.pb.js +2342 -0
- package/dist/weaveapi/chat/v1/service.pb.d.ts +344 -0
- package/dist/weaveapi/chat/v1/service.pb.js +2545 -0
- package/dist/weaveapi/model/v1/model.pb.d.ts +105 -0
- package/dist/weaveapi/model/v1/model.pb.js +1001 -0
- package/dist/weaveapi/model/v1/service.pb.d.ts +246 -0
- package/dist/weaveapi/model/v1/service.pb.js +1910 -0
- package/dist/weavesql/weavedb/chat_sql.d.ts +464 -0
- package/dist/weavesql/weavedb/chat_sql.js +735 -0
- package/dist/weavesql/weavedb/model_catalog_sql.d.ts +91 -0
- package/dist/weavesql/weavedb/model_catalog_sql.js +213 -0
- package/package.json +2 -2
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const upsertModelCatalogModelQuery = "-- name: UpsertModelCatalogModel :one\nINSERT INTO weave.llm_model_catalog_models (\n provider_kind,\n model_id,\n display_name,\n primary_type,\n capabilities,\n pricing,\n params,\n max_input_tokens,\n max_output_tokens,\n release_order,\n catalog_revision,\n synced_at\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12\n)\nON CONFLICT (provider_kind, model_id) DO UPDATE\nSET\n display_name = EXCLUDED.display_name,\n primary_type = EXCLUDED.primary_type,\n capabilities = EXCLUDED.capabilities,\n pricing = EXCLUDED.pricing,\n params = EXCLUDED.params,\n max_input_tokens = EXCLUDED.max_input_tokens,\n max_output_tokens = EXCLUDED.max_output_tokens,\n release_order = EXCLUDED.release_order,\n catalog_revision = EXCLUDED.catalog_revision,\n synced_at = EXCLUDED.synced_at,\n updated_at = now()\nRETURNING\n provider_kind,\n model_id,\n display_name,\n primary_type,\n capabilities,\n pricing,\n params,\n max_input_tokens,\n max_output_tokens,\n release_order,\n catalog_revision,\n synced_at,\n updated_at";
|
|
6
|
+
export interface UpsertModelCatalogModelArgs {
|
|
7
|
+
providerKind: string;
|
|
8
|
+
modelId: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
primaryType: string;
|
|
11
|
+
capabilities: any;
|
|
12
|
+
pricing: any;
|
|
13
|
+
params: any;
|
|
14
|
+
maxInputTokens: string | null;
|
|
15
|
+
maxOutputTokens: string | null;
|
|
16
|
+
releaseOrder: number;
|
|
17
|
+
catalogRevision: string;
|
|
18
|
+
syncedAt: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface UpsertModelCatalogModelRow {
|
|
21
|
+
providerKind: string;
|
|
22
|
+
modelId: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
primaryType: string;
|
|
25
|
+
capabilities: any;
|
|
26
|
+
pricing: any;
|
|
27
|
+
params: any;
|
|
28
|
+
maxInputTokens: string | null;
|
|
29
|
+
maxOutputTokens: string | null;
|
|
30
|
+
releaseOrder: number;
|
|
31
|
+
catalogRevision: string;
|
|
32
|
+
syncedAt: Date;
|
|
33
|
+
updatedAt: Date;
|
|
34
|
+
}
|
|
35
|
+
export declare function upsertModelCatalogModel(client: Client, args: UpsertModelCatalogModelArgs): Promise<UpsertModelCatalogModelRow | null>;
|
|
36
|
+
export declare const deleteModelCatalogModelsByProviderQuery = "-- name: DeleteModelCatalogModelsByProvider :execrows\nDELETE FROM weave.llm_model_catalog_models\nWHERE provider_kind = $1";
|
|
37
|
+
export interface DeleteModelCatalogModelsByProviderArgs {
|
|
38
|
+
providerKind: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const listModelCatalogProvidersQuery = "-- name: ListModelCatalogProviders :many\nSELECT DISTINCT provider_kind\nFROM weave.llm_model_catalog_models\nORDER BY provider_kind ASC";
|
|
41
|
+
export interface ListModelCatalogProvidersRow {
|
|
42
|
+
providerKind: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function listModelCatalogProviders(client: Client): Promise<ListModelCatalogProvidersRow[]>;
|
|
45
|
+
export declare const listModelCatalogModelsByProviderQuery = "-- name: ListModelCatalogModelsByProvider :many\nSELECT\n provider_kind,\n model_id,\n display_name,\n primary_type,\n capabilities,\n pricing,\n params,\n max_input_tokens,\n max_output_tokens,\n release_order,\n catalog_revision,\n synced_at,\n updated_at\nFROM weave.llm_model_catalog_models\nWHERE provider_kind = $1\nORDER BY release_order ASC, model_id ASC";
|
|
46
|
+
export interface ListModelCatalogModelsByProviderArgs {
|
|
47
|
+
providerKind: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ListModelCatalogModelsByProviderRow {
|
|
50
|
+
providerKind: string;
|
|
51
|
+
modelId: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
primaryType: string;
|
|
54
|
+
capabilities: any;
|
|
55
|
+
pricing: any;
|
|
56
|
+
params: any;
|
|
57
|
+
maxInputTokens: string | null;
|
|
58
|
+
maxOutputTokens: string | null;
|
|
59
|
+
releaseOrder: number;
|
|
60
|
+
catalogRevision: string;
|
|
61
|
+
syncedAt: Date;
|
|
62
|
+
updatedAt: Date;
|
|
63
|
+
}
|
|
64
|
+
export declare function listModelCatalogModelsByProvider(client: Client, args: ListModelCatalogModelsByProviderArgs): Promise<ListModelCatalogModelsByProviderRow[]>;
|
|
65
|
+
export declare const getModelCatalogModelByProviderAndIDQuery = "-- name: GetModelCatalogModelByProviderAndID :one\nSELECT\n provider_kind,\n model_id,\n display_name,\n primary_type,\n capabilities,\n pricing,\n params,\n max_input_tokens,\n max_output_tokens,\n release_order,\n catalog_revision,\n synced_at,\n updated_at\nFROM weave.llm_model_catalog_models\nWHERE provider_kind = $1\n AND model_id = $2";
|
|
66
|
+
export interface GetModelCatalogModelByProviderAndIDArgs {
|
|
67
|
+
providerKind: string;
|
|
68
|
+
modelId: string;
|
|
69
|
+
}
|
|
70
|
+
export interface GetModelCatalogModelByProviderAndIDRow {
|
|
71
|
+
providerKind: string;
|
|
72
|
+
modelId: string;
|
|
73
|
+
displayName: string;
|
|
74
|
+
primaryType: string;
|
|
75
|
+
capabilities: any;
|
|
76
|
+
pricing: any;
|
|
77
|
+
params: any;
|
|
78
|
+
maxInputTokens: string | null;
|
|
79
|
+
maxOutputTokens: string | null;
|
|
80
|
+
releaseOrder: number;
|
|
81
|
+
catalogRevision: string;
|
|
82
|
+
syncedAt: Date;
|
|
83
|
+
updatedAt: Date;
|
|
84
|
+
}
|
|
85
|
+
export declare function getModelCatalogModelByProviderAndID(client: Client, args: GetModelCatalogModelByProviderAndIDArgs): Promise<GetModelCatalogModelByProviderAndIDRow | null>;
|
|
86
|
+
export declare const getLatestModelCatalogRevisionQuery = "-- name: GetLatestModelCatalogRevision :one\nSELECT catalog_revision\nFROM weave.llm_model_catalog_models\nORDER BY synced_at DESC, updated_at DESC\nLIMIT 1";
|
|
87
|
+
export interface GetLatestModelCatalogRevisionRow {
|
|
88
|
+
catalogRevision: string;
|
|
89
|
+
}
|
|
90
|
+
export declare function getLatestModelCatalogRevision(client: Client): Promise<GetLatestModelCatalogRevisionRow | null>;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLatestModelCatalogRevisionQuery = exports.getModelCatalogModelByProviderAndIDQuery = exports.listModelCatalogModelsByProviderQuery = exports.listModelCatalogProvidersQuery = exports.deleteModelCatalogModelsByProviderQuery = exports.upsertModelCatalogModelQuery = void 0;
|
|
4
|
+
exports.upsertModelCatalogModel = upsertModelCatalogModel;
|
|
5
|
+
exports.listModelCatalogProviders = listModelCatalogProviders;
|
|
6
|
+
exports.listModelCatalogModelsByProvider = listModelCatalogModelsByProvider;
|
|
7
|
+
exports.getModelCatalogModelByProviderAndID = getModelCatalogModelByProviderAndID;
|
|
8
|
+
exports.getLatestModelCatalogRevision = getLatestModelCatalogRevision;
|
|
9
|
+
exports.upsertModelCatalogModelQuery = `-- name: UpsertModelCatalogModel :one
|
|
10
|
+
INSERT INTO weave.llm_model_catalog_models (
|
|
11
|
+
provider_kind,
|
|
12
|
+
model_id,
|
|
13
|
+
display_name,
|
|
14
|
+
primary_type,
|
|
15
|
+
capabilities,
|
|
16
|
+
pricing,
|
|
17
|
+
params,
|
|
18
|
+
max_input_tokens,
|
|
19
|
+
max_output_tokens,
|
|
20
|
+
release_order,
|
|
21
|
+
catalog_revision,
|
|
22
|
+
synced_at
|
|
23
|
+
) VALUES (
|
|
24
|
+
$1,
|
|
25
|
+
$2,
|
|
26
|
+
$3,
|
|
27
|
+
$4,
|
|
28
|
+
$5,
|
|
29
|
+
$6,
|
|
30
|
+
$7,
|
|
31
|
+
$8,
|
|
32
|
+
$9,
|
|
33
|
+
$10,
|
|
34
|
+
$11,
|
|
35
|
+
$12
|
|
36
|
+
)
|
|
37
|
+
ON CONFLICT (provider_kind, model_id) DO UPDATE
|
|
38
|
+
SET
|
|
39
|
+
display_name = EXCLUDED.display_name,
|
|
40
|
+
primary_type = EXCLUDED.primary_type,
|
|
41
|
+
capabilities = EXCLUDED.capabilities,
|
|
42
|
+
pricing = EXCLUDED.pricing,
|
|
43
|
+
params = EXCLUDED.params,
|
|
44
|
+
max_input_tokens = EXCLUDED.max_input_tokens,
|
|
45
|
+
max_output_tokens = EXCLUDED.max_output_tokens,
|
|
46
|
+
release_order = EXCLUDED.release_order,
|
|
47
|
+
catalog_revision = EXCLUDED.catalog_revision,
|
|
48
|
+
synced_at = EXCLUDED.synced_at,
|
|
49
|
+
updated_at = now()
|
|
50
|
+
RETURNING
|
|
51
|
+
provider_kind,
|
|
52
|
+
model_id,
|
|
53
|
+
display_name,
|
|
54
|
+
primary_type,
|
|
55
|
+
capabilities,
|
|
56
|
+
pricing,
|
|
57
|
+
params,
|
|
58
|
+
max_input_tokens,
|
|
59
|
+
max_output_tokens,
|
|
60
|
+
release_order,
|
|
61
|
+
catalog_revision,
|
|
62
|
+
synced_at,
|
|
63
|
+
updated_at`;
|
|
64
|
+
async function upsertModelCatalogModel(client, args) {
|
|
65
|
+
const result = await client.query({
|
|
66
|
+
text: exports.upsertModelCatalogModelQuery,
|
|
67
|
+
values: [args.providerKind, args.modelId, args.displayName, args.primaryType, args.capabilities, args.pricing, args.params, args.maxInputTokens, args.maxOutputTokens, args.releaseOrder, args.catalogRevision, args.syncedAt],
|
|
68
|
+
rowMode: "array"
|
|
69
|
+
});
|
|
70
|
+
if (result.rows.length !== 1) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const row = result.rows[0];
|
|
74
|
+
return {
|
|
75
|
+
providerKind: row[0],
|
|
76
|
+
modelId: row[1],
|
|
77
|
+
displayName: row[2],
|
|
78
|
+
primaryType: row[3],
|
|
79
|
+
capabilities: row[4],
|
|
80
|
+
pricing: row[5],
|
|
81
|
+
params: row[6],
|
|
82
|
+
maxInputTokens: row[7],
|
|
83
|
+
maxOutputTokens: row[8],
|
|
84
|
+
releaseOrder: row[9],
|
|
85
|
+
catalogRevision: row[10],
|
|
86
|
+
syncedAt: row[11],
|
|
87
|
+
updatedAt: row[12]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
exports.deleteModelCatalogModelsByProviderQuery = `-- name: DeleteModelCatalogModelsByProvider :execrows
|
|
91
|
+
DELETE FROM weave.llm_model_catalog_models
|
|
92
|
+
WHERE provider_kind = $1`;
|
|
93
|
+
exports.listModelCatalogProvidersQuery = `-- name: ListModelCatalogProviders :many
|
|
94
|
+
SELECT DISTINCT provider_kind
|
|
95
|
+
FROM weave.llm_model_catalog_models
|
|
96
|
+
ORDER BY provider_kind ASC`;
|
|
97
|
+
async function listModelCatalogProviders(client) {
|
|
98
|
+
const result = await client.query({
|
|
99
|
+
text: exports.listModelCatalogProvidersQuery,
|
|
100
|
+
values: [],
|
|
101
|
+
rowMode: "array"
|
|
102
|
+
});
|
|
103
|
+
return result.rows.map(row => {
|
|
104
|
+
return {
|
|
105
|
+
providerKind: row[0]
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.listModelCatalogModelsByProviderQuery = `-- name: ListModelCatalogModelsByProvider :many
|
|
110
|
+
SELECT
|
|
111
|
+
provider_kind,
|
|
112
|
+
model_id,
|
|
113
|
+
display_name,
|
|
114
|
+
primary_type,
|
|
115
|
+
capabilities,
|
|
116
|
+
pricing,
|
|
117
|
+
params,
|
|
118
|
+
max_input_tokens,
|
|
119
|
+
max_output_tokens,
|
|
120
|
+
release_order,
|
|
121
|
+
catalog_revision,
|
|
122
|
+
synced_at,
|
|
123
|
+
updated_at
|
|
124
|
+
FROM weave.llm_model_catalog_models
|
|
125
|
+
WHERE provider_kind = $1
|
|
126
|
+
ORDER BY release_order ASC, model_id ASC`;
|
|
127
|
+
async function listModelCatalogModelsByProvider(client, args) {
|
|
128
|
+
const result = await client.query({
|
|
129
|
+
text: exports.listModelCatalogModelsByProviderQuery,
|
|
130
|
+
values: [args.providerKind],
|
|
131
|
+
rowMode: "array"
|
|
132
|
+
});
|
|
133
|
+
return result.rows.map(row => {
|
|
134
|
+
return {
|
|
135
|
+
providerKind: row[0],
|
|
136
|
+
modelId: row[1],
|
|
137
|
+
displayName: row[2],
|
|
138
|
+
primaryType: row[3],
|
|
139
|
+
capabilities: row[4],
|
|
140
|
+
pricing: row[5],
|
|
141
|
+
params: row[6],
|
|
142
|
+
maxInputTokens: row[7],
|
|
143
|
+
maxOutputTokens: row[8],
|
|
144
|
+
releaseOrder: row[9],
|
|
145
|
+
catalogRevision: row[10],
|
|
146
|
+
syncedAt: row[11],
|
|
147
|
+
updatedAt: row[12]
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
exports.getModelCatalogModelByProviderAndIDQuery = `-- name: GetModelCatalogModelByProviderAndID :one
|
|
152
|
+
SELECT
|
|
153
|
+
provider_kind,
|
|
154
|
+
model_id,
|
|
155
|
+
display_name,
|
|
156
|
+
primary_type,
|
|
157
|
+
capabilities,
|
|
158
|
+
pricing,
|
|
159
|
+
params,
|
|
160
|
+
max_input_tokens,
|
|
161
|
+
max_output_tokens,
|
|
162
|
+
release_order,
|
|
163
|
+
catalog_revision,
|
|
164
|
+
synced_at,
|
|
165
|
+
updated_at
|
|
166
|
+
FROM weave.llm_model_catalog_models
|
|
167
|
+
WHERE provider_kind = $1
|
|
168
|
+
AND model_id = $2`;
|
|
169
|
+
async function getModelCatalogModelByProviderAndID(client, args) {
|
|
170
|
+
const result = await client.query({
|
|
171
|
+
text: exports.getModelCatalogModelByProviderAndIDQuery,
|
|
172
|
+
values: [args.providerKind, args.modelId],
|
|
173
|
+
rowMode: "array"
|
|
174
|
+
});
|
|
175
|
+
if (result.rows.length !== 1) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const row = result.rows[0];
|
|
179
|
+
return {
|
|
180
|
+
providerKind: row[0],
|
|
181
|
+
modelId: row[1],
|
|
182
|
+
displayName: row[2],
|
|
183
|
+
primaryType: row[3],
|
|
184
|
+
capabilities: row[4],
|
|
185
|
+
pricing: row[5],
|
|
186
|
+
params: row[6],
|
|
187
|
+
maxInputTokens: row[7],
|
|
188
|
+
maxOutputTokens: row[8],
|
|
189
|
+
releaseOrder: row[9],
|
|
190
|
+
catalogRevision: row[10],
|
|
191
|
+
syncedAt: row[11],
|
|
192
|
+
updatedAt: row[12]
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
exports.getLatestModelCatalogRevisionQuery = `-- name: GetLatestModelCatalogRevision :one
|
|
196
|
+
SELECT catalog_revision
|
|
197
|
+
FROM weave.llm_model_catalog_models
|
|
198
|
+
ORDER BY synced_at DESC, updated_at DESC
|
|
199
|
+
LIMIT 1`;
|
|
200
|
+
async function getLatestModelCatalogRevision(client) {
|
|
201
|
+
const result = await client.query({
|
|
202
|
+
text: exports.getLatestModelCatalogRevisionQuery,
|
|
203
|
+
values: [],
|
|
204
|
+
rowMode: "array"
|
|
205
|
+
});
|
|
206
|
+
if (result.rows.length !== 1) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
const row = result.rows[0];
|
|
210
|
+
return {
|
|
211
|
+
catalogRevision: row[0]
|
|
212
|
+
};
|
|
213
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weave-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^25.2.0",
|
|
33
33
|
"@types/pg": "^8.15.5",
|
|
34
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
34
|
+
"@typescript/native-preview": "7.0.0-dev.20260417.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "node tools/sqlcgen.test.js",
|