Skip to content

Tool::call future requires Sync #291

@insprac

Description

@insprac

Overview

Currently the future returned by Tool::call requires Sync:

pub trait Tool: Send + Sync {
    fn call(
        &mut self,
        parameters: Self::Params,
    ) -> impl Future<Output = Result<String>> + Send + Sync;
}

https://docs.rs/ollama-rs/latest/ollama_rs/generation/tools/trait.Tool.html

Does this future actually need to be Sync or can it just be Send?

Cause of issue

Using bollard::Docker::start_exec I get a stream with the type Pin<Box<dyn Stream<Item = Result<LogOutput, Error>> + Send>>
Because this type is not Sync I can't call it from a Tool implementation without jumping through hoops.

https://docs.rs/bollard/0.19.4/bollard/exec/enum.StartExecResults.html#variant.Attached.field.output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions