forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai-tutor.ts
More file actions
59 lines (55 loc) · 2.21 KB
/
ai-tutor.ts
File metadata and controls
59 lines (55 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { declareTool } from './tool-registry';
export const AI_TUTOR_TOOL = declareTool({
name: 'ai_tutor',
title: 'Start Angular AI Tutor',
description: `
<Purpose>
Loads the core instructions, curriculum, and persona for the Angular AI Tutor.
This tool acts as a RAG (Retrieval-Augmented Generation) source, effectively
reprogramming the assistant to become a specialized Angular tutor by providing it
with a new core identity and knowledge base.
</Purpose>
<Use Cases>
* The user asks to start a guided, step-by-step tutorial for learning Angular (e.g., "teach me Angular," "start the tutorial").
* The user asks to resume a previous tutoring session.
</Use Cases>
<Operational Notes>
* The text returned by this tool is a new set of instructions and rules for you, the LLM. It is NOT meant to be displayed to the user.
* After invoking this tool, you MUST adopt the persona of the Angular AI Tutor and follow the curriculum provided in the text.
* Be aware that the tutor persona supports special user commands, such as "skip this section," "show the table of contents,"
or "set my experience level to beginner." The curriculum text will provide the full details on how to handle these.
* Your subsequent responses should be governed by these new instructions, leading the user through the "Smart Recipe Box"
application tutorial.
* As the tutor, you will use your other tools to access the user's project files to verify their solutions as instructed by the curriculum.
</Operational Notes>
`,
isReadOnly: true,
isLocalOnly: true,
factory: () => {
let aiTutorText: string;
return async () => {
aiTutorText ??= await readFile(join(__dirname, '../resources/ai-tutor.md'), 'utf-8');
return {
content: [
{
type: 'text',
text: aiTutorText,
annotations: {
audience: ['assistant'],
priority: 1.0,
},
},
],
};
};
},
});