Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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 to npm package
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ tsconfig.vitest-temp.json
*.log
*.local
*.tsbuildinfo

# Generated files
packages/ai/AGENTS.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
});
```
1 change: 1 addition & 0 deletions packages/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"types": "./dist/index.d.ts",
"files": [
"dist/**/*",
"AGENTS.md",
"CHANGELOG.md",
"internal.d.ts",
"README.md",
Expand Down
5 changes: 5 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,10 @@ export default defineConfig([
.version,
),
},
onSuccess: async () => {
Comment thread
lgrammel marked this conversation as resolved.
// Copy USAGE-AGENTS.md to AGENTS.md for inclusion in the published package
copyFileSync('USAGE-AGENTS.md', 'AGENTS.md');
},
},
// Internal APIs
{
Expand Down
Loading