@ai-sdk/llamaindex 3.0.151 → 3.0.153
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/CHANGELOG.md +14 -0
- package/README.md +34 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/llamaindex
|
|
2
2
|
|
|
3
|
+
## 3.0.153
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
|
|
8
|
+
- Updated dependencies [5475347]
|
|
9
|
+
- ai@7.0.153
|
|
10
|
+
|
|
11
|
+
## 3.0.152
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- ai@7.0.152
|
|
16
|
+
|
|
3
17
|
## 3.0.151
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
1
|
# AI SDK - LlamaIndex Adapter
|
|
2
2
|
|
|
3
3
|
This package contains a LlamaIndex adapter for the AI SDK.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i ai @ai-sdk/llamaindex llamaindex
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { OpenAI, SimpleChatEngine } from 'llamaindex';
|
|
15
|
+
import { toUIMessageStream } from '@ai-sdk/llamaindex';
|
|
16
|
+
import { createUIMessageStreamResponse } from 'ai';
|
|
17
|
+
|
|
18
|
+
export const maxDuration = 60;
|
|
19
|
+
|
|
20
|
+
export async function POST(req: Request) {
|
|
21
|
+
const { prompt } = await req.json();
|
|
22
|
+
|
|
23
|
+
const llm = new OpenAI({ model: 'gpt-6-astra' });
|
|
24
|
+
const chatEngine = new SimpleChatEngine({ llm });
|
|
25
|
+
|
|
26
|
+
const stream = await chatEngine.chat({
|
|
27
|
+
message: prompt,
|
|
28
|
+
stream: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return createUIMessageStreamResponse({
|
|
32
|
+
stream: toUIMessageStream(stream),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
See the [LlamaIndex documentation](https://ai-sdk.dev/providers/adapters/llamaindex) for more information.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/llamaindex",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.153",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"ai": "7.0.
|
|
28
|
+
"ai": "7.0.153"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "22.19.19",
|