gpt-tokenizer
gpt-tokenizer copied to clipboard
ChatMessage[] TypeScript warning
I tried to follow sample usage, but the line encodeChat(messages)
is returning this warning in VS Code:
[{
...
"message": "Argument of type '{ role: string; content: string; }[]' is not assignable to parameter of type 'readonly ChatMessage[]'.\n Type '{ role: string; content: string; }' is not assignable to type 'ChatMessage'.\n Types of property 'role' are incompatible.\n Type 'string' is not assignable to type '\"system\" | \"user\" | \"assistant\" | undefined'.",
...
}]
How do I make this work without TypeScript warnings?