Skip to content

Commit

Permalink
fix token estimate issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Apr 2, 2024
1 parent 54169d6 commit a7208ae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function estimateChatTokens(
)
.join("\n"),
}))
.filter(({ content }) => !!content?.length)
const chatTokens = encodeChat(chat, model as any)
return chatTokens.length | 0
} catch (e) {
Expand Down

0 comments on commit a7208ae

Please sign in to comment.