You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -69,7 +66,8 @@ export class ExecuTorchEmbeddings implements Embeddings {
69
66
console.warn(
70
67
'This function will call a synchronous unload on the instance of TextEmbeddingsModule from React Native ExecuTorch. Awaiting this method will not guarantee completion. This may change in future versions to support async unload.'
71
68
);
72
-
this.module.delete();
69
+
this.module?.delete();
70
+
this.module=null;
73
71
this.isLoaded=false;
74
72
}
75
73
@@ -79,6 +77,9 @@ export class ExecuTorchEmbeddings implements Embeddings {
79
77
* @returns Promise that resolves to the embedding vector.
80
78
*/
81
79
asyncembed(text: string): Promise<number[]>{
80
+
if(!this.module){
81
+
thrownewError('TextEmbeddingsModule not loaded. Call load() first.');
@@ -96,7 +90,7 @@ export class ExecuTorchLLM implements LLM {
96
90
console.warn(
97
91
'This function will call a synchronous interrupt on the instance of LLMModule from React Native ExecuTorch. Awaiting this method will not guarantee completion. This may change in future versions to support async interrupt.'
98
92
);
99
-
this.module.interrupt();
93
+
this.module?.interrupt();
100
94
}
101
95
102
96
/**
@@ -108,7 +102,8 @@ export class ExecuTorchLLM implements LLM {
108
102
console.warn(
109
103
'This function will call a synchronous unload on the instance of LLMModule from React Native ExecuTorch. Awaiting this method will not guarantee completion. This may change in future versions to support async unload.'
110
104
);
111
-
this.module.delete();
105
+
this.module?.delete();
106
+
this.module=null;
112
107
this.isLoaded=false;
113
108
}
114
109
@@ -119,6 +114,9 @@ export class ExecuTorchLLM implements LLM {
119
114
* @returns Promise that resolves to the full generated string.
0 commit comments