Skip to content

Commit e965694

Browse files
sayanshaw24Sayan Shaw
andauthored
Update Chat Template Examples for Tools API change (microsoft#1506)
Updates examples broken by microsoft#1472. Note: only C and C# examples are updated. Python examples need no updating as `tools` is an optional input with a default value in the Python API. Co-authored-by: Sayan Shaw <[email protected]>
1 parent 5f7fc49 commit e965694

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/c/src/phi3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void CXX_API(const char* model_path, const char* execution_provider) {
5555
break; // Exit the loop
5656
}
5757

58-
const std::string prompt = tokenizer->ApplyChatTemplate("", text.c_str(), true);
58+
const std::string prompt = tokenizer->ApplyChatTemplate("", text.c_str(), "", true);
5959

6060
bool is_first_token = true;
6161
Timing timing;

examples/c/src/phi3_qa.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void CXX_API(const char* model_path, const char* execution_provider) {
4545
break; // Exit the loop
4646
}
4747

48-
const std::string prompt = tokenizer->ApplyChatTemplate("", text.c_str(), true);
48+
const std::string prompt = tokenizer->ApplyChatTemplate("", text.c_str(), "", true);
4949

5050
bool is_first_token = true;
5151
Timing timing;

examples/csharp/HelloPhi/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static string GetPrompt(bool interactive)
116116
{
117117
break;
118118
}
119-
var sequences = tokenizer.Encode(tokenizer.ApplyChatTemplate("", prompt, true));
119+
var sequences = tokenizer.Encode(tokenizer.ApplyChatTemplate("", prompt, "", true));
120120

121121
if (option == 1) // Complete Output
122122
{
@@ -183,7 +183,7 @@ static string GetPrompt(bool interactive)
183183
{
184184
break;
185185
}
186-
var sequences = tokenizer.Encode(tokenizer.ApplyChatTemplate("", prompt, true));
186+
var sequences = tokenizer.Encode(tokenizer.ApplyChatTemplate("", prompt, "", true));
187187
var watch = System.Diagnostics.Stopwatch.StartNew();
188188
generator.AppendTokenSequences(sequences);
189189
while (!generator.IsDone())

0 commit comments

Comments
 (0)