docs: update READMEs to use AI SDK v6 streamText API

- Replace deprecated Agent class with streamText
- Add anthropic provider import
- Add system prompt example
This commit is contained in:
Ajax Davis 2025-12-12 10:09:17 +10:00
parent 36b84294b4
commit 46088f09c3
2 changed files with 14 additions and 6 deletions

View file

@ -13,16 +13,20 @@ pnpm add @tpmjs/registry-execute
## Usage
```typescript
import { Agent } from 'ai';
import { streamText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { registrySearchTool } from '@tpmjs/registry-search';
import { registryExecuteTool } from '@tpmjs/registry-execute';
const agent = new Agent({
model: 'anthropic/claude-sonnet-4-20250514',
const result = streamText({
model: anthropic('claude-sonnet-4-20250514'),
tools: {
registrySearch: registrySearchTool,
registryExecute: registryExecuteTool,
},
system: `You have access to the TPMJS tool registry.
Use registrySearch to find tools, then registryExecute to run them.`,
prompt: 'Search for web scraping tools and scrape https://example.com',
});
// The agent can now:

View file

@ -13,16 +13,20 @@ pnpm add @tpmjs/registry-search
## Usage
```typescript
import { Agent } from 'ai';
import { streamText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { registrySearchTool } from '@tpmjs/registry-search';
import { registryExecuteTool } from '@tpmjs/registry-execute';
const agent = new Agent({
model: 'anthropic/claude-sonnet-4-20250514',
const result = streamText({
model: anthropic('claude-sonnet-4-20250514'),
tools: {
registrySearch: registrySearchTool,
registryExecute: registryExecuteTool,
},
system: `You have access to the TPMJS tool registry.
Use registrySearch to find tools, then registryExecute to run them.`,
prompt: 'Search for web scraping tools and scrape https://example.com',
});
// The agent can now: