Skip to content

Commit 802f95e

Browse files
authored
Merge branch 'main' into fix/openrouter-json-object
2 parents fde224e + 79d8812 commit 802f95e

234 files changed

Lines changed: 13321 additions & 1086 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/activity-abort-timeout.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.changeset/daytona-isolate-driver.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/fuzzy-pandas-call.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/groq-summarize-adapter.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

.changeset/jolly-ravens-start.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/mcp-tool-annotations.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

.changeset/quickjs-bun-isolate-driver.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

.changeset/seedance-2-5.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

CLAUDE.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,24 @@ pnpm dev # start dev server
274274

275275
### Workspace Dependencies
276276

277-
- Use `workspace:*` protocol for internal package dependencies in `package.json`
278-
- Example: `"@tanstack/ai": "workspace:*"`
277+
Use the `workspace:` protocol for internal package dependencies in
278+
`package.json`. Which suffix to use depends on whether the field is published:
279+
280+
- **`dependencies`, `peerDependencies`, `optionalDependencies``workspace:^`**
281+
Example: `"@tanstack/ai": "workspace:^"`
282+
These fields reach consumers. At publish time pnpm rewrites the specifier to
283+
a real range, so `workspace:^` becomes `^0.43.1` while `workspace:*` becomes
284+
the exact pin `0.43.1`. An exact pin stops consumers from deduping and makes
285+
a peer dependency unsatisfiable the moment the internal package releases its
286+
next patch. Because every package here is still `0.x`, `^0.43.1` resolves to
287+
`0.43.x` only — it permits patches without allowing a breaking minor.
288+
- **`devDependencies``workspace:*`**
289+
Example: `"@tanstack/ai": "workspace:*"`
290+
Never published, so the specifier has no effect on consumers, and `*` is the
291+
correct intent: always build against the local copy.
292+
293+
Private packages (`examples/`, `testing/`) are never published, so `workspace:*`
294+
is fine there in any field.
279295

280296
### Tree-Shakeable Exports
281297

docs/adapters/bedrock.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,69 @@ for await (const chunk of chat({
204204
}
205205
```
206206

207+
## Embeddings
208+
209+
Generate embedding vectors with Titan or Cohere embedding models via `InvokeModel`:
210+
211+
```typescript
212+
import { embed } from "@tanstack/ai";
213+
import { bedrockEmbedding } from "@tanstack/ai-bedrock";
214+
215+
const result = await embed({
216+
adapter: bedrockEmbedding("amazon.titan-embed-text-v2:0"),
217+
input: ["a red guitar", "a blue drum kit"],
218+
dimensions: 512, // 256 | 512 | 1024
219+
});
220+
221+
console.log(result.embeddings[0]?.vector);
222+
```
223+
224+
Titan Multimodal embeds text and images — alone or fused into a single vector. Fuse parts by nesting them in an array (the same `Array<ContentPart>` shape a chat message's `content` uses); the outer array is the item list, so this embeds one fused item:
225+
226+
```typescript
227+
import { embed } from "@tanstack/ai";
228+
import { bedrockEmbedding } from "@tanstack/ai-bedrock";
229+
230+
const productPhoto = "iVBORw0KGgo..."; // base64 image data
231+
232+
const result = await embed({
233+
adapter: bedrockEmbedding("amazon.titan-embed-image-v1"),
234+
input: [
235+
[
236+
{ type: "text", content: "a red guitar" },
237+
{
238+
type: "image",
239+
source: {
240+
type: "data",
241+
value: productPhoto,
242+
mimeType: "image/png",
243+
},
244+
},
245+
],
246+
],
247+
dimensions: 1024, // 256 | 384 | 1024
248+
});
249+
```
250+
251+
Cohere Embed v3 on Bedrock is also supported (text-only, batched, requires `inputType`):
252+
253+
```typescript
254+
import { embed } from "@tanstack/ai";
255+
import { bedrockEmbedding } from "@tanstack/ai-bedrock";
256+
257+
const result = await embed({
258+
adapter: bedrockEmbedding("cohere.embed-english-v3"),
259+
input: ["a red guitar", "a blue drum kit"],
260+
modelOptions: { inputType: "search_document" },
261+
});
262+
```
263+
264+
> Titan models have no batch API — a batch of N items runs as N `InvokeModel`
265+
> calls under a small concurrency cap. Titan Multimodal does not fetch remote
266+
> image URLs; pass base64 data (or a `data:` URI).
267+
268+
See the [Embeddings guide](../embeddings.md) for the full API.
269+
207270
## Model Availability
208271

209272
The adapter ships with a hand-seeded snapshot catalog (`src/model-catalog.generated.ts`) of confirmed model IDs. This catalog can be refreshed by the maintainer script `scripts/fetch-bedrock-models.ts`, which calls `ListFoundationModels` with AWS credentials.

0 commit comments

Comments
 (0)