Skip to content

Xcode 26.2 build and ToolSpec concurrency issues #76

Description

@SpiraMira

Hi - Firstly, this is a great module, many thanks in advance. I hope to leverage its magic in my projects and hopefully contribute.

Background:

I was building a clone of your chat-ui-swift and ran into some AnyLanguageModel issues I don’t see mentioned in this repo. I am posting this related issue here since that repo doesn’t have an open Issues section.

Adding the local HuggingChatKit failed consistently (?), directly adding AnyLanguageModel-main succeeded, but with the following error in ‘convertToolToMLXSpec’: Type 'Any' does not conform to the 'Sendable’ protocol (see below).

    private func convertToolToMLXSpec(_ tool: any Tool) -> ToolSpec {
        // Convert AnyLanguageModel's GenerationSchema to JSON-compatible dictionary
        let parametersDict: [String: Any]

...
...
        return [
            "type": "function",
            "function": [                      <---- Type 'Any' does not conform to the 'Sendable' protocol
                "name": tool.name,
                "description": tool.description,
                "parameters": parametersDict,
            ],
        ]
  • Circumventing the Sendable issue below is easy enough with an “as! any Sendable” - but that’s pretty ugly. I have a better approach, but it involves snapshotting and transforming the dict to something totally Sendable across concurrency or module boundaries. (see below soon)

Thanks again, Patrice

Environment:
macOS 26.2
Xcode 26.2 17C52

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions