Cannot use name
field in Chat Completion messages (CoreMessage, LanguageModelV1Message)
#2198
Labels
name
field in Chat Completion messages (CoreMessage, LanguageModelV1Message)
#2198
Description
In the previous
Message
type, it was possible to set bothrole
andname
fields. Thename
field was erroneously removed, though it serves an important function in identifying multiple users, or assistant messages from different contexts. The tokenizers for chat and instruction tuned models may contain a special token for the separator between a role and the name.For our use case, we use the "name" field to label messages from the assistant that contain guardrails. We then prompt the model - obviously this is not 100% reliable, but it is at least somewhat effective - to not reveal these messages. We also use the
name
field to label assistant messages that may be the result of other agents.This change has broken compatibility with previous versions of the AI SDK.
Related: most OpenAI models (since GPT-3.5-0613) will tokenize both the role and name, though the exact format is not specified. Many other models accept arbitrary "role" fields, though instruct/chat tuning may strongly benefit from certain roles being used, or roles that contain the token for
system
,assistant
, oruser
, such as "user (Friel)" or "user-friel".Code example
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: