@runpod/ai-sdk-provider 0.5.0 → 0.5.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/CHANGELOG.md +6 -0
- package/README.md +35 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -86,8 +86,6 @@ const { text } = await generateText({
|
|
|
86
86
|
- `finishReason` - Why generation stopped ('stop', 'length', etc.)
|
|
87
87
|
- `usage` - Token usage information (prompt, completion, total tokens)
|
|
88
88
|
|
|
89
|
-
Runpod language models can also be used in the `streamText` function (see [AI SDK Core](/docs/ai-sdk-core)).
|
|
90
|
-
|
|
91
89
|
### Streaming
|
|
92
90
|
|
|
93
91
|
```ts
|
|
@@ -108,10 +106,10 @@ for await (const delta of textStream) {
|
|
|
108
106
|
|
|
109
107
|
### Model Capabilities
|
|
110
108
|
|
|
111
|
-
| Model ID | Description | Streaming | Object Generation | Tool Usage |
|
|
112
|
-
| -------------------------------------- | ------------------------------------------------------------------- | --------- | ----------------- | ---------- |
|
|
113
|
-
| `deep-cogito/deep-cogito-v2-llama-70b` | 70B parameter general-purpose LLM with advanced reasoning | ✅ |
|
|
114
|
-
| `qwen/qwen3-32b-awq` | 32B parameter multilingual model with strong reasoning capabilities | ✅ |
|
|
109
|
+
| Model ID | Description | Streaming | Object Generation | Tool Usage | Reasoning Notes |
|
|
110
|
+
| -------------------------------------- | ------------------------------------------------------------------- | --------- | ----------------- | ---------- | ------------------------------------------------------------ |
|
|
111
|
+
| `deep-cogito/deep-cogito-v2-llama-70b` | 70B parameter general-purpose LLM with advanced reasoning | ✅ | ❌ | ✅ | Emits `<think>…</think>` inline; no separate reasoning parts |
|
|
112
|
+
| `qwen/qwen3-32b-awq` | 32B parameter multilingual model with strong reasoning capabilities | ✅ | ❌ | ✅ | Standard reasoning events |
|
|
115
113
|
|
|
116
114
|
### Chat Conversations
|
|
117
115
|
|
|
@@ -153,29 +151,45 @@ const { text, toolCalls } = await generateText({
|
|
|
153
151
|
- `toolCalls` - Array of tool calls made by the model
|
|
154
152
|
- `toolResults` - Results from executed tools
|
|
155
153
|
|
|
156
|
-
### Structured
|
|
154
|
+
### Structured output
|
|
155
|
+
|
|
156
|
+
Using `generateObject` to enforce structured ouput is not supported by two models that are part of this provider.
|
|
157
|
+
|
|
158
|
+
You can still return structured data by instructing the model to return JSON and validating it yourself.
|
|
157
159
|
|
|
158
160
|
```ts
|
|
159
|
-
import {
|
|
161
|
+
import { runpod } from '@runpod/ai-sdk-provider';
|
|
162
|
+
import { generateText } from 'ai';
|
|
160
163
|
import { z } from 'zod';
|
|
161
164
|
|
|
162
|
-
const
|
|
165
|
+
const RecipeSchema = z.object({
|
|
166
|
+
name: z.string(),
|
|
167
|
+
ingredients: z.array(z.string()),
|
|
168
|
+
steps: z.array(z.string()),
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const { text } = await generateText({
|
|
163
172
|
model: runpod('qwen/qwen3-32b-awq'),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
messages: [
|
|
174
|
+
{
|
|
175
|
+
role: 'system',
|
|
176
|
+
content:
|
|
177
|
+
'return ONLY valid JSON matching { name: string; ingredients: string[]; steps: string[] }',
|
|
178
|
+
},
|
|
179
|
+
{ role: 'user', content: 'generate a lasagna recipe.' },
|
|
180
|
+
],
|
|
181
|
+
temperature: 0,
|
|
172
182
|
});
|
|
173
|
-
```
|
|
174
183
|
|
|
175
|
-
|
|
184
|
+
const parsed = JSON.parse(text);
|
|
185
|
+
const result = RecipeSchema.safeParse(parsed);
|
|
186
|
+
|
|
187
|
+
if (!result.success) {
|
|
188
|
+
// handle invalid JSON shape
|
|
189
|
+
}
|
|
176
190
|
|
|
177
|
-
|
|
178
|
-
|
|
191
|
+
console.log(result.success ? result.data : parsed);
|
|
192
|
+
```
|
|
179
193
|
|
|
180
194
|
## Image Models
|
|
181
195
|
|