react-native-nobodywho 0.0.1

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.
Files changed (3) hide show
  1. package/README.md +128 -0
  2. package/package.json +42 -0
  3. package/src/wrapper.ts +47 -0
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # NobodyWho React Native
2
+
3
+ NobodyWho is a React Native library for running large language models locally and offline on iOS and Android.
4
+
5
+ Free to use in commercial projects under the EUPL-1.2 license — no API key required. Supports text, vision, embeddings, RAG & function calling.
6
+
7
+ - [Documentation](https://docs.nobodywho.ooo) — React Native & other frameworks documentation
8
+ - [Discord](https://discord.gg/qhaMc2qCYB) — Get help, share ideas, and connect with other developers
9
+ - [GitHub Issues](https://github.com/nobodywho-ooo/nobodywho/issues) — Report bugs
10
+ - [GitHub Discussions](https://github.com/nobodywho-ooo/nobodywho/discussions) — Ask questions and request features
11
+
12
+ ## Quick Start
13
+
14
+ Install the library:
15
+
16
+ ```
17
+ npm install react-native-nobodywho
18
+ ```
19
+
20
+ ## Supported Model Format
21
+
22
+ This library uses the **GGUF format** — a binary format optimized for fast loading and efficient LLM inference. A wide selection of GGUF models is available on [Hugging Face](https://huggingface.co/models).
23
+
24
+ **Compatibility notes:**
25
+ - Most GGUF models will work, but some may fail due to formatting issues.
26
+ - For mobile devices, models under 1 GB tend to run smoothly. As a general rule, the device should have at least twice the available RAM as the model file size. Note that available RAM differs from total RAM — iOS typically reserves around 1–2 GB for the kernel and system processes, while Android overhead varies by manufacturer: roughly 2 GB on stock Android (e.g. Pixel devices), and between 2–4 GB on Samsung, Xiaomi, and Oppo devices due to additional services.
27
+
28
+ **Minimum recommended specs:**
29
+
30
+ - iOS: iPhone 11 or newer with at least 4 GB of RAM.
31
+ - Android: Snapdragon 855 / Adreno 640 / 6 GB RAM or better.
32
+
33
+ ## Chat
34
+
35
+ ```typescript
36
+ import { Chat } from "react-native-nobodywho";
37
+
38
+ const chat = await Chat.fromPath({
39
+ modelPath: "/path/to/model.gguf",
40
+ systemPrompt: "You are a helpful assistant.",
41
+ });
42
+
43
+ // Stream tokens
44
+ for await (const token of chat.ask("Is water wet?")) {
45
+ process.stdout.write(token);
46
+ }
47
+
48
+ // Or get the full response
49
+ const response = await chat.ask("Is water wet?").completed();
50
+ ```
51
+
52
+ See the [Chat documentation](https://docs.nobodywho.ooo/react-native/chat/) for details.
53
+
54
+ ## Tool Calling
55
+
56
+ Give your LLM the ability to interact with the outside world by defining tools:
57
+
58
+ ```typescript
59
+ import { Chat, Tool } from "react-native-nobodywho";
60
+
61
+ const getWeather = new Tool({
62
+ name: "get_weather",
63
+ description: "Get the current weather for a city",
64
+ parameters: {
65
+ city: { type: "string", description: "The city name" },
66
+ },
67
+ call: ({ city }) => JSON.stringify({ temp: 22, condition: "sunny" }),
68
+ });
69
+
70
+ const chat = await Chat.fromPath({
71
+ modelPath: "/path/to/model.gguf",
72
+ tools: [getWeather],
73
+ });
74
+
75
+ const response = await chat.ask("What's the weather in Paris?").completed();
76
+ ```
77
+
78
+ See the [Tool Calling documentation](https://docs.nobodywho.ooo/react-native/tool-calling/) for more.
79
+
80
+ ---
81
+
82
+ ## Sampling
83
+
84
+ The model outputs a probability distribution over possible tokens. A sampler determines how the next token is selected from that distribution. You can configure sampling to improve output quality or constrain outputs to a specific format (e.g. JSON):
85
+
86
+ ```typescript
87
+ import { Chat, SamplerPresets } from "react-native-nobodywho";
88
+
89
+ const chat = await Chat.fromPath({
90
+ modelPath: "/path/to/model.gguf",
91
+ sampler: SamplerPresets.temperature(0.2), // Lower = more deterministic
92
+ });
93
+ ```
94
+
95
+ See the [Sampling documentation](https://docs.nobodywho.ooo/react-native/sampling/) for more.
96
+
97
+ ---
98
+
99
+ ## Vision
100
+
101
+ Vision support lets you include images in your prompts, so the model can analyze and describe visual content alongside text.
102
+
103
+ To enable this, you need two model files:
104
+
105
+ - A **vision-language LLM** (usually has `VL` in the name)
106
+ - A matching **projection model** that converts images into tokens the LLM can process (usually has `mmproj` in the name)
107
+
108
+ Pass the projection model when loading your model, then use `Prompt` to compose prompts that mix text and images:
109
+
110
+ ```typescript
111
+ import { Chat, Prompt } from "react-native-nobodywho";
112
+
113
+ const chat = await Chat.fromPath({
114
+ modelPath: "/path/to/vision-model.gguf",
115
+ imageModelPath: "/path/to/mmproj.gguf",
116
+ });
117
+
118
+ const prompt = new Prompt([
119
+ Prompt.Text("What do you see in this image?"),
120
+ Prompt.Image("/path/to/photo.png"),
121
+ ]);
122
+
123
+ const response = await chat.ask(prompt).completed();
124
+ ```
125
+
126
+ You can pass multiple images and interleave text between them. If the model performs poorly, try reordering the text and image parts — this can make a noticeable difference. If images consume too much context, increase `contextSize` or preprocess images with compression.
127
+
128
+ See the [Vision documentation](https://docs.nobodywho.ooo/react-native/vision/) for model recommendations and advanced tips.
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "react-native-nobodywho",
3
+ "version": "0.0.1",
4
+ "description": "Run LLMs locally with offline inference — React Native bindings",
5
+ "main": "src/wrapper.ts",
6
+ "types": "src/wrapper.ts",
7
+ "exports": {
8
+ ".": "./src/wrapper.ts"
9
+ },
10
+ "license": "EUPL-1.2",
11
+ "homepage": "https://nobodywho.ooo",
12
+ "bugs": "https://github.com/nobodywho-ooo/nobodywho/issues",
13
+ "keywords": [
14
+ "react-native",
15
+ "ai",
16
+ "llm",
17
+ "local-ai",
18
+ "inference",
19
+ "gguf",
20
+ "on-device",
21
+ "offline"
22
+ ],
23
+ "files": [
24
+ "README.md"
25
+ ],
26
+ "codegenConfig": {
27
+ "name": "NobodywhoSpec",
28
+ "type": "modules",
29
+ "jsSrcsDir": "src"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/nobodywho-ooo/nobodywho"
34
+ },
35
+ "peerDependencies": {
36
+ "react": "*",
37
+ "react-native": "*"
38
+ },
39
+ "devDependencies": {
40
+ "uniffi-bindgen-react-native": "0.30.0-1"
41
+ }
42
+ }
package/src/wrapper.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * NobodyWho — React Native bindings for local LLM inference.
3
+ *
4
+ * This is the public entry point. It re-exports the public API:
5
+ * - Wrapper classes: Chat, Tool, TokenStream (wrapping internal Rust* types)
6
+ * - Direct re-exports: Model, Encoder, CrossEncoder, SamplerBuilder, SamplerConfig, etc.
7
+ * - Utilities: SamplerPresets, loadModel, cosineSimilarity
8
+ *
9
+ * This file is NOT generated — it is safe to edit.
10
+ */
11
+
12
+ // Wrapper classes that hide the internal Rust* types.
13
+ export { Chat } from "./chat";
14
+ export { Prompt } from "./prompt";
15
+ export { Tool } from "./tool";
16
+ export { TokenStream } from "./streaming";
17
+
18
+ // Re-export types that don't need wrapping.
19
+ export {
20
+ Model,
21
+ Encoder,
22
+ CrossEncoder,
23
+ SamplerBuilder,
24
+ SamplerConfig,
25
+ Role,
26
+ Message,
27
+ Message_Tags,
28
+ PromptPart,
29
+ PromptPart_Tags,
30
+ cosineSimilarity,
31
+ loadModel,
32
+ uniffiInitAsync,
33
+ } from "./index";
34
+
35
+ export type {
36
+ ModelInterface,
37
+ EncoderInterface,
38
+ CrossEncoderInterface,
39
+ SamplerBuilderInterface,
40
+ SamplerConfigInterface,
41
+ Asset,
42
+ ToolCall,
43
+ ToolParameter,
44
+ } from "./index";
45
+
46
+ // Ergonomic wrapper additions.
47
+ export { SamplerPresets } from "./sampler_presets";