Skip to content

Commit

Permalink
Fix null check condition in OrtxApplyChatTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbingl authored Mar 6, 2025
1 parent 4b485fb commit 34260ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shared/api/c_api_tokenizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ extError_t ORTX_API_CALL OrtxDetokenizeCached(const OrtxTokenizer* tokenizer, Or
extError_t ORTX_API_CALL OrtxApplyChatTemplate(const OrtxTokenizer* tokenizer, const char* template_str,
const char* input, OrtxStringArray** output,
bool add_generation_prompt) {
if (tokenizer == nullptr || output == nullptr) {
if (tokenizer == nullptr && template_str == nullptr) {
ReturnableStatus::last_error_message_ = "both tokenizer and template_str are null, no template to apply";
return kOrtxErrorInvalidArgument;
}
Expand Down

0 comments on commit 34260ac

Please sign in to comment.