Users cannot define a variable of type ChatCompletionMessageParam without causing a TypeScript type error, even when the variable has valid fields according to this type.
Steps to Reproduce
Copy and paste the following into a file:
import { ChatCompletionMessageParam, TokenJS } from './index'
// Create the Token.js client
const tokenjs = new TokenJS()
const main = async () => {
const messages: ChatCompletionMessageParam = [
{
role: 'user',
content: 'Hello!',
},
]
// Create a model response
const completion = await tokenjs.chat.completions.create({
// Specify the provider and model
provider: 'openai',
model: 'gpt-4o',
// Define your message
messages,
})
console.log(completion.choices[0])
}
main()
Expected Result
No type error should occur for the messages variable
Problem
Users cannot define a variable of type
ChatCompletionMessageParam
without causing a TypeScript type error, even when the variable has valid fields according to this type.Steps to Reproduce
Copy and paste the following into a file:
Expected Result
No type error should occur for the
messages
variableActual Result