chore: update maintainer info and project metadata
- Change author to Sunbeam Studios - Remove GitHub-specific files (.github/, renovate, README.template) - Remove .env.example (replaced by .envrc workflow) - Replace Makefile with justfile - Update CHANGELOG with v1.0.0 fork notes - Update Cargo.toml homepage to sunbeam.pt
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
# This key is only used for development purposes.
|
|
||||||
# You'll only need one if you want to contribute to this library.
|
|
||||||
export MISTRAL_API_KEY=
|
|
||||||
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ""
|
|
||||||
labels: "bug"
|
|
||||||
assignees: ""
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
**Reproduction**
|
|
||||||
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
|
|
||||||
1. ...
|
|
||||||
2. ...
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Version**
|
|
||||||
|
|
||||||
If applicable, what version did you use?
|
|
||||||
|
|
||||||
**Environment**
|
|
||||||
|
|
||||||
If applicable, add relevant information about your config and environment here.
|
|
||||||
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest a new idea for the project.
|
|
||||||
title: ""
|
|
||||||
labels: "enhancement"
|
|
||||||
assignees: ""
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to some problems?**
|
|
||||||
|
|
||||||
- _Ex. I'm always frustrated when..._
|
|
||||||
|
|
||||||
**What are the solutions you'd like?**
|
|
||||||
|
|
||||||
- _Ex. A new option to..._
|
|
||||||
|
|
||||||
**Anything else?**
|
|
||||||
|
|
||||||
- ...
|
|
||||||
8
.github/pull_request_template.md
vendored
8
.github/pull_request_template.md
vendored
@@ -1,8 +0,0 @@
|
|||||||
## Description
|
|
||||||
|
|
||||||
A clear and concise description of what your pull request is about.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- [ ] I updated the documentation accordingly. Or I don't need to.
|
|
||||||
- [ ] I updated the tests accordingly. Or I don't need to.
|
|
||||||
3
.github/renovate.json
vendored
3
.github/renovate.json
vendored
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["github>ivangabriele/renovate-config"]
|
|
||||||
}
|
|
||||||
59
.github/workflows/test.yml
vendored
59
.github/workflows/test.yml
vendored
@@ -1,59 +0,0 @@
|
|||||||
name: Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: 1.76.0
|
|
||||||
- name: Install cargo-llvm-cov
|
|
||||||
uses: taiki-e/install-action@cargo-llvm-cov
|
|
||||||
- name: Run tests (with coverage)
|
|
||||||
run: cargo llvm-cov --lcov --output-path ./lcov.info
|
|
||||||
env:
|
|
||||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
|
||||||
- name: Upload tests coverage
|
|
||||||
uses: codecov/codecov-action@v4
|
|
||||||
with:
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ./lcov.info
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|
||||||
test_documentation:
|
|
||||||
name: Test Documentation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: 1.76.0
|
|
||||||
- name: Run documentation tests
|
|
||||||
run: make test-doc
|
|
||||||
env:
|
|
||||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
|
||||||
|
|
||||||
test_examples:
|
|
||||||
name: Test Examples
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: 1.76.0
|
|
||||||
- name: Run examples
|
|
||||||
run: make test-examples
|
|
||||||
env:
|
|
||||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
|
||||||
34
CHANGELOG.md
34
CHANGELOG.md
@@ -1,3 +1,37 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.0.0](https://src.sunbeam.pt/studio/mistralai-client-rs) (2026-03-20)
|
||||||
|
|
||||||
|
Forked from [ivangabriele/mistralai-client-rs](https://github.com/ivangabriele/mistralai-client-rs) v0.14.0 and updated to the latest Mistral AI API.
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* `Model` is now a string-based struct with constructor methods instead of a closed enum
|
||||||
|
* `EmbedModel` is removed — use `Model::mistral_embed()` instead
|
||||||
|
* `Tool::new()` parameters now accept `serde_json::Value` (JSON Schema) instead of limited enum types
|
||||||
|
* `ChatParams.temperature` is now `Option<f32>` instead of `f32`
|
||||||
|
* Stream delta `content` is now `Option<String>`
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add all current Mistral models (Large 3, Small 4, Medium 3.1, Magistral, Codestral, Devstral, Pixtral, Voxtral, Ministral)
|
||||||
|
* Add FIM (fill-in-the-middle) completions endpoint
|
||||||
|
* Add Files API (upload, list, get, delete, download URL)
|
||||||
|
* Add Fine-tuning jobs API (create, list, get, cancel, start)
|
||||||
|
* Add Batch jobs API (create, list, get, cancel)
|
||||||
|
* Add OCR endpoint (document text extraction)
|
||||||
|
* Add Audio transcription endpoint
|
||||||
|
* Add Moderations and Classifications endpoints
|
||||||
|
* Add Agent completions endpoint
|
||||||
|
* Add new chat fields: frequency_penalty, presence_penalty, stop, n, min_tokens, parallel_tool_calls, reasoning_effort, json_schema response format
|
||||||
|
* Add embedding fields: output_dimension, output_dtype
|
||||||
|
* Add tool call IDs and Required tool choice variant
|
||||||
|
* Add model get and delete endpoints
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Upstream Changelog (pre-fork)
|
||||||
|
|
||||||
## [0.14.0](https://github.com/ivangabriele/mistralai-client-rs/compare/v0.13.0...v) (2024-08-27)
|
## [0.14.0](https://github.com/ivangabriele/mistralai-client-rs/compare/v0.13.0...v) (2024-08-27)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.76.0"
|
rust-version = "1.76.0"
|
||||||
|
|
||||||
authors = ["Ivan Gabriele <ivan.gabriele@protonmail.com>"]
|
authors = ["Sunbeam Studios <hello@sunbeam.pt>"]
|
||||||
categories = ["api-bindings"]
|
categories = ["api-bindings"]
|
||||||
homepage = "https://src.sunbeam.pt/studio/mistralai-client-rs"
|
homepage = "https://sunbeam.pt"
|
||||||
keywords = ["mistral", "mistralai", "client", "api", "llm"]
|
keywords = ["mistral", "mistralai", "client", "api", "llm"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://src.sunbeam.pt/studio/mistralai-client-rs"
|
repository = "https://src.sunbeam.pt/studio/mistralai-client-rs"
|
||||||
|
|||||||
72
Makefile
72
Makefile
@@ -1,72 +0,0 @@
|
|||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
.PHONY: doc readme test
|
|
||||||
|
|
||||||
define source_env_if_not_ci
|
|
||||||
@if [ -z "$${CI}" ]; then \
|
|
||||||
if [ -f ./.env ]; then \
|
|
||||||
source ./.env; \
|
|
||||||
else \
|
|
||||||
echo "No .env file found"; \
|
|
||||||
exit 1; \
|
|
||||||
fi \
|
|
||||||
fi
|
|
||||||
endef
|
|
||||||
|
|
||||||
define RELEASE_TEMPLATE
|
|
||||||
npx conventional-changelog-cli -p conventionalcommits -i ./CHANGELOG.md -s
|
|
||||||
git add .
|
|
||||||
git commit -m "docs(changelog): update"
|
|
||||||
git push origin HEAD
|
|
||||||
cargo release $(1) --execute
|
|
||||||
git push origin HEAD --tags
|
|
||||||
endef
|
|
||||||
|
|
||||||
doc:
|
|
||||||
cargo doc
|
|
||||||
open ./target/doc/mistralai_client/index.html
|
|
||||||
|
|
||||||
readme:
|
|
||||||
@echo "Generating README.md from template..."
|
|
||||||
@> README.md # Clear README.md content before starting
|
|
||||||
@while IFS= read -r line || [[ -n "$$line" ]]; do \
|
|
||||||
if [[ $$line == *"<CODE>"* && $$line == *"</CODE>"* ]]; then \
|
|
||||||
example_path=$$(echo $$line | sed -n 's/.*<CODE>\(.*\)<\/CODE>.*/\1/p'); \
|
|
||||||
if [ -f $$example_path ]; then \
|
|
||||||
echo '```rs' >> README.md; \
|
|
||||||
cat $$example_path >> README.md; \
|
|
||||||
echo '```' >> README.md; \
|
|
||||||
else \
|
|
||||||
echo "Error: Example $$example_path not found." >&2; \
|
|
||||||
fi; \
|
|
||||||
else \
|
|
||||||
echo "$$line" >> README.md; \
|
|
||||||
fi; \
|
|
||||||
done < README.template.md
|
|
||||||
@echo "README.md has been generated."
|
|
||||||
|
|
||||||
release-patch:
|
|
||||||
$(call RELEASE_TEMPLATE,patch)
|
|
||||||
release-minor:
|
|
||||||
$(call RELEASE_TEMPLATE,minor)
|
|
||||||
release-major:
|
|
||||||
$(call RELEASE_TEMPLATE,major)
|
|
||||||
|
|
||||||
test:
|
|
||||||
@$(source_env_if_not_ci) && \
|
|
||||||
cargo test --no-fail-fast
|
|
||||||
test-cover:
|
|
||||||
@$(source_env_if_not_ci) && \
|
|
||||||
cargo llvm-cov
|
|
||||||
test-doc:
|
|
||||||
@$(source_env_if_not_ci) && \
|
|
||||||
cargo test --doc --no-fail-fast
|
|
||||||
test-examples:
|
|
||||||
@$(source_env_if_not_ci) && \
|
|
||||||
for example in $$(ls examples/*.rs | sed 's/examples\/\(.*\)\.rs/\1/'); do \
|
|
||||||
echo "Running $$example"; \
|
|
||||||
cargo run --example $$example; \
|
|
||||||
done
|
|
||||||
test-watch:
|
|
||||||
@source ./.env && \
|
|
||||||
cargo watch -x "test -- --nocapture"
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
# Mistral AI Rust Client
|
|
||||||
|
|
||||||
[](https://crates.io/crates/mistralai-client)
|
|
||||||
[](https://docs.rs/mistralai-client/latest/mistralai-client)
|
|
||||||
[](https://github.com/ivangabriele/mistralai-client-rs/actions?query=branch%3Amain+workflow%3ATest++)
|
|
||||||
[](https://app.codecov.io/github/ivangabriele/mistralai-client-rs)
|
|
||||||
|
|
||||||
Rust client for the Mistral AI API.
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
|
||||||
> While we are in v0, minor versions may introduce breaking changes.
|
|
||||||
> Please, refer to the [CHANGELOG.md](./CHANGELOG.md) for more information.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- [Supported APIs](#supported-apis)
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Mistral API Key](#mistral-api-key)
|
|
||||||
- [As an environment variable](#as-an-environment-variable)
|
|
||||||
- [As a client argument](#as-a-client-argument)
|
|
||||||
- [Usage](#usage)
|
|
||||||
- [Chat](#chat)
|
|
||||||
- [Chat (async)](#chat-async)
|
|
||||||
- [Chat with streaming (async)](#chat-with-streaming-async)
|
|
||||||
- [Chat with Function Calling](#chat-with-function-calling)
|
|
||||||
- [Chat with Function Calling (async)](#chat-with-function-calling-async)
|
|
||||||
- [Embeddings](#embeddings)
|
|
||||||
- [Embeddings (async)](#embeddings-async)
|
|
||||||
- [List models](#list-models)
|
|
||||||
- [List models (async)](#list-models-async)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Supported APIs
|
|
||||||
|
|
||||||
- [x] Chat without streaming
|
|
||||||
- [x] Chat without streaming (async)
|
|
||||||
- [x] Chat with streaming
|
|
||||||
- [x] Embedding
|
|
||||||
- [x] Embedding (async)
|
|
||||||
- [x] List models
|
|
||||||
- [x] List models (async)
|
|
||||||
- [x] Function Calling
|
|
||||||
- [x] Function Calling (async)
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
You can install the library in your project using:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo add mistralai-client
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mistral API Key
|
|
||||||
|
|
||||||
You can get your Mistral API Key there: <https://docs.mistral.ai/#api-access>.
|
|
||||||
|
|
||||||
#### As an environment variable
|
|
||||||
|
|
||||||
Just set the `MISTRAL_API_KEY` environment variable.
|
|
||||||
|
|
||||||
```rs
|
|
||||||
use mistralai_client::v1::client::Client;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let client = Client::new(None, None, None, None);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
MISTRAL_API_KEY=your_api_key cargo run
|
|
||||||
```
|
|
||||||
|
|
||||||
#### As a client argument
|
|
||||||
|
|
||||||
```rs
|
|
||||||
use mistralai_client::v1::client::Client;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let api_key = "your_api_key";
|
|
||||||
|
|
||||||
let client = Client::new(Some(api_key), None, None, None).unwrap();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Chat
|
|
||||||
|
|
||||||
<CODE>examples/chat.rs</CODE>
|
|
||||||
|
|
||||||
### Chat (async)
|
|
||||||
|
|
||||||
<CODE>examples/chat_async.rs</CODE>
|
|
||||||
|
|
||||||
### Chat with streaming (async)
|
|
||||||
|
|
||||||
<CODE>examples/chat_with_streaming.rs</CODE>
|
|
||||||
|
|
||||||
### Chat with Function Calling
|
|
||||||
|
|
||||||
<CODE>examples/chat_with_function_calling.rs</CODE>
|
|
||||||
|
|
||||||
### Chat with Function Calling (async)
|
|
||||||
|
|
||||||
<CODE>examples/chat_with_function_calling_async.rs</CODE>
|
|
||||||
|
|
||||||
### Embeddings
|
|
||||||
|
|
||||||
<CODE>examples/embeddings.rs</CODE>
|
|
||||||
|
|
||||||
### Embeddings (async)
|
|
||||||
|
|
||||||
<CODE>examples/embeddings_async.rs</CODE>
|
|
||||||
|
|
||||||
### List models
|
|
||||||
|
|
||||||
<CODE>examples/list_models.rs</CODE>
|
|
||||||
|
|
||||||
### List models (async)
|
|
||||||
|
|
||||||
<CODE>examples/list_models_async.rs</CODE>
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to contribute to this library.
|
|
||||||
27
justfile
Normal file
27
justfile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
check:
|
||||||
|
cargo check --all-targets
|
||||||
|
|
||||||
|
doc:
|
||||||
|
cargo doc --open
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
cargo fmt
|
||||||
|
|
||||||
|
lint:
|
||||||
|
cargo clippy --all-targets
|
||||||
|
|
||||||
|
publish:
|
||||||
|
cargo publish --registry sunbeam
|
||||||
|
|
||||||
|
test:
|
||||||
|
cargo test --no-fail-fast
|
||||||
|
|
||||||
|
test-cover:
|
||||||
|
cargo llvm-cov
|
||||||
|
|
||||||
|
test-examples:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
for example in $(ls examples/*.rs | sed 's/examples\/\(.*\)\.rs/\1/'); do
|
||||||
|
echo "Running $example"
|
||||||
|
cargo run --example "$example"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user