Closed danny-avila closed 5 months ago
seems like the loop for handling events from chatStream seems to be based on specific event types like text-generation and stream-end...it's possible that the SDK is emitting different event types, there is also this comment in ChatRequest.ts fwiw:, just an observation
The chat_history parameter should not be used for SYSTEM
messages in most cases. Instead, to add a SYSTEM
role message at the beginning of a conversation, the preamble
parameter should be used.
*
Thanks for your reply!
The chat_history parameter should not be used for
SYSTEM
messages in most cases. Instead, to add aSYSTEM
role message at the beginning of a conversation, thepreamble
parameter should be used. *
I think there should be flexibility with this. I understand the use case for preamble
and I like it, but the user should decide where they want system messages to test how it affects the model. This is implied by having the option; otherwise, we should not have this option at all.
But in any case I figured out the issue. the SDK is expecting camel-case parameters. A closer look at the ChatStreamRequest
type reveals this, sorry I missed this. chatHistory
works, chat_history
does not.
I recommend allowing aliases to avoid any confusion here.
Hey @danny-avila glad you fixed it. This is tripping a lot of people up! Will hopefully have runtime checking soon to prevent this issue. I also recommend you use typescript which will warn you about it. Thanks!
Version: ^7.9.1
Using cURL, it works. I built the messages while working with the
cohere-ai
SDKI get the reply:
The exact same payload with SDK:
the reply is
So this must be an SDK issue and not API