Skip to content

Conversation

@lgrammel
Copy link
Collaborator

@lgrammel lgrammel commented May 2, 2025

Background

The name CoreMessage was an artifact of needed to introduce a separate message type. Over time it became clear that we have threee distinct message types:

  • messages used on the client that are displayed to the user (UIMessage)
  • messages that are sent to our user-facing APIs (currently CoreMessage)
  • messages that are sent to the providers (LanguageModelV2Message)

They all have distinct DX considerations and are different by design.

The name CoreMessage is not clear here.

Summary

Rename CoreMessage to ModelMessage to make the distinction UIMessage <> ModelMessage clear (most users are not exposed to internal provider messages).

Future Work

CoreMessages and related types and functions are deprecated and will be removed in AI SDK 6

@lgrammel lgrammel self-assigned this May 2, 2025
@lgrammel lgrammel changed the title Lg/7 sb7axf d chore (ai): rename CoreMessage to ModelMessage May 2, 2025
@lgrammel lgrammel marked this pull request as ready for review May 2, 2025 08:52
@lgrammel lgrammel merged commit 92cb0a2 into v5 May 2, 2025
8 checks passed
@lgrammel lgrammel deleted the lg/7SB7axfD branch May 2, 2025 09:05
samdenty added a commit that referenced this pull request May 2, 2025
* origin/v5:
  fix(providers/openai): logprobs for stream alongside completion model (#6091)
  chore (ai): move maxSteps into UseChatOptions (#6113)
  docs (ai): add notes on schema .optional() (#6111)
  chore: update references to use ai-sdk.dev (#6076) (#6107)
  Version Packages (canary) (#6069)
  chore (provider-utils): rename TestServerCall.requestBody to requestBodyJson (#6106)
  chore (ai): rename CoreMessage to ModelMessage (#6105)
  feat (ai): add filename to file ui parts (#6104)
  feat (docs): add Dify community provider (#4084) (#6067) (#6103)
  feat (docs): add Sarvam community provider (#6079) (#6096)
  fix(providers/openai): zod parse error with function (#6074) (#6095)
  feat(docs): add Weave observability provider (#6029) (#6094)
  core (ai/mcp): update experimental MCP client documentation for Streamable HTTP transport usage (#5972) (#6093)
  fix (docs): update formatting in useChat reference docs  (#6100)
  chore (ai): replace useChat attachments with file ui parts (#6071)
  feat (ui/react): support resuming an ongoing stream (#6053)
  test (openai): update snapshot (#6086)
samdenty added a commit that referenced this pull request May 2, 2025
…call

* origin/v5: (43 commits)
  chore (provider-utils): return IdGenerator interface (#6118)
  chore (provider): improve jsdoc comments (#6117)
  chore (ai): remove outdated typecasts (#6116)
  chore (ai): remove useChat keepLastMessageOnError (#6114)
  fix(providers/openai): logprobs for stream alongside completion model (#6091)
  chore (ai): move maxSteps into UseChatOptions (#6113)
  docs (ai): add notes on schema .optional() (#6111)
  chore: update references to use ai-sdk.dev (#6076) (#6107)
  Version Packages (canary) (#6069)
  chore (provider-utils): rename TestServerCall.requestBody to requestBodyJson (#6106)
  chore (ai): rename CoreMessage to ModelMessage (#6105)
  feat (ai): add filename to file ui parts (#6104)
  feat (docs): add Dify community provider (#4084) (#6067) (#6103)
  feat (docs): add Sarvam community provider (#6079) (#6096)
  fix(providers/openai): zod parse error with function (#6074) (#6095)
  feat(docs): add Weave observability provider (#6029) (#6094)
  core (ai/mcp): update experimental MCP client documentation for Streamable HTTP transport usage (#5972) (#6093)
  fix (docs): update formatting in useChat reference docs  (#6100)
  chore (ai): replace useChat attachments with file ui parts (#6071)
  feat (ui/react): support resuming an ongoing stream (#6053)
  ...
iteratetograceness pushed a commit to iteratetograceness/ai that referenced this pull request May 9, 2025
## Background

The name `CoreMessage` was an artifact of needed to introduce a separate
message type. Over time it became clear that we have threee distinct
message types:

- messages used on the client that are displayed to the user
(`UIMessage`)
- messages that are sent to our user-facing APIs (currently
`CoreMessage`)
- messages that are sent to the providers (`LanguageModelV2Message`)

They all have distinct DX considerations and are different by design.

The name `CoreMessage` is not clear here.

## Summary

Rename `CoreMessage` to `ModelMessage` to make the distinction
`UIMessage <> ModelMessage` clear (most users are not exposed to
internal provider messages).

## Future Work
`CoreMessages` and related types and functions are deprecated and will
be removed in AI SDK 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants