From 8e9f7a53863879b2ad618e9e5707b198e4f3b135 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Wed, 24 Jul 2024 19:16:11 +0100 Subject: [PATCH] feat: mark Function trait as Send (#12) Allow to use Client in places that are also Send. --- src/v1/tool.rs | 2 +- tests/v1_tool_test.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/v1_tool_test.rs diff --git a/src/v1/tool.rs b/src/v1/tool.rs index 1e07e77..9612182 100644 --- a/src/v1/tool.rs +++ b/src/v1/tool.rs @@ -133,7 +133,7 @@ pub enum ToolChoice { // Custom #[async_trait] -pub trait Function { +pub trait Function: Send { async fn execute(&self, arguments: String) -> Box; } diff --git a/tests/v1_tool_test.rs b/tests/v1_tool_test.rs new file mode 100644 index 0000000..00e76bf --- /dev/null +++ b/tests/v1_tool_test.rs @@ -0,0 +1,7 @@ +use mistralai_client::v1::client::Client; + +trait _Trait: Send {} +struct _Foo { + _dummy: Client, +} +impl _Trait for _Foo {}