11use amzn_codewhisperer_client:: operation:: generate_completions:: GenerateCompletionsError ;
22use amzn_codewhisperer_client:: operation:: list_available_customizations:: ListAvailableCustomizationsError ;
3- use amzn_codewhisperer_streaming_client:: operation:: generate_assistant_response:: GenerateAssistantResponseError ;
3+ pub use amzn_codewhisperer_streaming_client:: operation:: generate_assistant_response:: GenerateAssistantResponseError ;
44// use amzn_codewhisperer_streaming_client::operation::send_message::SendMessageError as
55// CodewhispererSendMessageError;
66use amzn_codewhisperer_streaming_client:: types:: error:: ChatResponseStreamError as CodewhispererChatResponseStreamError ;
@@ -10,7 +10,7 @@ use amzn_qdeveloper_streaming_client::operation::send_message::SendMessageError
1010use amzn_qdeveloper_streaming_client:: types:: error:: ChatResponseStreamError as QDeveloperChatResponseStreamError ;
1111use aws_credential_types:: provider:: error:: CredentialsError ;
1212use aws_smithy_runtime_api:: client:: orchestrator:: HttpResponse ;
13- use aws_smithy_runtime_api:: client:: result:: SdkError ;
13+ pub use aws_smithy_runtime_api:: client:: result:: SdkError ;
1414use aws_smithy_types:: event_stream:: RawMessage ;
1515use fig_aws_common:: SdkErrorDisplay ;
1616use thiserror:: Error ;
@@ -48,6 +48,14 @@ pub enum Error {
4848 #[ error( "quota has reached its limit" ) ]
4949 QuotaBreach ( & ' static str ) ,
5050
51+ /// Returned from the backend when the user input is too large to fit within the model context
52+ /// window.
53+ ///
54+ /// Note that we currently do not receive token usage information regarding how large the
55+ /// context window is.
56+ #[ error( "the context window has overflowed" ) ]
57+ ContextWindowOverflow ,
58+
5159 #[ error( transparent) ]
5260 SmithyBuild ( #[ from] aws_smithy_types:: error:: operation:: BuildError ) ,
5361
@@ -71,6 +79,7 @@ impl Error {
7179 | Error :: QDeveloperChatResponseStream ( _)
7280 | Error :: SmithyBuild ( _)
7381 | Error :: UnsupportedConsolas ( _)
82+ | Error :: ContextWindowOverflow
7483 | Error :: QuotaBreach ( _) => false ,
7584 }
7685 }
@@ -84,6 +93,7 @@ impl Error {
8493 Error :: ListAvailableServices ( e) => e. as_service_error ( ) . is_some ( ) ,
8594 Error :: CodewhispererGenerateAssistantResponse ( e) => e. as_service_error ( ) . is_some ( ) ,
8695 Error :: QDeveloperSendMessage ( e) => e. as_service_error ( ) . is_some ( ) ,
96+ Error :: ContextWindowOverflow => true ,
8797 Error :: CodewhispererChatResponseStream ( _)
8898 | Error :: QDeveloperChatResponseStream ( _)
8999 | Error :: SmithyBuild ( _)
0 commit comments