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:
6868 messages = []
6969
7070 for i , user_input in enumerate (self .user_utterances ):
71+ # To reduce token use, clear out past messages for each utterance
72+ messages = []
73+
7174 print (f"\n You: { user_input } " )
7275
7376 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:
8888 "Hello!" ,
8989 "What is the current time in Seattle?" ,
9090 "Are there any weather alerts right now?" ,
91- "What documentation sources can you use to answer questions? " ,
91+ "List your available documentation sources. " ,
9292 "Tell me a cat fact." ,
9393 "Who is Tom Cruise?" ,
9494 ]
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ export class ChatSession {
8282 const messages : Message [ ] = [ ] ;
8383
8484 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+
8588 console . log ( `\You: ${ userInput } ` ) ;
8689
8790 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> {
3333 "Hello!" ,
3434 "What is the current time in Seattle?" ,
3535 "Are there any weather alerts right now?" ,
36- "What documentation sources can you use to answer questions? " ,
36+ "List your available documentation sources. " ,
3737 "Tell me a cat fact." ,
3838 "Who is Tom Cruise?" ,
3939 ] ;
You can’t perform that action at this time.
0 commit comments