@reverbia/sdk 1.0.0-next.20260111202106 → 1.0.0-next.20260112105133
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/expo/index.cjs +35 -130
- package/dist/expo/index.d.mts +1 -131
- package/dist/expo/index.d.ts +1 -131
- package/dist/expo/index.mjs +32 -126
- package/dist/index.cjs +12 -28
- package/dist/index.d.mts +54 -254
- package/dist/index.d.ts +54 -254
- package/dist/index.mjs +12 -26
- package/dist/react/index.cjs +81 -272
- package/dist/react/index.d.mts +1 -245
- package/dist/react/index.d.ts +1 -245
- package/dist/react/index.mjs +71 -260
- package/package.json +2 -2
package/dist/expo/index.cjs
CHANGED
|
@@ -42,7 +42,6 @@ __export(index_exports, {
|
|
|
42
42
|
sdkSchema: () => sdkSchema,
|
|
43
43
|
useChat: () => useChat,
|
|
44
44
|
useChatStorage: () => useChatStorage,
|
|
45
|
-
useImageGeneration: () => useImageGeneration,
|
|
46
45
|
useMemoryStorage: () => useMemoryStorage,
|
|
47
46
|
useModels: () => useModels
|
|
48
47
|
});
|
|
@@ -2123,7 +2122,7 @@ function useChatStorage(options) {
|
|
|
2123
2122
|
};
|
|
2124
2123
|
}
|
|
2125
2124
|
|
|
2126
|
-
// src/react/
|
|
2125
|
+
// src/react/useModels.ts
|
|
2127
2126
|
var import_react3 = require("react");
|
|
2128
2127
|
|
|
2129
2128
|
// src/client/core/bodySerializer.gen.ts
|
|
@@ -2935,16 +2934,6 @@ var createClient = (config = {}) => {
|
|
|
2935
2934
|
var client = createClient(createClientConfig(createConfig()));
|
|
2936
2935
|
|
|
2937
2936
|
// src/client/sdk.gen.ts
|
|
2938
|
-
var postApiV1ImagesGenerations = (options) => {
|
|
2939
|
-
return (options.client ?? client).post({
|
|
2940
|
-
url: "/api/v1/images/generations",
|
|
2941
|
-
...options,
|
|
2942
|
-
headers: {
|
|
2943
|
-
"Content-Type": "application/json",
|
|
2944
|
-
...options.headers
|
|
2945
|
-
}
|
|
2946
|
-
});
|
|
2947
|
-
};
|
|
2948
2937
|
var getApiV1Models = (options) => {
|
|
2949
2938
|
return (options?.client ?? client).get({
|
|
2950
2939
|
url: "/api/v1/models",
|
|
@@ -2952,104 +2941,22 @@ var getApiV1Models = (options) => {
|
|
|
2952
2941
|
});
|
|
2953
2942
|
};
|
|
2954
2943
|
|
|
2955
|
-
// src/react/useImageGeneration.ts
|
|
2956
|
-
function useImageGeneration(options = {}) {
|
|
2957
|
-
const { getToken, baseUrl = BASE_URL, onFinish, onError } = options;
|
|
2958
|
-
const [isLoading, setIsLoading] = (0, import_react3.useState)(false);
|
|
2959
|
-
const abortControllerRef = (0, import_react3.useRef)(null);
|
|
2960
|
-
(0, import_react3.useEffect)(() => {
|
|
2961
|
-
return () => {
|
|
2962
|
-
if (abortControllerRef.current) {
|
|
2963
|
-
abortControllerRef.current.abort();
|
|
2964
|
-
abortControllerRef.current = null;
|
|
2965
|
-
}
|
|
2966
|
-
};
|
|
2967
|
-
}, []);
|
|
2968
|
-
const stop = (0, import_react3.useCallback)(() => {
|
|
2969
|
-
if (abortControllerRef.current) {
|
|
2970
|
-
abortControllerRef.current.abort();
|
|
2971
|
-
abortControllerRef.current = null;
|
|
2972
|
-
}
|
|
2973
|
-
}, []);
|
|
2974
|
-
const generateImage = (0, import_react3.useCallback)(
|
|
2975
|
-
async (args) => {
|
|
2976
|
-
if (abortControllerRef.current) {
|
|
2977
|
-
abortControllerRef.current.abort();
|
|
2978
|
-
}
|
|
2979
|
-
const abortController = new AbortController();
|
|
2980
|
-
abortControllerRef.current = abortController;
|
|
2981
|
-
setIsLoading(true);
|
|
2982
|
-
try {
|
|
2983
|
-
if (!getToken) {
|
|
2984
|
-
throw new Error("Token getter function is required.");
|
|
2985
|
-
}
|
|
2986
|
-
const token = await getToken();
|
|
2987
|
-
if (!token) {
|
|
2988
|
-
throw new Error("No access token available.");
|
|
2989
|
-
}
|
|
2990
|
-
const response = await postApiV1ImagesGenerations({
|
|
2991
|
-
baseUrl,
|
|
2992
|
-
body: args,
|
|
2993
|
-
headers: {
|
|
2994
|
-
Authorization: `Bearer ${token}`
|
|
2995
|
-
},
|
|
2996
|
-
signal: abortController.signal
|
|
2997
|
-
});
|
|
2998
|
-
if (response.error) {
|
|
2999
|
-
const errorMsg = response.error.error || "Failed to generate image";
|
|
3000
|
-
throw new Error(errorMsg);
|
|
3001
|
-
}
|
|
3002
|
-
if (!response.data) {
|
|
3003
|
-
throw new Error("No data received from image generation API");
|
|
3004
|
-
}
|
|
3005
|
-
const result = response.data;
|
|
3006
|
-
if (onFinish) {
|
|
3007
|
-
onFinish(result);
|
|
3008
|
-
}
|
|
3009
|
-
return { data: result, error: null };
|
|
3010
|
-
} catch (err) {
|
|
3011
|
-
if (err instanceof Error && err.name === "AbortError") {
|
|
3012
|
-
return { data: null, error: "Request aborted" };
|
|
3013
|
-
}
|
|
3014
|
-
const errorMsg = err instanceof Error ? err.message : "Failed to generate image.";
|
|
3015
|
-
const errorObj = err instanceof Error ? err : new Error(errorMsg);
|
|
3016
|
-
if (onError) {
|
|
3017
|
-
onError(errorObj);
|
|
3018
|
-
}
|
|
3019
|
-
return { data: null, error: errorMsg };
|
|
3020
|
-
} finally {
|
|
3021
|
-
if (abortControllerRef.current === abortController) {
|
|
3022
|
-
setIsLoading(false);
|
|
3023
|
-
abortControllerRef.current = null;
|
|
3024
|
-
}
|
|
3025
|
-
}
|
|
3026
|
-
},
|
|
3027
|
-
[getToken, baseUrl, onFinish, onError]
|
|
3028
|
-
);
|
|
3029
|
-
return {
|
|
3030
|
-
isLoading,
|
|
3031
|
-
generateImage,
|
|
3032
|
-
stop
|
|
3033
|
-
};
|
|
3034
|
-
}
|
|
3035
|
-
|
|
3036
2944
|
// src/react/useModels.ts
|
|
3037
|
-
var import_react4 = require("react");
|
|
3038
2945
|
function useModels(options = {}) {
|
|
3039
2946
|
const { getToken, baseUrl = BASE_URL, provider, autoFetch = true } = options;
|
|
3040
|
-
const [models, setModels] = (0,
|
|
3041
|
-
const [isLoading, setIsLoading] = (0,
|
|
3042
|
-
const [error, setError] = (0,
|
|
3043
|
-
const getTokenRef = (0,
|
|
3044
|
-
const baseUrlRef = (0,
|
|
3045
|
-
const providerRef = (0,
|
|
3046
|
-
const abortControllerRef = (0,
|
|
3047
|
-
(0,
|
|
2947
|
+
const [models, setModels] = (0, import_react3.useState)([]);
|
|
2948
|
+
const [isLoading, setIsLoading] = (0, import_react3.useState)(false);
|
|
2949
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
2950
|
+
const getTokenRef = (0, import_react3.useRef)(getToken);
|
|
2951
|
+
const baseUrlRef = (0, import_react3.useRef)(baseUrl);
|
|
2952
|
+
const providerRef = (0, import_react3.useRef)(provider);
|
|
2953
|
+
const abortControllerRef = (0, import_react3.useRef)(null);
|
|
2954
|
+
(0, import_react3.useEffect)(() => {
|
|
3048
2955
|
getTokenRef.current = getToken;
|
|
3049
2956
|
baseUrlRef.current = baseUrl;
|
|
3050
2957
|
providerRef.current = provider;
|
|
3051
2958
|
});
|
|
3052
|
-
(0,
|
|
2959
|
+
(0, import_react3.useEffect)(() => {
|
|
3053
2960
|
return () => {
|
|
3054
2961
|
if (abortControllerRef.current) {
|
|
3055
2962
|
abortControllerRef.current.abort();
|
|
@@ -3057,7 +2964,7 @@ function useModels(options = {}) {
|
|
|
3057
2964
|
}
|
|
3058
2965
|
};
|
|
3059
2966
|
}, []);
|
|
3060
|
-
const fetchModels = (0,
|
|
2967
|
+
const fetchModels = (0, import_react3.useCallback)(async () => {
|
|
3061
2968
|
if (abortControllerRef.current) {
|
|
3062
2969
|
abortControllerRef.current.abort();
|
|
3063
2970
|
}
|
|
@@ -3115,12 +3022,12 @@ function useModels(options = {}) {
|
|
|
3115
3022
|
}
|
|
3116
3023
|
}
|
|
3117
3024
|
}, []);
|
|
3118
|
-
const refetch = (0,
|
|
3025
|
+
const refetch = (0, import_react3.useCallback)(async () => {
|
|
3119
3026
|
setModels([]);
|
|
3120
3027
|
await fetchModels();
|
|
3121
3028
|
}, [fetchModels]);
|
|
3122
|
-
const hasFetchedRef = (0,
|
|
3123
|
-
(0,
|
|
3029
|
+
const hasFetchedRef = (0, import_react3.useRef)(false);
|
|
3030
|
+
(0, import_react3.useEffect)(() => {
|
|
3124
3031
|
if (autoFetch && !hasFetchedRef.current) {
|
|
3125
3032
|
hasFetchedRef.current = true;
|
|
3126
3033
|
fetchModels();
|
|
@@ -3138,7 +3045,7 @@ function useModels(options = {}) {
|
|
|
3138
3045
|
}
|
|
3139
3046
|
|
|
3140
3047
|
// src/expo/useMemoryStorage.ts
|
|
3141
|
-
var
|
|
3048
|
+
var import_react4 = require("react");
|
|
3142
3049
|
var import_client4 = require("@reverbia/sdk");
|
|
3143
3050
|
|
|
3144
3051
|
// src/lib/db/memory/schema.ts
|
|
@@ -4018,13 +3925,13 @@ function useMemoryStorage(options) {
|
|
|
4018
3925
|
baseUrl = BASE_URL
|
|
4019
3926
|
} = options;
|
|
4020
3927
|
const embeddingModel = userEmbeddingModel === void 0 ? DEFAULT_API_EMBEDDING_MODEL : userEmbeddingModel;
|
|
4021
|
-
const [memories, setMemories] = (0,
|
|
4022
|
-
const extractionInProgressRef = (0,
|
|
4023
|
-
const memoriesCollection = (0,
|
|
3928
|
+
const [memories, setMemories] = (0, import_react4.useState)([]);
|
|
3929
|
+
const extractionInProgressRef = (0, import_react4.useRef)(false);
|
|
3930
|
+
const memoriesCollection = (0, import_react4.useMemo)(
|
|
4024
3931
|
() => database.get("memories"),
|
|
4025
3932
|
[database]
|
|
4026
3933
|
);
|
|
4027
|
-
const storageCtx = (0,
|
|
3934
|
+
const storageCtx = (0, import_react4.useMemo)(
|
|
4028
3935
|
() => ({
|
|
4029
3936
|
database,
|
|
4030
3937
|
memoriesCollection,
|
|
@@ -4040,7 +3947,7 @@ function useMemoryStorage(options) {
|
|
|
4040
3947
|
options.embeddedWalletSigner
|
|
4041
3948
|
]
|
|
4042
3949
|
);
|
|
4043
|
-
const embeddingOptions = (0,
|
|
3950
|
+
const embeddingOptions = (0, import_react4.useMemo)(
|
|
4044
3951
|
() => ({
|
|
4045
3952
|
model: embeddingModel ?? DEFAULT_API_EMBEDDING_MODEL,
|
|
4046
3953
|
getToken: getToken || void 0,
|
|
@@ -4048,11 +3955,11 @@ function useMemoryStorage(options) {
|
|
|
4048
3955
|
}),
|
|
4049
3956
|
[embeddingModel, getToken, baseUrl]
|
|
4050
3957
|
);
|
|
4051
|
-
const refreshMemories = (0,
|
|
3958
|
+
const refreshMemories = (0, import_react4.useCallback)(async () => {
|
|
4052
3959
|
const storedMemories = await getAllMemoriesOp(storageCtx);
|
|
4053
3960
|
setMemories(storedMemories);
|
|
4054
3961
|
}, [storageCtx]);
|
|
4055
|
-
const extractMemoriesFromMessage = (0,
|
|
3962
|
+
const extractMemoriesFromMessage = (0, import_react4.useCallback)(
|
|
4056
3963
|
async (opts) => {
|
|
4057
3964
|
const { messages, model } = opts;
|
|
4058
3965
|
if (!getToken || extractionInProgressRef.current) {
|
|
@@ -4078,8 +3985,7 @@ function useMemoryStorage(options) {
|
|
|
4078
3985
|
content: [{ type: "text", text: m.content }]
|
|
4079
3986
|
}))
|
|
4080
3987
|
],
|
|
4081
|
-
model: model || completionsModel
|
|
4082
|
-
tool_choice: "none"
|
|
3988
|
+
model: model || completionsModel
|
|
4083
3989
|
},
|
|
4084
3990
|
headers: {
|
|
4085
3991
|
Authorization: `Bearer ${token}`
|
|
@@ -4232,7 +4138,7 @@ function useMemoryStorage(options) {
|
|
|
4232
4138
|
refreshMemories
|
|
4233
4139
|
]
|
|
4234
4140
|
);
|
|
4235
|
-
const searchMemories = (0,
|
|
4141
|
+
const searchMemories = (0, import_react4.useCallback)(
|
|
4236
4142
|
async (query, limit = 10, minSimilarity = 0.6) => {
|
|
4237
4143
|
if (!embeddingModel) {
|
|
4238
4144
|
console.warn("Cannot search memories: embeddingModel not provided");
|
|
@@ -4265,7 +4171,7 @@ function useMemoryStorage(options) {
|
|
|
4265
4171
|
},
|
|
4266
4172
|
[embeddingModel, embeddingOptions, storageCtx]
|
|
4267
4173
|
);
|
|
4268
|
-
const fetchAllMemories = (0,
|
|
4174
|
+
const fetchAllMemories = (0, import_react4.useCallback)(async () => {
|
|
4269
4175
|
try {
|
|
4270
4176
|
return await getAllMemoriesOp(storageCtx);
|
|
4271
4177
|
} catch (error) {
|
|
@@ -4274,7 +4180,7 @@ function useMemoryStorage(options) {
|
|
|
4274
4180
|
);
|
|
4275
4181
|
}
|
|
4276
4182
|
}, [storageCtx]);
|
|
4277
|
-
const fetchMemoriesByNamespace = (0,
|
|
4183
|
+
const fetchMemoriesByNamespace = (0, import_react4.useCallback)(
|
|
4278
4184
|
async (namespace) => {
|
|
4279
4185
|
if (!namespace) {
|
|
4280
4186
|
throw new Error("Missing required field: namespace");
|
|
@@ -4289,7 +4195,7 @@ function useMemoryStorage(options) {
|
|
|
4289
4195
|
},
|
|
4290
4196
|
[storageCtx]
|
|
4291
4197
|
);
|
|
4292
|
-
const fetchMemoriesByKey = (0,
|
|
4198
|
+
const fetchMemoriesByKey = (0, import_react4.useCallback)(
|
|
4293
4199
|
async (namespace, key) => {
|
|
4294
4200
|
if (!namespace || !key) {
|
|
4295
4201
|
throw new Error("Missing required fields: namespace, key");
|
|
@@ -4304,7 +4210,7 @@ function useMemoryStorage(options) {
|
|
|
4304
4210
|
},
|
|
4305
4211
|
[storageCtx]
|
|
4306
4212
|
);
|
|
4307
|
-
const getMemoryById = (0,
|
|
4213
|
+
const getMemoryById = (0, import_react4.useCallback)(
|
|
4308
4214
|
async (id) => {
|
|
4309
4215
|
try {
|
|
4310
4216
|
return await getMemoryByIdOp(storageCtx, id);
|
|
@@ -4316,7 +4222,7 @@ function useMemoryStorage(options) {
|
|
|
4316
4222
|
},
|
|
4317
4223
|
[storageCtx]
|
|
4318
4224
|
);
|
|
4319
|
-
const saveMemory = (0,
|
|
4225
|
+
const saveMemory = (0, import_react4.useCallback)(
|
|
4320
4226
|
async (memory) => {
|
|
4321
4227
|
try {
|
|
4322
4228
|
const memoryToSave = { ...memory };
|
|
@@ -4358,7 +4264,7 @@ function useMemoryStorage(options) {
|
|
|
4358
4264
|
},
|
|
4359
4265
|
[storageCtx, generateEmbeddings, embeddingModel, embeddingOptions]
|
|
4360
4266
|
);
|
|
4361
|
-
const saveMemories = (0,
|
|
4267
|
+
const saveMemories = (0, import_react4.useCallback)(
|
|
4362
4268
|
async (memoriesToSave) => {
|
|
4363
4269
|
try {
|
|
4364
4270
|
const memoriesWithEmbeddings = await Promise.all(
|
|
@@ -4402,7 +4308,7 @@ function useMemoryStorage(options) {
|
|
|
4402
4308
|
},
|
|
4403
4309
|
[storageCtx, generateEmbeddings, embeddingModel, embeddingOptions, refreshMemories]
|
|
4404
4310
|
);
|
|
4405
|
-
const updateMemory = (0,
|
|
4311
|
+
const updateMemory = (0, import_react4.useCallback)(
|
|
4406
4312
|
async (id, updates) => {
|
|
4407
4313
|
const result = await updateMemoryOp(storageCtx, id, updates);
|
|
4408
4314
|
if (!result.ok) {
|
|
@@ -4445,7 +4351,7 @@ function useMemoryStorage(options) {
|
|
|
4445
4351
|
},
|
|
4446
4352
|
[storageCtx, generateEmbeddings, embeddingModel, embeddingOptions]
|
|
4447
4353
|
);
|
|
4448
|
-
const removeMemory = (0,
|
|
4354
|
+
const removeMemory = (0, import_react4.useCallback)(
|
|
4449
4355
|
async (namespace, key, value) => {
|
|
4450
4356
|
if (!namespace || !key || !value) {
|
|
4451
4357
|
throw new Error("Missing required fields: namespace, key, value");
|
|
@@ -4465,7 +4371,7 @@ function useMemoryStorage(options) {
|
|
|
4465
4371
|
},
|
|
4466
4372
|
[storageCtx]
|
|
4467
4373
|
);
|
|
4468
|
-
const removeMemoryById = (0,
|
|
4374
|
+
const removeMemoryById = (0, import_react4.useCallback)(
|
|
4469
4375
|
async (id) => {
|
|
4470
4376
|
try {
|
|
4471
4377
|
await deleteMemoryByIdOp(storageCtx, id);
|
|
@@ -4478,7 +4384,7 @@ function useMemoryStorage(options) {
|
|
|
4478
4384
|
},
|
|
4479
4385
|
[storageCtx]
|
|
4480
4386
|
);
|
|
4481
|
-
const removeMemories = (0,
|
|
4387
|
+
const removeMemories = (0, import_react4.useCallback)(
|
|
4482
4388
|
async (namespace, key) => {
|
|
4483
4389
|
if (!namespace || !key) {
|
|
4484
4390
|
throw new Error("Missing required fields: namespace, key");
|
|
@@ -4496,7 +4402,7 @@ function useMemoryStorage(options) {
|
|
|
4496
4402
|
},
|
|
4497
4403
|
[storageCtx]
|
|
4498
4404
|
);
|
|
4499
|
-
const clearMemories = (0,
|
|
4405
|
+
const clearMemories = (0, import_react4.useCallback)(async () => {
|
|
4500
4406
|
try {
|
|
4501
4407
|
await clearAllMemoriesOp(storageCtx);
|
|
4502
4408
|
setMemories([]);
|
|
@@ -4762,7 +4668,6 @@ var sdkModelClasses = [
|
|
|
4762
4668
|
sdkSchema,
|
|
4763
4669
|
useChat,
|
|
4764
4670
|
useChatStorage,
|
|
4765
|
-
useImageGeneration,
|
|
4766
4671
|
useMemoryStorage,
|
|
4767
4672
|
useModels
|
|
4768
4673
|
});
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -4,96 +4,6 @@ import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
|
|
|
4
4
|
import Model$1, { Associations } from '@nozbe/watermelondb/Model';
|
|
5
5
|
import { Class } from '@nozbe/watermelondb/types';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* ExtraFields contains additional metadata such as provider/model information.
|
|
9
|
-
*/
|
|
10
|
-
type LlmapiImageGenerationExtraFields = {
|
|
11
|
-
/**
|
|
12
|
-
* ModelRequested is the model identifier that the client asked for.
|
|
13
|
-
*/
|
|
14
|
-
model_requested?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Provider is the gateway that serviced this request.
|
|
17
|
-
*/
|
|
18
|
-
provider?: string;
|
|
19
|
-
/**
|
|
20
|
-
* RequestType is always "image_generation".
|
|
21
|
-
*/
|
|
22
|
-
request_type?: string;
|
|
23
|
-
};
|
|
24
|
-
type LlmapiImageGenerationImage = {
|
|
25
|
-
/**
|
|
26
|
-
* B64JSON is the base64 payload for models that can only return binary.
|
|
27
|
-
*/
|
|
28
|
-
b64_json?: string;
|
|
29
|
-
/**
|
|
30
|
-
* URL is the signed URL to download the image.
|
|
31
|
-
*/
|
|
32
|
-
url?: string;
|
|
33
|
-
};
|
|
34
|
-
type LlmapiImageGenerationRequest = {
|
|
35
|
-
/**
|
|
36
|
-
* Model is the model identifier to use for generation (e.g., "gpt-image-1").
|
|
37
|
-
*/
|
|
38
|
-
model: string;
|
|
39
|
-
/**
|
|
40
|
-
* Prompt is the text description of the desired image.
|
|
41
|
-
*/
|
|
42
|
-
prompt: string;
|
|
43
|
-
/**
|
|
44
|
-
* Quality targets a quality preset (e.g., "auto", "high").
|
|
45
|
-
*/
|
|
46
|
-
quality?: string;
|
|
47
|
-
/**
|
|
48
|
-
* ResponseFormat controls how the generated image is returned (e.g., "url" or "b64_json").
|
|
49
|
-
*/
|
|
50
|
-
response_format?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Size controls the dimensions of the generated image (e.g., "1024x1024").
|
|
53
|
-
*/
|
|
54
|
-
size?: string;
|
|
55
|
-
};
|
|
56
|
-
type LlmapiImageGenerationResponse = {
|
|
57
|
-
/**
|
|
58
|
-
* Created is the Unix timestamp when the image was generated.
|
|
59
|
-
*/
|
|
60
|
-
created?: number;
|
|
61
|
-
extra_fields?: LlmapiImageGenerationExtraFields;
|
|
62
|
-
/**
|
|
63
|
-
* Images contains the generated images.
|
|
64
|
-
*/
|
|
65
|
-
images?: Array<LlmapiImageGenerationImage>;
|
|
66
|
-
/**
|
|
67
|
-
* Model is the model identifier that generated the image.
|
|
68
|
-
*/
|
|
69
|
-
model?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Provider is the gateway that produced the image.
|
|
72
|
-
*/
|
|
73
|
-
provider?: string;
|
|
74
|
-
usage?: LlmapiImageGenerationUsage;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Usage documents token usage (when available).
|
|
78
|
-
*/
|
|
79
|
-
type LlmapiImageGenerationUsage = {
|
|
80
|
-
/**
|
|
81
|
-
* CostMicroUSD is the inference cost for this image generation request
|
|
82
|
-
*/
|
|
83
|
-
cost_micro_usd?: number;
|
|
84
|
-
/**
|
|
85
|
-
* InputTokens is the number of tokens sent in the prompt.
|
|
86
|
-
*/
|
|
87
|
-
input_tokens?: number;
|
|
88
|
-
/**
|
|
89
|
-
* OutputTokens is the number of tokens returned by the model.
|
|
90
|
-
*/
|
|
91
|
-
output_tokens?: number;
|
|
92
|
-
/**
|
|
93
|
-
* TotalTokens is the total number of tokens consumed.
|
|
94
|
-
*/
|
|
95
|
-
total_tokens?: number;
|
|
96
|
-
};
|
|
97
7
|
/**
|
|
98
8
|
* Message is the generated message
|
|
99
9
|
*/
|
|
@@ -1227,46 +1137,6 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
1227
1137
|
*/
|
|
1228
1138
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
1229
1139
|
|
|
1230
|
-
/**
|
|
1231
|
-
* @inline
|
|
1232
|
-
*/
|
|
1233
|
-
type UseImageGenerationOptions = {
|
|
1234
|
-
/**
|
|
1235
|
-
* Custom function to get auth token for API calls
|
|
1236
|
-
*/
|
|
1237
|
-
getToken?: () => Promise<string | null>;
|
|
1238
|
-
/**
|
|
1239
|
-
* Optional base URL for the API requests.
|
|
1240
|
-
*/
|
|
1241
|
-
baseUrl?: string;
|
|
1242
|
-
/**
|
|
1243
|
-
* Callback function to be called when the generation finishes successfully.
|
|
1244
|
-
*/
|
|
1245
|
-
onFinish?: (response: LlmapiImageGenerationResponse) => void;
|
|
1246
|
-
/**
|
|
1247
|
-
* Callback function to be called when an unexpected error is encountered.
|
|
1248
|
-
*/
|
|
1249
|
-
onError?: (error: Error) => void;
|
|
1250
|
-
};
|
|
1251
|
-
type GenerateImageArgs = LlmapiImageGenerationRequest;
|
|
1252
|
-
type GenerateImageResult = {
|
|
1253
|
-
data: LlmapiImageGenerationResponse;
|
|
1254
|
-
error: null;
|
|
1255
|
-
} | {
|
|
1256
|
-
data: null;
|
|
1257
|
-
error: string;
|
|
1258
|
-
};
|
|
1259
|
-
type UseImageGenerationResult = {
|
|
1260
|
-
isLoading: boolean;
|
|
1261
|
-
generateImage: (args: GenerateImageArgs) => Promise<GenerateImageResult>;
|
|
1262
|
-
stop: () => void;
|
|
1263
|
-
};
|
|
1264
|
-
/**
|
|
1265
|
-
* React hook for generating images using the LLM API.
|
|
1266
|
-
* @category Hooks
|
|
1267
|
-
*/
|
|
1268
|
-
declare function useImageGeneration(options?: UseImageGenerationOptions): UseImageGenerationResult;
|
|
1269
|
-
|
|
1270
1140
|
/**
|
|
1271
1141
|
* @inline
|
|
1272
1142
|
*/
|
|
@@ -1460,4 +1330,4 @@ declare const sdkMigrations: Readonly<{
|
|
|
1460
1330
|
*/
|
|
1461
1331
|
declare const sdkModelClasses: Class<Model$1>[];
|
|
1462
1332
|
|
|
1463
|
-
export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type
|
|
1333
|
+
export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseModelsOptions, type UseModelsResult, chatStorageMigrations, chatStorageSchema, generateCompositeKey, generateConversationId, generateUniqueKey, memoryStorageSchema, sdkMigrations, sdkModelClasses, sdkSchema, useChat, useChatStorage, useMemoryStorage, useModels };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4,96 +4,6 @@ import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
|
|
|
4
4
|
import Model$1, { Associations } from '@nozbe/watermelondb/Model';
|
|
5
5
|
import { Class } from '@nozbe/watermelondb/types';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* ExtraFields contains additional metadata such as provider/model information.
|
|
9
|
-
*/
|
|
10
|
-
type LlmapiImageGenerationExtraFields = {
|
|
11
|
-
/**
|
|
12
|
-
* ModelRequested is the model identifier that the client asked for.
|
|
13
|
-
*/
|
|
14
|
-
model_requested?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Provider is the gateway that serviced this request.
|
|
17
|
-
*/
|
|
18
|
-
provider?: string;
|
|
19
|
-
/**
|
|
20
|
-
* RequestType is always "image_generation".
|
|
21
|
-
*/
|
|
22
|
-
request_type?: string;
|
|
23
|
-
};
|
|
24
|
-
type LlmapiImageGenerationImage = {
|
|
25
|
-
/**
|
|
26
|
-
* B64JSON is the base64 payload for models that can only return binary.
|
|
27
|
-
*/
|
|
28
|
-
b64_json?: string;
|
|
29
|
-
/**
|
|
30
|
-
* URL is the signed URL to download the image.
|
|
31
|
-
*/
|
|
32
|
-
url?: string;
|
|
33
|
-
};
|
|
34
|
-
type LlmapiImageGenerationRequest = {
|
|
35
|
-
/**
|
|
36
|
-
* Model is the model identifier to use for generation (e.g., "gpt-image-1").
|
|
37
|
-
*/
|
|
38
|
-
model: string;
|
|
39
|
-
/**
|
|
40
|
-
* Prompt is the text description of the desired image.
|
|
41
|
-
*/
|
|
42
|
-
prompt: string;
|
|
43
|
-
/**
|
|
44
|
-
* Quality targets a quality preset (e.g., "auto", "high").
|
|
45
|
-
*/
|
|
46
|
-
quality?: string;
|
|
47
|
-
/**
|
|
48
|
-
* ResponseFormat controls how the generated image is returned (e.g., "url" or "b64_json").
|
|
49
|
-
*/
|
|
50
|
-
response_format?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Size controls the dimensions of the generated image (e.g., "1024x1024").
|
|
53
|
-
*/
|
|
54
|
-
size?: string;
|
|
55
|
-
};
|
|
56
|
-
type LlmapiImageGenerationResponse = {
|
|
57
|
-
/**
|
|
58
|
-
* Created is the Unix timestamp when the image was generated.
|
|
59
|
-
*/
|
|
60
|
-
created?: number;
|
|
61
|
-
extra_fields?: LlmapiImageGenerationExtraFields;
|
|
62
|
-
/**
|
|
63
|
-
* Images contains the generated images.
|
|
64
|
-
*/
|
|
65
|
-
images?: Array<LlmapiImageGenerationImage>;
|
|
66
|
-
/**
|
|
67
|
-
* Model is the model identifier that generated the image.
|
|
68
|
-
*/
|
|
69
|
-
model?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Provider is the gateway that produced the image.
|
|
72
|
-
*/
|
|
73
|
-
provider?: string;
|
|
74
|
-
usage?: LlmapiImageGenerationUsage;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Usage documents token usage (when available).
|
|
78
|
-
*/
|
|
79
|
-
type LlmapiImageGenerationUsage = {
|
|
80
|
-
/**
|
|
81
|
-
* CostMicroUSD is the inference cost for this image generation request
|
|
82
|
-
*/
|
|
83
|
-
cost_micro_usd?: number;
|
|
84
|
-
/**
|
|
85
|
-
* InputTokens is the number of tokens sent in the prompt.
|
|
86
|
-
*/
|
|
87
|
-
input_tokens?: number;
|
|
88
|
-
/**
|
|
89
|
-
* OutputTokens is the number of tokens returned by the model.
|
|
90
|
-
*/
|
|
91
|
-
output_tokens?: number;
|
|
92
|
-
/**
|
|
93
|
-
* TotalTokens is the total number of tokens consumed.
|
|
94
|
-
*/
|
|
95
|
-
total_tokens?: number;
|
|
96
|
-
};
|
|
97
7
|
/**
|
|
98
8
|
* Message is the generated message
|
|
99
9
|
*/
|
|
@@ -1227,46 +1137,6 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
1227
1137
|
*/
|
|
1228
1138
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
1229
1139
|
|
|
1230
|
-
/**
|
|
1231
|
-
* @inline
|
|
1232
|
-
*/
|
|
1233
|
-
type UseImageGenerationOptions = {
|
|
1234
|
-
/**
|
|
1235
|
-
* Custom function to get auth token for API calls
|
|
1236
|
-
*/
|
|
1237
|
-
getToken?: () => Promise<string | null>;
|
|
1238
|
-
/**
|
|
1239
|
-
* Optional base URL for the API requests.
|
|
1240
|
-
*/
|
|
1241
|
-
baseUrl?: string;
|
|
1242
|
-
/**
|
|
1243
|
-
* Callback function to be called when the generation finishes successfully.
|
|
1244
|
-
*/
|
|
1245
|
-
onFinish?: (response: LlmapiImageGenerationResponse) => void;
|
|
1246
|
-
/**
|
|
1247
|
-
* Callback function to be called when an unexpected error is encountered.
|
|
1248
|
-
*/
|
|
1249
|
-
onError?: (error: Error) => void;
|
|
1250
|
-
};
|
|
1251
|
-
type GenerateImageArgs = LlmapiImageGenerationRequest;
|
|
1252
|
-
type GenerateImageResult = {
|
|
1253
|
-
data: LlmapiImageGenerationResponse;
|
|
1254
|
-
error: null;
|
|
1255
|
-
} | {
|
|
1256
|
-
data: null;
|
|
1257
|
-
error: string;
|
|
1258
|
-
};
|
|
1259
|
-
type UseImageGenerationResult = {
|
|
1260
|
-
isLoading: boolean;
|
|
1261
|
-
generateImage: (args: GenerateImageArgs) => Promise<GenerateImageResult>;
|
|
1262
|
-
stop: () => void;
|
|
1263
|
-
};
|
|
1264
|
-
/**
|
|
1265
|
-
* React hook for generating images using the LLM API.
|
|
1266
|
-
* @category Hooks
|
|
1267
|
-
*/
|
|
1268
|
-
declare function useImageGeneration(options?: UseImageGenerationOptions): UseImageGenerationResult;
|
|
1269
|
-
|
|
1270
1140
|
/**
|
|
1271
1141
|
* @inline
|
|
1272
1142
|
*/
|
|
@@ -1460,4 +1330,4 @@ declare const sdkMigrations: Readonly<{
|
|
|
1460
1330
|
*/
|
|
1461
1331
|
declare const sdkModelClasses: Class<Model$1>[];
|
|
1462
1332
|
|
|
1463
|
-
export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type
|
|
1333
|
+
export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseModelsOptions, type UseModelsResult, chatStorageMigrations, chatStorageSchema, generateCompositeKey, generateConversationId, generateUniqueKey, memoryStorageSchema, sdkMigrations, sdkModelClasses, sdkSchema, useChat, useChatStorage, useMemoryStorage, useModels };
|