@@ -173,23 +173,23 @@ public native int generate(
173173 * @param height Input image height
174174 * @param channels Input image number of channels
175175 * @param startPos The starting position in KV cache of the input in the LLM.
176- * @return The updated starting position in KV cache of the input in the LLM.
176+ * @return 0, as the updated starting position in KV cache of the input in the LLM is no longer
177+ * exposed to user.
177178 * @throws RuntimeException if the prefill failed
178179 */
179180 @ Deprecated
180181 public long prefillImages (int [] image , int width , int height , int channels , long startPos ) {
181182 if (startPos == 0 ) {
182183 resetContext ();
183184 }
184- long [] nativeResult = prefillImagesNative (image , width , height , channels );
185- if (nativeResult [ 0 ] != 0 ) {
185+ int nativeResult = prefillImagesNative (image , width , height , channels );
186+ if (nativeResult != 0 ) {
186187 throw new RuntimeException ("Prefill failed with error code: " + nativeResult [0 ]);
187188 }
188- return nativeResult [ 1 ] ;
189+ return 0 ;
189190 }
190191
191- // returns a tuple of (status, updated startPos)
192- private native long [] prefillImagesNative (int [] image , int width , int height , int channels );
192+ private native int prefillImagesNative (int [] image , int width , int height , int channels );
193193
194194 /**
195195 * Prefill an LLaVA Module with the given text input.
@@ -199,23 +199,24 @@ public long prefillImages(int[] image, int width, int height, int channels, long
199199 * reference and will be updated inside this function.
200200 * @param bos The number of BOS (begin of sequence) token.
201201 * @param eos The number of EOS (end of sequence) token.
202- * @return The updated starting position in KV cache of the input in the LLM.
202+ * @return 0, as the updated starting position in KV cache of the input in the LLM is no longer
203+ * exposed to user.
203204 * @throws RuntimeException if the prefill failed
204205 */
205206 @ Deprecated
206207 public long prefillPrompt (String prompt , long startPos , int bos , int eos ) {
207208 if (startPos == 0 ) {
208209 resetContext ();
209210 }
210- long [] nativeResult = prefillPromptNative (prompt , bos , eos );
211- if (nativeResult [ 0 ] != 0 ) {
211+ int nativeResult = prefillPromptNative (prompt , bos , eos );
212+ if (nativeResult != 0 ) {
212213 throw new RuntimeException ("Prefill failed with error code: " + nativeResult [0 ]);
213214 }
214- return nativeResult [ 1 ] ;
215+ return 0 ;
215216 }
216217
217218 // returns a tuple of (status, updated startPos)
218- private native long [] prefillPromptNative (String prompt , int bos , int eos );
219+ private native int prefillPromptNative (String prompt , int bos , int eos );
219220
220221 /**
221222 * Generate tokens from the given prompt, starting from the given position.
@@ -238,7 +239,7 @@ public native int generateFromPos(
238239 *
239240 * <p>The startPos will be reset to 0.
240241 */
241- public native int resetContext ();
242+ public native void resetContext ();
242243
243244 /** Stop current generate() before it finishes. */
244245 @ DoNotStrip
0 commit comments