Open vineel opened 3 weeks ago
Hey 👋 Thanks for reporting this issue could you tell us which version of the SDKs your are using?
Sure. From my package-lock.json...
"@mistralai/mistralai": "^1.1.0",
For now I'm using a workaround "any" type. From my sample above:
const msg: UserMessage = {
content: "Who is the best French painter? Answer in one short sentence.",
role: "user",
};
let messageArr: any = [msg];
let myval: ChatCompletionStreamRequest = {
model: "mistral-small-latest",
messages: messageArr
};
const result = await mistral.chat.stream(myval);
Hello! I haven't been able to navigate the type constraints around using mistral.chat.stream . The example in the docs works with 1 message specified in a literal, but when trying to use multiple messages, inputted by the user, in a multi-statement chat... I just can't figure out the types. I have looked at the source/type defs and it seems so complex that I feel I must be missing something simple. Is there an example anywhere that shows how to use it?
For example, this is a very simple extrapolation of the given sample:
But Typescript complains...
In my app, I need to retrieve a chat from the db, add the latest prompt, and stream an answer back to the browser. I was able to get it working in the old JS client, but I ran into some fetch compatibility problems, so I'm trying to upgrade to the TS client.
Thank you!