Skip to content

Commit d31115f

Browse files
committed
refactor(chat-completion): Update ChatCompletion to Mistral API version 0.0.2
BREAKING CHANGE: Large parts of ChatCompletionRequest were rewritten to support certain changes in the Mistral API. See MIGRATION.md for more information.
1 parent c9a4d3f commit d31115f

50 files changed

Lines changed: 2770 additions & 345 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,42 @@ jobs:
4747
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
4848

4949
steps:
50-
- name: Checkout repository
51-
uses: actions/checkout@v4
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
5252

53-
- uses: actions/setup-java@v1
54-
with:
55-
java-version: 17
53+
- uses: actions/setup-java@v1
54+
with:
55+
java-version: 17
5656

57-
# Initializes the CodeQL tools for scanning.
58-
- name: Initialize CodeQL
59-
uses: github/codeql-action/init@v3
60-
with:
61-
languages: ${{ matrix.language }}
62-
# If you wish to specify custom queries, you can do so here or in a config file.
63-
# By default, queries listed here will override any specified in a config file.
64-
# Prefix the list here with "+" to use these queries and those in the config file.
57+
# Initializes the CodeQL tools for scanning.
58+
- name: Initialize CodeQL
59+
uses: github/codeql-action/init@v3
60+
with:
61+
languages: ${{ matrix.language }}
62+
# If you wish to specify custom queries, you can do so here or in a config file.
63+
# By default, queries listed here will override any specified in a config file.
64+
# Prefix the list here with "+" to use these queries and those in the config file.
6565

66-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
67-
queries: security-extended
66+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
67+
queries: security-extended
6868

6969

70-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
71-
# If this step fails, then you should remove it and run the build manually (see below)
72-
- name: Autobuild
73-
uses: github/codeql-action/autobuild@v3
70+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
71+
# If this step fails, then you should remove it and run the build manually (see below)
72+
- name: Autobuild
73+
uses: github/codeql-action/autobuild@v3
7474

75-
# ℹ️ Command-line programs to run using the OS shell.
76-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
75+
# ℹ️ Command-line programs to run using the OS shell.
76+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
7777

78-
# If the Autobuild fails above, remove it and uncomment the following three lines.
79-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
78+
# If the Autobuild fails above, remove it and uncomment the following three lines.
79+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
8080

81-
# - run: |
82-
# echo "Run, Build Application using script"
83-
# ./location_of_script_within_repo/buildscript.sh
81+
# - run: |
82+
# echo "Run, Build Application using script"
83+
# ./location_of_script_within_repo/buildscript.sh
8484

85-
- name: Perform CodeQL Analysis
86-
uses: github/codeql-action/analyze@v3
87-
with:
88-
category: "/language:${{matrix.language}}"
85+
- name: Perform CodeQL Analysis
86+
uses: github/codeql-action/analyze@v3
87+
with:
88+
category: "/language:${{matrix.language}}"

CHANGELOG.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
# 1.1.0
1+
# 2.0.0
22

3+
- **BREAKING**: Major refactor of message handling for chat completions:
4+
- The `nl.dannyj.mistral.models.completion.Message` class has been removed.
5+
- Introduced `nl.dannyj.mistral.models.completion.message.ChatMessage` as an abstract base class for messages.
6+
- New concrete message classes: `SystemMessage`, `UserMessage`, `AssistantMessage`, `ToolMessage`.
7+
- Message content is now represented by `List<nl.dannyj.mistral.models.completion.content.ContentChunk>` (e.g., `TextChunk`, `ImageURLChunk`) to support multi-modal inputs.
8+
- `ChatCompletionRequest` now expects `List<ChatMessage>`.
9+
- Streaming: `DeltaChoice` now contains a `nl.dannyj.mistral.models.completion.message.DeltaMessage` object which holds the actual delta (`role`, `content`, `toolCalls`).
10+
- **BREAKING**: Changes to `nl.dannyj.mistral.models.completion.Choice`:
11+
- The `finishReason` field type changed from `String` to `nl.dannyj.mistral.models.completion.FinishReason` (enum).
12+
- The `logProbs` field has been removed.
13+
- **BREAKING**: `encodingFormat` field removed from `EmbeddingRequest` as it is no longer supported by the API.
14+
- **BREAKING**: The `nl.dannyj.mistral.models.model.ModelPermission` class has been removed.
15+
- **BREAKING**: Package changes for core classes:
16+
- `MessageChunk` moved to `nl.dannyj.mistral.models.completion.message.MessageChunk`.
17+
- `MessageRole` moved to `nl.dannyj.mistral.models.completion.message.MessageRole`.
18+
- Added support for function calling (tools).
19+
- Added `nl.dannyj.mistral.models.model.ModelCapabilities` to provide model capability information (e.g., `supportsVision()`, `supportsFunctionCalling()`).
20+
- Increased default read timeout to 120 seconds.
21+
- Made it easier to configure timeouts ([issue #7](https://github.com/Dannyj1/mistral-java-client/issues/7))
322
- Update jackson-databind from 2.16.1 to 2.18.3
423
- Update jakarta.validation-api from 3.1.0-M1 to 3.1.1
5-
- Update okio from 3.8.0 to 3.11.0
24+
- Update okio from 3.8.0 to 3.11.0

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

0 commit comments

Comments
 (0)