Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-dingos-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ai': patch
---

chore(ai): add AGENTS.md and CLAUDE.md to npm package
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ tsconfig.vitest-temp.json
*.log
*.local
*.tsbuildinfo

# Generated files
packages/ai/AGENTS.md
packages/ai/CLAUDE.md
57 changes: 57 additions & 0 deletions packages/ai/USAGE-AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# AI SDK Usage

## Use Cases

### Generating Text

#### text prompt

```ts
import { generateText } from 'ai';

const result = await generateText({
model: 'openai/gpt-5',
prompt: 'Invent a new holiday.', // text prompt
});

const text = result.text; // access generated text
```

#### Specifying the maximum number of tokens to generate

```ts
import { generateText } from 'ai';

const result = await generateText({
model: 'openai/gpt-5',
prompt: 'Invent a new holiday.',
maxOutputTokens: 100, // maximum number of tokens to generate
});
```

### Streaming Text

#### text prompt and text stream

```ts
import { streamText } from 'ai';

const result = streamText({
model: 'openai/gpt-5',
prompt: 'Invent a new holiday.', // text prompt
});

const textStream = result.textStream; // access text stream
```

#### Specifying the maximum number of tokens to generate

```ts
import { streamText } from 'ai';

const result = await streamText({
model: 'openai/gpt-5',
prompt: 'Invent a new holiday.',
maxOutputTokens: 100, // maximum number of tokens to generate
});
```
2 changes: 2 additions & 0 deletions packages/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"types": "./dist/index.d.ts",
"files": [
"dist/**/*",
"AGENTS.md",
"CHANGELOG.md",
"CLAUDE.md",
"internal.d.ts",
"README.md",
"test.d.ts"
Expand Down
6 changes: 6 additions & 0 deletions packages/ai/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { copyFileSync } from 'node:fs';
import { defineConfig } from 'tsup';

export default defineConfig([
Expand All @@ -16,6 +17,11 @@ export default defineConfig([
.version,
),
},
onSuccess: async () => {
// Copy USAGE-AGENTS.md to AGENTS.md and CLAUDE.md for inclusion in the published package
copyFileSync('USAGE-AGENTS.md', 'AGENTS.md');
copyFileSync('USAGE-AGENTS.md', 'CLAUDE.md');
},
},
// Internal APIs
{
Expand Down
Loading