Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update deprecated toolInvocations to parts #5128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AbhishekManjunath98
Copy link

@AbhishekManjunath98 AbhishekManjunath98 commented Mar 11, 2025

Here’s an enhanced commit description with before and after sections in Markdown:

Refactor: Replace toolInvocations with parts in message rendering

Changes:

  • Replaced deprecated toolInvocations with parts in message rendering logic.
  • Ensured compatibility with the latest API from useChat.

Before:

<ScrollView style={{ flex: 1 }}>
  {messages.map(m => (
    <View key={m.id} style={{ marginVertical: 8 }}>
      <View>
        <Text style={{ fontWeight: 700 }}>{m.role}</Text>
        {m.toolInvocations ? (
          <Text>{JSON.stringify(m.toolInvocations, null, 2)}</Text>
        ) : (
          <Text>{m.content}</Text>
        )}
      </View>
    </View>
  ))}
</ScrollView>

After:

<ScrollView style={{ flex: 1 }}>
  {messages.map(m => (
    <View key={m.id} style={{ marginVertical: 8 }}>
      <View>
        <Text style={{ fontWeight: 700 }}>{m.role}</Text>
        {m.parts ? (
          <Text>{JSON.stringify(m.parts, null, 2)}</Text>
        ) : (
          <Text>{m.content}</Text>
        )}
      </View>
    </View>
  ))}
</ScrollView>

Why:

  • toolInvocations has been deprecated in favor of parts.
  • Aligns message rendering with the latest useChat API changes.

Impact:

  • Ensures compatibility with future updates.
  • Prevents breaking changes due to deprecated properties.

This keeps the commit message clear, structured, and easy to understand. 🚀

@lgrammel lgrammel changed the title updated docs from deprcated toolInvocations to parts docs: update deprecated toolInvocations to parts Mar 12, 2025
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.

1 participant