@leaflow/sdk 0.133.0 → 0.134.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/canopy/inference/v1/generated/functions.d.ts +14 -14
- package/dist/canopy/inference/v1/generated/functions.js +11 -7
- package/dist/canopy/inference/v1/generated/schemas.zod.d.ts +1 -1
- package/dist/canopy/inference/v1/generated/schemas.zod.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +2 -2
- package/package.json +1 -1
|
@@ -58,43 +58,43 @@ export declare const getCreateEmbeddingsUrl: () => string;
|
|
|
58
58
|
* @summary Create embeddings
|
|
59
59
|
*/
|
|
60
60
|
export declare const createEmbeddings: (embeddingRequest: EmbeddingRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createEmbeddingsResponse>;
|
|
61
|
-
export type
|
|
61
|
+
export type listInferenceModelsResponse200 = {
|
|
62
62
|
data: ModelList;
|
|
63
63
|
status: 200;
|
|
64
64
|
};
|
|
65
|
-
export type
|
|
65
|
+
export type listInferenceModelsResponseDefault = {
|
|
66
66
|
data: Error;
|
|
67
67
|
status: Exclude<HTTPStatusCodes, 200>;
|
|
68
68
|
};
|
|
69
|
-
export type
|
|
69
|
+
export type listInferenceModelsResponseSuccess = listInferenceModelsResponse200 & {
|
|
70
70
|
headers: Headers;
|
|
71
71
|
};
|
|
72
|
-
export type
|
|
72
|
+
export type listInferenceModelsResponseError = listInferenceModelsResponseDefault & {
|
|
73
73
|
headers: Headers;
|
|
74
74
|
};
|
|
75
|
-
export type
|
|
76
|
-
export declare const
|
|
75
|
+
export type listInferenceModelsResponse = listInferenceModelsResponseSuccess | listInferenceModelsResponseError;
|
|
76
|
+
export declare const getListInferenceModelsUrl: () => string;
|
|
77
77
|
/**
|
|
78
78
|
* @summary List callable models with capabilities and parameter limits
|
|
79
79
|
*/
|
|
80
|
-
export declare const
|
|
81
|
-
export type
|
|
80
|
+
export declare const listInferenceModels: (options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listInferenceModelsResponse>;
|
|
81
|
+
export type getInferenceModelResponse200 = {
|
|
82
82
|
data: Model;
|
|
83
83
|
status: 200;
|
|
84
84
|
};
|
|
85
|
-
export type
|
|
85
|
+
export type getInferenceModelResponseDefault = {
|
|
86
86
|
data: Error;
|
|
87
87
|
status: Exclude<HTTPStatusCodes, 200>;
|
|
88
88
|
};
|
|
89
|
-
export type
|
|
89
|
+
export type getInferenceModelResponseSuccess = getInferenceModelResponse200 & {
|
|
90
90
|
headers: Headers;
|
|
91
91
|
};
|
|
92
|
-
export type
|
|
92
|
+
export type getInferenceModelResponseError = getInferenceModelResponseDefault & {
|
|
93
93
|
headers: Headers;
|
|
94
94
|
};
|
|
95
|
-
export type
|
|
96
|
-
export declare const
|
|
95
|
+
export type getInferenceModelResponse = getInferenceModelResponseSuccess | getInferenceModelResponseError;
|
|
96
|
+
export declare const getGetInferenceModelUrl: (model: string) => string;
|
|
97
97
|
/**
|
|
98
98
|
* @summary Get a callable model with capabilities and parameter limits
|
|
99
99
|
*/
|
|
100
|
-
export declare const
|
|
100
|
+
export declare const getInferenceModel: (model: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getInferenceModelResponse>;
|
|
@@ -27,7 +27,11 @@ export const createChatCompletion = async (chatCompletionRequest, options, fetch
|
|
|
27
27
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
28
28
|
body: JSON.stringify(chatCompletionRequest),
|
|
29
29
|
});
|
|
30
|
-
const body = [204, 205, 304].includes(res.status)
|
|
30
|
+
const body = [204, 205, 304].includes(res.status)
|
|
31
|
+
? null
|
|
32
|
+
: res.headers.get("content-type")?.includes("application/json")
|
|
33
|
+
? JSON.parse(await res.text())
|
|
34
|
+
: await res.blob();
|
|
31
35
|
const data = body;
|
|
32
36
|
return { data, status: res.status, headers: res.headers };
|
|
33
37
|
};
|
|
@@ -64,14 +68,14 @@ export const createEmbeddings = async (embeddingRequest, options, fetchFn) => {
|
|
|
64
68
|
const data = body ? JSON.parse(body) : {};
|
|
65
69
|
return { data, status: res.status, headers: res.headers };
|
|
66
70
|
};
|
|
67
|
-
export const
|
|
71
|
+
export const getListInferenceModelsUrl = () => {
|
|
68
72
|
return `https://canopy.leaflow.cloud/v1/models`;
|
|
69
73
|
};
|
|
70
74
|
/**
|
|
71
75
|
* @summary List callable models with capabilities and parameter limits
|
|
72
76
|
*/
|
|
73
|
-
export const
|
|
74
|
-
const res = await (fetchFn ?? fetch)(
|
|
77
|
+
export const listInferenceModels = async (options, fetchFn) => {
|
|
78
|
+
const res = await (fetchFn ?? fetch)(getListInferenceModelsUrl(), {
|
|
75
79
|
...options,
|
|
76
80
|
method: "GET",
|
|
77
81
|
});
|
|
@@ -79,14 +83,14 @@ export const listModels = async (options, fetchFn) => {
|
|
|
79
83
|
const data = body ? JSON.parse(body) : {};
|
|
80
84
|
return { data, status: res.status, headers: res.headers };
|
|
81
85
|
};
|
|
82
|
-
export const
|
|
86
|
+
export const getGetInferenceModelUrl = (model) => {
|
|
83
87
|
return `https://canopy.leaflow.cloud/v1/models/${encodeURIComponent(String(model))}`;
|
|
84
88
|
};
|
|
85
89
|
/**
|
|
86
90
|
* @summary Get a callable model with capabilities and parameter limits
|
|
87
91
|
*/
|
|
88
|
-
export const
|
|
89
|
-
const res = await (fetchFn ?? fetch)(
|
|
92
|
+
export const getInferenceModel = async (model, options, fetchFn) => {
|
|
93
|
+
const res = await (fetchFn ?? fetch)(getGetInferenceModelUrl(model), {
|
|
90
94
|
...options,
|
|
91
95
|
method: "GET",
|
|
92
96
|
});
|
|
@@ -35,6 +35,6 @@ export declare const CreateEmbeddingsBody: zod.ZodObject<{
|
|
|
35
35
|
/**
|
|
36
36
|
* @summary Get a callable model with capabilities and parameter limits
|
|
37
37
|
*/
|
|
38
|
-
export declare const
|
|
38
|
+
export declare const GetInferenceModelParams: zod.ZodObject<{
|
|
39
39
|
model: zod.ZodString;
|
|
40
40
|
}, zod.z.core.$strict>;
|
|
@@ -21,6 +21,6 @@ export const CreateEmbeddingsBody = EmbeddingRequest;
|
|
|
21
21
|
/**
|
|
22
22
|
* @summary Get a callable model with capabilities and parameter limits
|
|
23
23
|
*/
|
|
24
|
-
export const
|
|
24
|
+
export const GetInferenceModelParams = zod.strictObject({
|
|
25
25
|
model: zod.string(),
|
|
26
26
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as account from "./account/v1/index.js";
|
|
2
2
|
export * as assistant from "./assistant/v1/index.js";
|
|
3
3
|
export * as billing from "./billing/v1/index.js";
|
|
4
|
-
export * as canopy from "./canopy/v1/index.js";
|
|
5
4
|
export * as canopyInference from "./canopy/inference/v1/index.js";
|
|
5
|
+
export * as canopy from "./canopy/v1/index.js";
|
|
6
6
|
export * as compute from "./compute/v1/index.js";
|
|
7
7
|
export * as dns from "./dns/v1/index.js";
|
|
8
8
|
export * as iam from "./iam/v1/index.js";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as account from "./account/v1/index.js";
|
|
2
2
|
export * as assistant from "./assistant/v1/index.js";
|
|
3
3
|
export * as billing from "./billing/v1/index.js";
|
|
4
|
-
export * as canopy from "./canopy/v1/index.js";
|
|
5
4
|
export * as canopyInference from "./canopy/inference/v1/index.js";
|
|
5
|
+
export * as canopy from "./canopy/v1/index.js";
|
|
6
6
|
export * as compute from "./compute/v1/index.js";
|
|
7
7
|
export * as dns from "./dns/v1/index.js";
|
|
8
8
|
export * as iam from "./iam/v1/index.js";
|
package/dist/routes.d.ts
CHANGED
|
@@ -1131,7 +1131,7 @@ export declare const routes: readonly [{
|
|
|
1131
1131
|
readonly contract: "canopy/inference";
|
|
1132
1132
|
readonly method: "GET";
|
|
1133
1133
|
readonly path: "/v1/models";
|
|
1134
|
-
readonly operationId: "list-models";
|
|
1134
|
+
readonly operationId: "list-inference-models";
|
|
1135
1135
|
readonly securityScheme: "ScopedToken";
|
|
1136
1136
|
readonly upstreamUrl: "https://canopy.leaflow.cloud";
|
|
1137
1137
|
}, {
|
|
@@ -1139,7 +1139,7 @@ export declare const routes: readonly [{
|
|
|
1139
1139
|
readonly contract: "canopy/inference";
|
|
1140
1140
|
readonly method: "GET";
|
|
1141
1141
|
readonly path: "/v1/models/{model}";
|
|
1142
|
-
readonly operationId: "get-model";
|
|
1142
|
+
readonly operationId: "get-inference-model";
|
|
1143
1143
|
readonly securityScheme: "ScopedToken";
|
|
1144
1144
|
readonly upstreamUrl: "https://canopy.leaflow.cloud";
|
|
1145
1145
|
}, {
|
package/dist/routes.js
CHANGED
|
@@ -1274,7 +1274,7 @@ export const routes = [
|
|
|
1274
1274
|
contract: "canopy/inference",
|
|
1275
1275
|
method: "GET",
|
|
1276
1276
|
path: "/v1/models",
|
|
1277
|
-
operationId: "list-models",
|
|
1277
|
+
operationId: "list-inference-models",
|
|
1278
1278
|
securityScheme: "ScopedToken",
|
|
1279
1279
|
upstreamUrl: "https://canopy.leaflow.cloud",
|
|
1280
1280
|
},
|
|
@@ -1283,7 +1283,7 @@ export const routes = [
|
|
|
1283
1283
|
contract: "canopy/inference",
|
|
1284
1284
|
method: "GET",
|
|
1285
1285
|
path: "/v1/models/{model}",
|
|
1286
|
-
operationId: "get-model",
|
|
1286
|
+
operationId: "get-inference-model",
|
|
1287
1287
|
securityScheme: "ScopedToken",
|
|
1288
1288
|
upstreamUrl: "https://canopy.leaflow.cloud",
|
|
1289
1289
|
},
|