mistralai / client-python

Python client library for Mistral AI platform
Apache License 2.0
485 stars 106 forks source link

Updating Migration file by using the new changes #130

Open arcAman07 opened 3 months ago

arcAman07 commented 3 months ago

The ChatMessage class has been replaced with a more flexible system. You can now use the SystemMessage, UserMessage, AssistantMessage, and ToolMessage classes to create messages. In the migration file, the UserMessage file was imported but not being used to show the users on how to use this new revamped class, how it differs from the previously used ChatMessage and in it's use cases in the below examples. This will help the users transition after the new updates to mistralai python client.

GaspardBT commented 3 months ago

Thanks for your feed back, I included them in #131, which keep both options Also If you are using any of the new message classes you don't need to specify the role attribute, like:

UserMessage(role="user", content="What is the best French cheese?") -> UserMessage(content="What is the best French cheese?")
arcAman07 commented 3 months ago

Thanks for your feed back, I included them in #131, which keep both options Also If you are using any of the new message classes you don't need to specify the role attribute, like:

UserMessage(role="user", content="What is the best French cheese?") -> UserMessage(content="What is the best French cheese?")

Hey, I did see we can remove the 'role' attribute as it not required but is an Optional argument as these new classes were introduced. To maintain the consistency in the documentation with respect to the previous ChatMessage class , I decided to keep the role attribute as it is. This will help the new users to differentiate between the two functions and discuss their use cases which will help them realise the need for the migration from the ChatMessage class. I just felt this will make developer onboarding smoother when going through the docs for the updated migration.