Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67aa5bbaef | ||
|
|
415fd98167 | ||
|
|
8e9f7a5386 | ||
|
|
3afeec1d58 |
@@ -1,3 +1,9 @@
|
|||||||
|
## [0.12.0](https://github.com/ivangabriele/mistralai-client-rs/compare/v0.11.0...v) (2024-07-24)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* implement the Debug trait for Client ([#11](https://github.com/ivangabriele/mistralai-client-rs/issues/11)) ([3afeec1](https://github.com/ivangabriele/mistralai-client-rs/commit/3afeec1d586022e43c7b10906acec5e65927ba7d))
|
||||||
|
* mark Function trait as Send ([#12](https://github.com/ivangabriele/mistralai-client-rs/issues/12)) ([8e9f7a5](https://github.com/ivangabriele/mistralai-client-rs/commit/8e9f7a53863879b2ad618e9e5707b198e4f3b135))
|
||||||
## [0.11.0](https://github.com/ivangabriele/mistralai-client-rs/compare/v0.10.0...v) (2024-06-22)
|
## [0.11.0](https://github.com/ivangabriele/mistralai-client-rs/compare/v0.10.0...v) (2024-06-22)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
name = "mistralai-client"
|
name = "mistralai-client"
|
||||||
description = "Mistral AI API client library for Rust (unofficial)."
|
description = "Mistral AI API client library for Rust (unofficial)."
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
version = "0.11.0"
|
version = "0.12.0"
|
||||||
|
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.76.0"
|
rust-version = "1.76.0"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use std::{
|
|||||||
|
|
||||||
use crate::v1::{chat, chat_stream, constants, embedding, error, model_list, tool, utils};
|
use crate::v1::{chat, chat_stream, constants, embedding, error, model_list, tool, utils};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
pub api_key: String,
|
pub api_key: String,
|
||||||
pub endpoint: String,
|
pub endpoint: String,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{any::Any, collections::HashMap};
|
use std::{any::Any, collections::HashMap, fmt::Debug};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Definitions
|
// Definitions
|
||||||
@@ -133,6 +133,12 @@ pub enum ToolChoice {
|
|||||||
// Custom
|
// Custom
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait Function {
|
pub trait Function: Send {
|
||||||
async fn execute(&self, arguments: String) -> Box<dyn Any + Send>;
|
async fn execute(&self, arguments: String) -> Box<dyn Any + Send>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Debug for dyn Function {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "Function()")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
use jrest::expect;
|
use jrest::expect;
|
||||||
use mistralai_client::v1::{client::Client, error::ClientError};
|
use mistralai_client::v1::{client::Client, error::ClientError};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct _Foo {
|
||||||
|
_client: Client,
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_client_new_with_none_params() {
|
fn test_client_new_with_none_params() {
|
||||||
let maybe_original_mistral_api_key = std::env::var("MISTRAL_API_KEY").ok();
|
let maybe_original_mistral_api_key = std::env::var("MISTRAL_API_KEY").ok();
|
||||||
|
|||||||
7
tests/v1_tool_test.rs
Normal file
7
tests/v1_tool_test.rs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
use mistralai_client::v1::client::Client;
|
||||||
|
|
||||||
|
trait _Trait: Send {}
|
||||||
|
struct _Foo {
|
||||||
|
_dummy: Client,
|
||||||
|
}
|
||||||
|
impl _Trait for _Foo {}
|
||||||
Reference in New Issue
Block a user