Skip to content

Commit 8aba75e

Browse files
committed
docs: improve ai plugin
1 parent d650595 commit 8aba75e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

apps/website/docs/guide/13-ai-powered-commands/01-introduction.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ This is an experimental feature and is subject to change.
1717
npm install @commandkit/ai
1818
```
1919

20+
You also need to install the AI SDK for the model you want to use. For example, if you want to use Google Gemini, you can install the `@ai-sdk/google` package:
21+
22+
```bash
23+
npm install @ai-sdk/google
24+
```
25+
26+
Refer to the [AI SDKs documentation](https://ai-sdk.dev) for more information on how to set up the AI SDK for your model.
27+
2028
## Usage
2129

2230
```typescript title="commandkit.config.ts"
@@ -54,6 +62,21 @@ configureAI({
5462
message.inGuild() && message.mentions.users.has(message.client.user.id)
5563
);
5664
},
65+
// OPTIONAL: set your own system prompt
66+
systemPrompt: async (message) => {
67+
return `You are a helpful AI discord bot. Your name is ${message.client.user.username} and your id is ${message.client.user.id}.
68+
You are designed to assist users with their questions and tasks. You also have access to various tools that can help you perform tasks.
69+
Tools are basically like commands that you can execute to perform specific actions based on user input.
70+
Keep the response short and concise, and only use tools when necessary. Keep the response length under 2000 characters.
71+
Do not include your own text in the response unless necessary. For text formatting, you can use discord's markdown syntax.
72+
${
73+
// If the message is in a guild, include the guild name and id
74+
// Otherwise, mention that the message is in a direct message
75+
message.inGuild()
76+
? `\nYou are currently in a guild named ${message.guild.name} whose id is ${message.guildId}. While in guild, you can fetch member information if needed.`
77+
: '\nYou are currently in a direct message with the user.'
78+
}`;
79+
},
5780
});
5881
```
5982

apps/website/docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { themes as prismThemes } from 'prism-react-renderer';
22
import type { Config } from '@docusaurus/types';
33
import type * as Preset from '@docusaurus/preset-classic';
44

5-
const UPPERCASE = new Set(['jsx', 'cli', 'api']);
5+
const UPPERCASE = new Set(['jsx', 'cli', 'api', 'ai']);
66

77
const maybeUpperCase = (str: string) => {
88
const chunks = str.split(' ');

0 commit comments

Comments
 (0)