@@ -97,6 +97,7 @@ pub struct ConversationState {
9797 pub conversation_id : Option < String > ,
9898 pub user_input_message : UserInputMessage ,
9999 pub history : Option < Vec < ChatMessage > > ,
100+ pub agent_continuation_id : Option < String > ,
100101}
101102
102103#[ derive( Debug , Clone ) ]
@@ -542,7 +543,7 @@ impl TryFrom<AssistantResponseMessage> for amzn_qdeveloper_streaming_client::typ
542543}
543544
544545#[ non_exhaustive]
545- #[ derive( Debug , Clone , PartialEq , Eq ) ]
546+ #[ derive( Debug , Clone , PartialEq ) ]
546547pub enum ChatResponseStream {
547548 AssistantResponseEvent {
548549 content : String ,
@@ -563,6 +564,16 @@ pub enum ChatResponseStream {
563564 conversation_id : Option < String > ,
564565 utterance_id : Option < String > ,
565566 } ,
567+ MetadataEvent {
568+ total_tokens : Option < i32 > ,
569+ uncached_input_tokens : Option < i32 > ,
570+ output_tokens : Option < i32 > ,
571+ cache_read_input_tokens : Option < i32 > ,
572+ cache_write_input_tokens : Option < i32 > ,
573+ } ,
574+ MeteringEvent {
575+ usage : Option < f64 > ,
576+ } ,
566577 SupplementaryWebLinksEvent ( ( ) ) ,
567578 ToolUseEvent {
568579 tool_use_id : String ,
@@ -609,6 +620,18 @@ impl From<amzn_codewhisperer_streaming_client::types::ChatResponseStream> for Ch
609620 conversation_id,
610621 utterance_id,
611622 } ,
623+ amzn_codewhisperer_streaming_client:: types:: ChatResponseStream :: MetadataEvent (
624+ amzn_codewhisperer_streaming_client:: types:: MetadataEvent { token_usage, .. } ,
625+ ) => ChatResponseStream :: MetadataEvent {
626+ total_tokens : token_usage. as_ref ( ) . map ( |t| t. total_tokens ) ,
627+ uncached_input_tokens : token_usage. as_ref ( ) . map ( |t| t. uncached_input_tokens ) ,
628+ output_tokens : token_usage. as_ref ( ) . map ( |t| t. output_tokens ) ,
629+ cache_read_input_tokens : token_usage. as_ref ( ) . and_then ( |t| t. cache_read_input_tokens ) ,
630+ cache_write_input_tokens : token_usage. as_ref ( ) . and_then ( |t| t. cache_write_input_tokens ) ,
631+ } ,
632+ amzn_codewhisperer_streaming_client:: types:: ChatResponseStream :: MeteringEvent (
633+ amzn_codewhisperer_streaming_client:: types:: MeteringEvent { usage, .. } ,
634+ ) => ChatResponseStream :: MeteringEvent { usage } ,
612635 amzn_codewhisperer_streaming_client:: types:: ChatResponseStream :: ToolUseEvent (
613636 amzn_codewhisperer_streaming_client:: types:: ToolUseEvent {
614637 tool_use_id,
@@ -626,7 +649,7 @@ impl From<amzn_codewhisperer_streaming_client::types::ChatResponseStream> for Ch
626649 amzn_codewhisperer_streaming_client:: types:: ChatResponseStream :: SupplementaryWebLinksEvent ( _) => {
627650 ChatResponseStream :: SupplementaryWebLinksEvent ( ( ) )
628651 } ,
629- _ => ChatResponseStream :: Unknown ,
652+ _other => ChatResponseStream :: Unknown ,
630653 }
631654 }
632655}
@@ -665,6 +688,18 @@ impl From<amzn_qdeveloper_streaming_client::types::ChatResponseStream> for ChatR
665688 conversation_id,
666689 utterance_id,
667690 } ,
691+ amzn_qdeveloper_streaming_client:: types:: ChatResponseStream :: MetadataEvent (
692+ amzn_qdeveloper_streaming_client:: types:: MetadataEvent { token_usage, .. } ,
693+ ) => ChatResponseStream :: MetadataEvent {
694+ total_tokens : token_usage. as_ref ( ) . map ( |t| t. total_tokens ) ,
695+ uncached_input_tokens : token_usage. as_ref ( ) . map ( |t| t. uncached_input_tokens ) ,
696+ output_tokens : token_usage. as_ref ( ) . map ( |t| t. output_tokens ) ,
697+ cache_read_input_tokens : token_usage. as_ref ( ) . and_then ( |t| t. cache_read_input_tokens ) ,
698+ cache_write_input_tokens : token_usage. as_ref ( ) . and_then ( |t| t. cache_write_input_tokens ) ,
699+ } ,
700+ amzn_qdeveloper_streaming_client:: types:: ChatResponseStream :: MeteringEvent (
701+ amzn_qdeveloper_streaming_client:: types:: MeteringEvent { usage, .. } ,
702+ ) => ChatResponseStream :: MeteringEvent { usage } ,
668703 amzn_qdeveloper_streaming_client:: types:: ChatResponseStream :: ToolUseEvent (
669704 amzn_qdeveloper_streaming_client:: types:: ToolUseEvent {
670705 tool_use_id,
@@ -682,7 +717,7 @@ impl From<amzn_qdeveloper_streaming_client::types::ChatResponseStream> for ChatR
682717 amzn_qdeveloper_streaming_client:: types:: ChatResponseStream :: SupplementaryWebLinksEvent ( _) => {
683718 ChatResponseStream :: SupplementaryWebLinksEvent ( ( ) )
684719 } ,
685- _ => ChatResponseStream :: Unknown ,
720+ _other => ChatResponseStream :: Unknown ,
686721 }
687722 }
688723}
@@ -870,7 +905,8 @@ impl From<UserInputMessage> for amzn_codewhisperer_streaming_client::types::User
870905 . set_user_input_message_context ( value. user_input_message_context . map ( Into :: into) )
871906 . set_user_intent ( value. user_intent . map ( Into :: into) )
872907 . set_model_id ( value. model_id )
873- . origin ( amzn_codewhisperer_streaming_client:: types:: Origin :: Cli )
908+ //TODO: Setup new origin.
909+ . origin ( amzn_codewhisperer_streaming_client:: types:: Origin :: AiEditor )
874910 . build ( )
875911 . expect ( "Failed to build UserInputMessage" )
876912 }
@@ -884,7 +920,8 @@ impl From<UserInputMessage> for amzn_qdeveloper_streaming_client::types::UserInp
884920 . set_user_input_message_context ( value. user_input_message_context . map ( Into :: into) )
885921 . set_user_intent ( value. user_intent . map ( Into :: into) )
886922 . set_model_id ( value. model_id )
887- . origin ( amzn_qdeveloper_streaming_client:: types:: Origin :: Cli )
923+ //TODO: Setup new origin.
924+ . origin ( amzn_qdeveloper_streaming_client:: types:: Origin :: AiEditor )
888925 . build ( )
889926 . expect ( "Failed to build UserInputMessage" )
890927 }
0 commit comments