react-native-ai-hooks 0.6.0 → 0.6.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.
package/README.md CHANGED
@@ -1,37 +1,33 @@
1
- [![npm downloads](https://img.shields.io/npm/dw/react-native-ai-hooks)](https://npmjs.com/package/react-native-ai-hooks)
2
- [![npm version](https://img.shields.io/npm/v/react-native-ai-hooks)](https://npmjs.com/package/react-native-ai-hooks)
3
- [![GitHub stars](https://img.shields.io/github/stars/nikapkh/react-native-ai-hooks)](https://github.com/nikapkh/react-native-ai-hooks)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1
+ # React Native AI Hooks
5
2
 
6
- # react-native-ai-hooks
3
+ [![NPM Downloads](https://img.shields.io/npm/dm/react-native-ai-hooks)](https://www.npmjs.com/package/react-native-ai-hooks)
4
+ [![Version](https://img.shields.io/npm/v/react-native-ai-hooks)](https://www.npmjs.com/package/react-native-ai-hooks)
5
+ [![License](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
6
 
8
- Build AI features in React Native without rebuilding the same plumbing every sprint.
7
+ ## Architecture Visual
9
8
 
10
- One hooks-first API for Claude, OpenAI, and Gemini.
9
+ <p align="center">
10
+ <img src="./docs/assets/architecture.png" alt="React Native AI Hooks architecture diagram" width="1100" />
11
+ </p>
12
+ <p align="center">
13
+ <em>Production flow: App Layer -> Hooks -> ProviderFactory -> fetchWithRetry -> Anthropic, OpenAI, Gemini</em>
14
+ </p>
11
15
 
12
- ## Why use this?
16
+ ## The Core Problem
13
17
 
14
- Most teams burn time on the same AI integration work:
18
+ Mobile AI is fragile in production. Network volatility, provider rate-limits, and intermittent API failures can degrade UX quickly.
15
19
 
16
- - Provider-specific request/response wiring
17
- - Retry, timeout, and error edge cases
18
- - Streaming token parsing
19
- - State handling for loading, cancellation, and failures
20
+ React Native AI Hooks is the Resilience Layer for those failure modes. It standardizes provider integration, hardens request execution, and gives product teams a clean hooks-first interface so reliability is built in from day one.
20
21
 
21
- This library gives you that foundation out of the box so you can ship product features, not infra glue.
22
+ ## What's New in v0.6.0 (The Highlights)
22
23
 
23
- | What you want | What this gives you |
24
- |---|---|
25
- | Ship chat quickly | Drop-in hooks with minimal setup |
26
- | Avoid provider lock-in | Unified interface across providers |
27
- | Handle real-world failures | Built-in retries, backoff, timeout, abort |
28
- | Keep code clean | Strong TypeScript types and predictable APIs |
24
+ - Production-Grade Resilience: Exponential backoff plus jitter for 429 and 5xx failures, with retry and timeout controls.
25
+ - Unified Provider Factory: Anthropic, OpenAI, and Gemini behind one standardized API surface.
26
+ - 100% Logic Coverage: Hardened with Jest and continuously verified in GitHub Actions.
29
27
 
30
28
  ## Quick Start
31
29
 
32
30
  ```tsx
33
- // npm install react-native-ai-hooks
34
-
35
31
  import { useAIChat } from 'react-native-ai-hooks';
36
32
 
37
33
  export function Assistant() {
@@ -41,57 +37,29 @@ export function Assistant() {
41
37
  model: 'claude-sonnet-4-20250514',
42
38
  });
43
39
 
44
- // Example action
45
- async function onAsk() {
46
- await sendMessage('Draft a warm onboarding message for new users.');
40
+ async function ask() {
41
+ await sendMessage('Summarize the top product risks from this sprint.');
47
42
  }
48
43
 
49
44
  return null;
50
45
  }
51
46
  ```
52
47
 
53
- ## Hooks
54
-
55
- - 💬 useAIChat: multi-turn conversation
56
- - ⚡ useAIStream: token streaming
57
- - 👁️ useImageAnalysis: image and vision workflows
58
- - 📝 useAIForm: AI-assisted form validation
59
- - 🎙️ useAIVoice: speech-to-text plus AI response
60
- - 🌍 useAITranslate: real-time translation
61
- - 📄 useAISummarize: concise text summaries
62
- - 🧠 useAICode: generate and explain code
63
-
64
- ## Provider Support
65
-
66
- | Provider | Chat | Stream | Vision | Voice |
67
- |---|---|---|---|---|
68
- | Anthropic Claude | ✅ | ✅ | ✅ | ✅ |
69
- | OpenAI | ✅ | ✅ | ✅ | ✅ |
70
- | Gemini | ✅ | ✅ | 🔜 | 🔜 |
48
+ ## Documentation
71
49
 
72
- ## Security
73
-
74
- Use a backend proxy in production. Do not ship permanent provider API keys in app binaries.
75
-
76
- ```tsx
77
- const { sendMessage } = useAIChat({
78
- baseUrl: 'https://your-backend.com/api/ai',
79
- });
80
- ```
81
-
82
- ## Example App
83
-
84
- See [example](./example) for a full app with provider switching, API key settings, and streaming chat.
85
-
86
- ## Deep Technical Docs
87
-
88
- Detailed architecture and implementation references now live in [docs](./docs):
50
+ For deep technical specs and implementation details, see [docs](./docs):
89
51
 
90
52
  - [Architecture Guide](./docs/ARCHITECTURE_GUIDE.md)
91
53
  - [Technical Specification](./docs/TECHNICAL_SPECIFICATION.md)
92
54
  - [Implementation Summary](./docs/IMPLEMENTATION_COMPLETE.md)
93
55
  - [Internal Architecture Notes](./docs/ARCHITECTURE.md)
94
56
 
57
+ ## Support
58
+
59
+ If this project helps your team ship reliable mobile AI features, please consider leaving a star:
60
+
61
+ [Star react-native-ai-hooks on GitHub](https://github.com/nikapkh/react-native-ai-hooks)
62
+
95
63
  ## License
96
64
 
97
65
  MIT © [nikapkh](https://github.com/nikapkh)
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ai-hooks",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "AI hooks for React Native — useAIChat, useAIStream, useImageAnalysis. Works with Claude, OpenAI & Gemini.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",