File tree Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ async def start(self) -> None:
68
68
messages = []
69
69
70
70
for i , user_input in enumerate (self .user_utterances ):
71
+ # To reduce token use, clear out past messages for each utterance
72
+ messages = []
73
+
71
74
print (f"\n You: { user_input } " )
72
75
73
76
messages .append ({"role" : "user" , "content" : [{"text" : user_input }]})
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ async def main() -> None:
88
88
"Hello!" ,
89
89
"What is the current time in Seattle?" ,
90
90
"Are there any weather alerts right now?" ,
91
- "What documentation sources can you use to answer questions? " ,
91
+ "List your available documentation sources. " ,
92
92
"Tell me a cat fact." ,
93
93
"Who is Tom Cruise?" ,
94
94
]
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ export class ChatSession {
82
82
const messages : Message [ ] = [ ] ;
83
83
84
84
for ( const [ i , userInput ] of this . userUtterances . entries ( ) ) {
85
+ // To reduce token use, clear out past messages for each utterance
86
+ messages . length = 0 ;
87
+
85
88
console . log ( `\You: ${ userInput } ` ) ;
86
89
87
90
messages . push ( { role : "user" , content : [ { text : userInput } ] } ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ async function main(): Promise<void> {
33
33
"Hello!" ,
34
34
"What is the current time in Seattle?" ,
35
35
"Are there any weather alerts right now?" ,
36
- "What documentation sources can you use to answer questions? " ,
36
+ "List your available documentation sources. " ,
37
37
"Tell me a cat fact." ,
38
38
"Who is Tom Cruise?" ,
39
39
] ;
You can’t perform that action at this time.
0 commit comments