Skip to content

Commit

Permalink
simplify tokenizer creation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Dec 9, 2024
1 parent 5483024 commit b00c2ca
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/BE/Services/Conversations/ConversationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@ public abstract partial class ConversationService : IDisposable
public ConversationService(Model model)
{
Model = model;
try
if (model.ModelReference.Tokenizer is not null)
{
if (model.ModelReference.Tokenizer is not null)
{
Tokenizer = TiktokenTokenizer.CreateForEncoding(model.ModelReference.Tokenizer.Name);
}
else
{
Tokenizer = TiktokenTokenizer.CreateForModel(Model.ModelReference.Name);
}
Tokenizer = TiktokenTokenizer.CreateForEncoding(model.ModelReference.Tokenizer.Name);
}
catch (NotSupportedException)
else
{
Tokenizer = TiktokenTokenizer.CreateForEncoding("cl100k_base");
}
Expand Down

0 comments on commit b00c2ca

Please sign in to comment.