diff --git a/README.md b/README.md index 21769cd..11a0eb1 100644 --- a/README.md +++ b/README.md @@ -65,30 +65,19 @@ import React from 'react'; import { Text } from 'react-native'; import { useRAG, MemoryVectorStore } from 'react-native-rag'; -import { - ALL_MINILM_L6_V2, - ALL_MINILM_L6_V2_TOKENIZER, - LLAMA3_2_1B_QLORA, - LLAMA3_2_1B_TOKENIZER, - LLAMA3_2_TOKENIZER_CONFIG, -} from 'react-native-executorch'; +import { models } from 'react-native-executorch'; import { ExecuTorchEmbeddings, ExecuTorchLLM, } from '@react-native-rag/executorch'; const vectorStore = new MemoryVectorStore({ - embeddings: new ExecuTorchEmbeddings({ - modelSource: ALL_MINILM_L6_V2, - tokenizerSource: ALL_MINILM_L6_V2_TOKENIZER, - }), + embeddings: new ExecuTorchEmbeddings( + models.text_embedding.all_minilm_l6_v2() + ), }); -const llm = new ExecuTorchLLM({ - modelSource: LLAMA3_2_1B_QLORA, - tokenizerSource: LLAMA3_2_1B_TOKENIZER, - tokenizerConfigSource: LLAMA3_2_TOKENIZER_CONFIG, -}); +const llm = new ExecuTorchLLM(models.llm.lfm2_5_1_2b_instruct()); const App = () => { const rag = useRAG({ vectorStore, llm }); @@ -109,13 +98,7 @@ import { ExecuTorchEmbeddings, ExecuTorchLLM, } from '@react-native-rag/executorch'; -import { - ALL_MINILM_L6_V2, - ALL_MINILM_L6_V2_TOKENIZER, - LLAMA3_2_1B_QLORA, - LLAMA3_2_1B_TOKENIZER, - LLAMA3_2_TOKENIZER_CONFIG, -} from 'react-native-executorch'; +import { models } from 'react-native-executorch'; const App = () => { const [rag, setRag] = useState(null); @@ -123,15 +106,12 @@ const App = () => { useEffect(() => { const initializeRAG = async () => { - const embeddings = new ExecuTorchEmbeddings({ - modelSource: ALL_MINILM_L6_V2, - tokenizerSource: ALL_MINILM_L6_V2_TOKENIZER, - }); + const embeddings = new ExecuTorchEmbeddings( + models.text_embedding.all_minilm_l6_v2() + ); const llm = new ExecuTorchLLM({ - modelSource: LLAMA3_2_1B_QLORA, - tokenizerSource: LLAMA3_2_1B_TOKENIZER, - tokenizerConfigSource: LLAMA3_2_TOKENIZER_CONFIG, + ...models.llm.lfm2_5_1_2b_instruct(), responseCallback: setResponse, }); @@ -163,13 +143,7 @@ import { ExecuTorchEmbeddings, ExecuTorchLLM, } from '@react-native-rag/executorch'; -import { - ALL_MINILM_L6_V2, - ALL_MINILM_L6_V2_TOKENIZER, - LLAMA3_2_1B_QLORA, - LLAMA3_2_1B_TOKENIZER, - LLAMA3_2_TOKENIZER_CONFIG, -} from 'react-native-executorch'; +import { models } from 'react-native-executorch'; const App = () => { const [embeddings, setEmbeddings] = useState(null); @@ -182,16 +156,13 @@ const App = () => { // Instantiate and load the Embeddings Model // NOTE: Calling load on VectorStore will automatically load the embeddings model // so loading the embeddings model separately is not necessary in this case. - const embeddings = await new ExecuTorchEmbeddings({ - modelSource: ALL_MINILM_L6_V2, - tokenizerSource: ALL_MINILM_L6_V2_TOKENIZER, - }).load(); + const embeddings = await new ExecuTorchEmbeddings( + models.text_embedding.all_minilm_l6_v2() + ).load(); // Instantiate and load the Large Language Model const llm = await new ExecuTorchLLM({ - modelSource: LLAMA3_2_1B_QLORA, - tokenizerSource: LLAMA3_2_1B_TOKENIZER, - tokenizerConfigSource: LLAMA3_2_TOKENIZER_CONFIG, + ...models.llm.lfm2_5_1_2b_instruct(), responseCallback: setResponse, }).load(); diff --git a/example/package.json b/example/package.json index 92c9605..1b13c9e 100644 --- a/example/package.json +++ b/example/package.json @@ -20,8 +20,8 @@ "react": "19.2.0", "react-dom": "19.2.0", "react-native": "0.83.2", - "react-native-executorch": "^0.8.0", - "react-native-executorch-expo-resource-fetcher": "^0.8.0", + "react-native-executorch": "^0.9.0", + "react-native-executorch-expo-resource-fetcher": "^0.9.0", "react-native-rag": "workspace:*", "react-native-safe-area-context": "~5.6.2", "react-native-svg": "15.15.3", diff --git a/example/src/App.tsx b/example/src/App.tsx index 40a3e8f..420a363 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,10 +1,6 @@ import { type Message, useRAG } from 'react-native-rag'; import { OPSQLiteVectorStore } from '@react-native-rag/op-sqlite'; -import { - QWEN3_0_6B_QUANTIZED, - ALL_MINILM_L6_V2, - initExecutorch, -} from 'react-native-executorch'; +import { initExecutorch, models } from 'react-native-executorch'; import { ExpoResourceFetcher } from 'react-native-executorch-expo-resource-fetcher'; import { ExecuTorchEmbeddings, @@ -39,13 +35,15 @@ export default function App() { const vectorStore = useMemo(() => { return new OPSQLiteVectorStore({ name: 'rag_example_db1', - embeddings: new ExecuTorchEmbeddings(ALL_MINILM_L6_V2), + embeddings: new ExecuTorchEmbeddings( + models.text_embedding.all_minilm_l6_v2() + ), }); }, []); const llm = useMemo(() => { return new ExecuTorchLLM({ - ...QWEN3_0_6B_QUANTIZED, + ...models.llm.qwen3_0_6b(), onDownloadProgress: setDownloadProgress, }); }, []); diff --git a/package.json b/package.json index f2f147d..47f4bb3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-rag", - "version": "0.8.0", + "version": "0.9.0", "description": "Private, local RAGs. Supercharge LLMs with your own knowledge base.", "main": "./lib/module/index.js", "types": "./lib/typescript/src/index.d.ts", diff --git a/packages/executorch/README.md b/packages/executorch/README.md index 7096982..056c640 100644 --- a/packages/executorch/README.md +++ b/packages/executorch/README.md @@ -24,13 +24,12 @@ initExecutorch({ resourceFetcher: ExpoResourceFetcher }); This class allows you to use an ExecuTorch-compatible model to generate text embeddings. ```typescript -import { ALL_MINILM_L6_V2, ALL_MINILM_L6_V2_TOKENIZER } from 'react-native-executorch'; +import { models } from 'react-native-executorch'; import { ExecuTorchEmbeddings } from '@react-native-rag/executorch'; -const embeddings = new ExecuTorchEmbeddings({ - modelSource: ALL_MINILM_L6_V2, - tokenizerSource: ALL_MINILM_L6_V2_TOKENIZER, -}); +const embeddings = new ExecuTorchEmbeddings( + models.text_embedding.all_minilm_l6_v2() +); ``` ### `ExecuTorchLLM` @@ -38,18 +37,10 @@ const embeddings = new ExecuTorchEmbeddings({ This class allows you to use an ExecuTorch-compatible language model for text generation. ```typescript -import { - LLAMA3_2_1B, - LLAMA3_2_TOKENIZER, - LLAMA3_2_TOKENIZER_CONFIG, -} from 'react-native-executorch'; +import { models } from 'react-native-executorch'; import { ExecuTorchLLM } from '@react-native-rag/executorch'; -const llm = new ExecuTorchLLM({ - modelSource: LLAMA3_2_1B, - tokenizerSource: LLAMA3_2_TOKENIZER, - tokenizerConfigSource: LLAMA3_2_TOKENIZER_CONFIG, -}); +const llm = new ExecuTorchLLM(models.llm.lfm2_5_1_2b_instruct()); ``` ### Integration with `react-native-rag` diff --git a/packages/executorch/package.json b/packages/executorch/package.json index dd29fbc..a41d950 100644 --- a/packages/executorch/package.json +++ b/packages/executorch/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-rag/executorch", - "version": "0.8.0", + "version": "0.9.0", "main": "src/index.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" @@ -17,11 +17,11 @@ "registry": "https://registry.npmjs.org/" }, "peerDependencies": { - "react-native-executorch": "^0.8.0", - "react-native-rag": "^0.8.0" + "react-native-executorch": "^0.9.0", + "react-native-rag": "^0.9.0" }, "devDependencies": { - "react-native-executorch": "^0.8.0", + "react-native-executorch": "^0.9.0", "react-native-rag": "workspace:*" } } diff --git a/packages/op-sqlite/package.json b/packages/op-sqlite/package.json index 6f4c864..bc6ddd8 100644 --- a/packages/op-sqlite/package.json +++ b/packages/op-sqlite/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-rag/op-sqlite", - "version": "0.8.0", + "version": "0.9.0", "main": "src/index.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" @@ -18,7 +18,7 @@ }, "peerDependencies": { "@op-engineering/op-sqlite": "^15.2.7", - "react-native-rag": "^0.8.0" + "react-native-rag": "^0.9.0" }, "devDependencies": { "@op-engineering/op-sqlite": "^15.2.7", diff --git a/yarn.lock b/yarn.lock index 72a9097..2dd92da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3156,11 +3156,11 @@ __metadata: version: 0.0.0-use.local resolution: "@react-native-rag/executorch@workspace:packages/executorch" dependencies: - react-native-executorch: ^0.8.0 + react-native-executorch: ^0.9.0 react-native-rag: "workspace:*" peerDependencies: - react-native-executorch: ^0.8.0 - react-native-rag: ^0.8.0 + react-native-executorch: ^0.9.0 + react-native-rag: ^0.9.0 languageName: unknown linkType: soft @@ -3172,7 +3172,7 @@ __metadata: react-native-rag: "workspace:*" peerDependencies: "@op-engineering/op-sqlite": ^15.2.7 - react-native-rag: ^0.8.0 + react-native-rag: ^0.9.0 languageName: unknown linkType: soft @@ -11567,13 +11567,6 @@ __metadata: languageName: node linkType: hard -"pngjs@npm:^7.0.0": - version: 7.0.0 - resolution: "pngjs@npm:7.0.0" - checksum: b19a018930d27de26229c1b3ff250b3a25d09caa22cbb0b0459987d91eb0a560a18ab5d67da45a38ed7514140f26d1db58de83c31159ec101f2bb270a3c707f1 - languageName: node - linkType: hard - "possible-typed-array-names@npm:^1.0.0": version: 1.1.0 resolution: "possible-typed-array-names@npm:1.1.0" @@ -11893,32 +11886,31 @@ __metadata: languageName: node linkType: hard -"react-native-executorch-expo-resource-fetcher@npm:^0.8.0": - version: 0.8.0 - resolution: "react-native-executorch-expo-resource-fetcher@npm:0.8.0" +"react-native-executorch-expo-resource-fetcher@npm:^0.9.0": + version: 0.9.0 + resolution: "react-native-executorch-expo-resource-fetcher@npm:0.9.0" peerDependencies: expo: ">=54.0.0" expo-asset: ">=12.0.0" expo-file-system: ">=19.0.0" react-native: "*" react-native-executorch: "*" - checksum: 3ea4d1059e4cde913009bb4d6c5dd76fad27e5c1992538ebb5f65823ca349c11caad1d8209528b1f8ee5e4a438fd9bc923a61dd3f9d8feffd9ae6e3088da9cc7 + checksum: c7e31ff0cdf6d37a6205650a63808e443a690cedbb2df1b2b45e0ad0777caa020e396f44a55662eb2b4da6bb061bd9764e6a64109e54db8a1bab34da49bafb71 languageName: node linkType: hard -"react-native-executorch@npm:^0.8.0": - version: 0.8.0 - resolution: "react-native-executorch@npm:0.8.0" +"react-native-executorch@npm:^0.9.0": + version: 0.9.0 + resolution: "react-native-executorch@npm:0.9.0" dependencies: "@huggingface/jinja": ^0.5.0 jsonrepair: ^3.12.0 jsonschema: ^1.5.0 - pngjs: ^7.0.0 zod: ^4.3.6 peerDependencies: react: "*" react-native: "*" - checksum: 433a287be101ee6883d571cd77c54181606a7935fc4b596207e6773e3cf1967932c6d225520defb13111f4cf50da771830fcccced3d98c5096e41549941474ae + checksum: 2a82198053da86694c6f7dc9f1b658d03fdbd1ff3e672f2979972725b82f1307f0fef910b5e4be88018adf7b43e66d48624ec6f0e0f766490d07a6923427cc8d languageName: node linkType: hard @@ -11959,8 +11951,8 @@ __metadata: react-dom: 19.2.0 react-native: 0.83.2 react-native-builder-bob: ^0.40.11 - react-native-executorch: ^0.8.0 - react-native-executorch-expo-resource-fetcher: ^0.8.0 + react-native-executorch: ^0.9.0 + react-native-executorch-expo-resource-fetcher: ^0.9.0 react-native-monorepo-config: ^0.1.9 react-native-rag: "workspace:*" react-native-safe-area-context: ~5.6.2