1+ using Examples . Utils ;
2+ using MaIN . Core . Hub ;
3+ using MaIN . Core . Hub . Utils ;
4+ using MaIN . Domain . Entities ;
5+ using MaIN . Domain . Entities . Agents . AgentSource ;
6+ using Microsoft . Identity . Client ;
7+
8+ namespace Examples . Agents ;
9+
10+ public class AgentWithKnowledgeWebExample : IExample
11+ {
12+ public async Task Start ( )
13+ {
14+ Console . WriteLine ( "Piano Learning Assistant with Focused Knowledge Sources" ) ;
15+
16+ AIHub . Extensions . DisableLLamaLogs ( ) ;
17+ var context = await AIHub . Agent ( )
18+ . WithModel ( "llama3.2:3b" )
19+ . WithMemoryParams ( new MemoryParams ( ) { ContextSize = 2137 } )
20+ . WithInitialPrompt ( """
21+ You are an expert piano instructor specializing in teaching specific pieces,
22+ techniques, and solving common playing problems. Help students learn exact
23+ fingerings, chord progressions, and troubleshoot technical issues with
24+ detailed, step-by-step guidance for both classical and popular music.
25+ """ )
26+ . WithKnowledge ( KnowledgeBuilder . Instance
27+ . AddUrl ( "piano_scales_major" , "https://www.pianoscales.org/major.html" ,
28+ tags : [ "scale_fingerings" , "c_major_scale" , "d_major_scale" , "fingering_patterns" ] )
29+ . AddUrl ( "piano_chord_database" , "https://www.pianochord.org/" ,
30+ tags : [ "chord_fingerings" , "cmaj7_chord" , "chord_inversions" , "left_hand_chords" ] )
31+ . AddUrl ( "fundamentals_practice_book" , "https://fundamentals-of-piano-practice.readthedocs.io/" ,
32+ tags : [ "memorization_techniques" , "mental_play_method" , "practice_efficiency" , "difficult_passages" ] )
33+ . AddUrl ( "hanon_exercises" , "https://www.hanon-online.com/" ,
34+ tags : [ "hanon_exercises" , "finger_independence" , "daily_technical_work" , "exercise_1_through_20" ] )
35+ . AddUrl ( "sheet_music_reading" ,
36+ "https://www.simplifyingtheory.com/how-to-read-sheet-music-for-beginners/" ,
37+ tags : [ "bass_clef_reading" , "treble_clef_notes" , "note_identification" , "staff_reading_speed" ] )
38+ . AddUrl ( "piano_fundamentals" , "https://music2me.com/en/magazine/learn-piano-in-13-steps" ,
39+ tags : [ "proper_posture" , "finger_numbering" , "hand_position" , "keyboard_orientation" ] )
40+ . AddUrl ( "theory_lessons" , "https://www.8notes.com/theory/" ,
41+ tags : [ "interval_identification" , "key_signatures" , "circle_of_fifths" , "time_signatures" ] )
42+ . AddUrl ( "piano_terms" , "https://www.libertyparkmusic.com/musical-terms-learning-piano/" ,
43+ tags : [ "dynamics_markings" , "tempo_markings" , "articulation_symbols" , "expression_terms" ] ) )
44+ . WithSteps ( StepBuilder . Instance
45+ . AnswerUseKnowledge ( )
46+ . Build ( ) )
47+ . CreateAsync ( ) ;
48+
49+ var result = await context
50+ . ProcessAsync ( "I want to learn the C major scale. What's the exact fingering pattern for both hands?" + "I want short and concrete answer" ) ;
51+
52+ Console . WriteLine ( result . Message . Content ) ;
53+ }
54+ }
0 commit comments