@tanstack/ai-react 0.1.0 → 0.2.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 +0 -25
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -72,31 +72,6 @@ for await (const chunk of result) {
|
|
|
72
72
|
|
|
73
73
|
Available adapters: `openaiText`, `openaiEmbed`, `openaiSummarize`, `anthropicText`, `geminiText`, `ollamaText`, and more.
|
|
74
74
|
|
|
75
|
-
## Bonus: TanStack Start Integration
|
|
76
|
-
|
|
77
|
-
TanStack AI works with **any** framework (Next.js, Express, Remix, etc.).
|
|
78
|
-
|
|
79
|
-
**With TanStack Start**, you get a bonus: share implementations between AI tools and server functions with `createServerFnTool`:
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
import { createServerFnTool } from '@tanstack/ai-react'
|
|
83
|
-
|
|
84
|
-
// Define once, get AI tool AND server function (TanStack Start only)
|
|
85
|
-
const getProducts = createServerFnTool({
|
|
86
|
-
name: 'getProducts',
|
|
87
|
-
inputSchema: z.object({ query: z.string() }),
|
|
88
|
-
execute: async ({ query }) => db.products.search(query),
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
// Use in AI chat
|
|
92
|
-
chat({ tools: [getProducts.server] })
|
|
93
|
-
|
|
94
|
-
// Call directly from components (no API endpoint needed!)
|
|
95
|
-
const products = await getProducts.serverFn({ query: 'laptop' })
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
No duplicate logic, full type safety, automatic validation. The `serverFn` feature requires TanStack Start. See [docs](https://tanstack.com/ai) for details.
|
|
99
|
-
|
|
100
75
|
## Get Involved
|
|
101
76
|
|
|
102
77
|
- We welcome issues and pull requests!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ai-react",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React hooks for TanStack AI",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,22 +31,19 @@
|
|
|
31
31
|
"streaming"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@tanstack/ai": "0.1
|
|
35
|
-
"@tanstack/ai-client": "0.1.0"
|
|
34
|
+
"@tanstack/ai-client": "0.2.1"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@testing-library/react": "^16.3.0",
|
|
39
38
|
"@types/react": "^19.2.7",
|
|
40
39
|
"@vitest/coverage-v8": "4.0.14",
|
|
41
40
|
"jsdom": "^27.2.0",
|
|
42
|
-
"vite": "^7.2.7"
|
|
43
|
-
"zod": "^4.1.13"
|
|
41
|
+
"vite": "^7.2.7"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
46
44
|
"@types/react": ">=18.0.0",
|
|
47
45
|
"react": ">=18.0.0",
|
|
48
|
-
"@tanstack/ai": "0.1
|
|
49
|
-
"@tanstack/ai-client": "0.1.0"
|
|
46
|
+
"@tanstack/ai": "^0.2.1"
|
|
50
47
|
},
|
|
51
48
|
"scripts": {
|
|
52
49
|
"clean": "premove ./build ./dist",
|