15
15
* limitations under the License.
16
16
*/
17
17
18
- import { Content , GenerateContentRequest , Part , VertexAIErrorCode } from '../types' ;
19
- import { VertexAIError } from '../errors' ;
18
+ import { Content , GenerateContentRequest , Part , AIErrorCode } from '../types' ;
19
+ import { AIError } from '../errors' ;
20
20
21
21
export function formatSystemInstruction ( input ?: string | Part | Content ) : Content | undefined {
22
22
if ( input == null ) {
@@ -32,7 +32,6 @@ export function formatSystemInstruction(input?: string | Part | Content): Conten
32
32
return input as Content ;
33
33
}
34
34
}
35
-
36
35
return undefined ;
37
36
}
38
37
@@ -76,15 +75,15 @@ function assignRoleToPartsAndValidateSendMessageRequest(parts: Part[]): Content
76
75
}
77
76
78
77
if ( hasUserContent && hasFunctionContent ) {
79
- throw new VertexAIError (
80
- VertexAIErrorCode . INVALID_CONTENT ,
78
+ throw new AIError (
79
+ AIErrorCode . INVALID_CONTENT ,
81
80
'Within a single message, FunctionResponse cannot be mixed with other type of Part in the request for sending chat message.' ,
82
81
) ;
83
82
}
84
83
85
84
if ( ! hasUserContent && ! hasFunctionContent ) {
86
- throw new VertexAIError (
87
- VertexAIErrorCode . INVALID_CONTENT ,
85
+ throw new AIError (
86
+ AIErrorCode . INVALID_CONTENT ,
88
87
'No Content is provided for sending chat message.' ,
89
88
) ;
90
89
}
0 commit comments