From 2fc0642a5e4c024b15710acaab7735480e8dfe6a Mon Sep 17 00:00:00 2001 From: Xavier Gillard Date: Fri, 7 Jun 2024 16:49:55 +0200 Subject: [PATCH] feat(chat): add the 'system' and 'tool' message roles (#10) * add the 'system' and 'tool' message roles (see: https://docs.mistral.ai/capabilities/completion/ ) * docs(chat): add offical doc link in ChatMessageRole * ci(github): listen to pull_request event in Test workflow --------- Co-authored-by: Ivan Gabriele --- .github/workflows/test.yml | 4 +++- src/v1/chat.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbf9ea1..ba0f13f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ name: Test -on: push +on: + pull_request: + push: jobs: test: diff --git a/src/v1/chat.rs b/src/v1/chat.rs index 455303e..2ce252a 100644 --- a/src/v1/chat.rs +++ b/src/v1/chat.rs @@ -30,12 +30,17 @@ impl ChatMessage { } } +/// See the [Mistral AI API documentation](https://docs.mistral.ai/capabilities/completion/#chat-messages) for more information. #[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] pub enum ChatMessageRole { + #[serde(rename = "system")] + System, #[serde(rename = "assistant")] Assistant, #[serde(rename = "user")] User, + #[serde(rename = "tool")] + Tool, } /// The format that the model must output.