Hey @mattt, thanks so much for this great library! It really solves a problem that I've had across a few of my apps, and the API is terrific.
I was excited to try out the library but ran into an issue pretty quickly with a brand new project. The example Weather Tool doesn't compile in a new Xcode project that has Main Actor set for it's default isolation.
import AnyLanguageModel
struct WeatherTool: Tool {
let name = "getWeather"
let description = "Retrieve the latest weather information for a city"
@Generable
struct Arguments {
@Guide(description: "The city to fetch the weather for")
var city: String
}
func call(arguments: Arguments) async throws -> String {
"The weather in \(arguments.city) is sunny and 72°F / 23°C"
}
}
It's pretty easy to reproduce, all you have to do is paste that into a fresh Xcode project you'll undoubtedly run into this error.
Main actor-isolated conformance of 'WeatherTool.Arguments' to 'ConvertibleToGeneratedContent' cannot satisfy conformance requirement for a 'Sendable' type parameter 'Self'
I'm actually not sure the best way to handle this in a way that's meant to be compatible with AnyLanguageModel. I can of course switch the project to nonisolated for the default actor isolation, but that's not a real long-term fix so I figured it was worth mentioning, to be addressed at the library-level (or with some guidance for how to best handle this).
Would appreciate your thoughts, and thanks again for great work!
Hey @mattt, thanks so much for this great library! It really solves a problem that I've had across a few of my apps, and the API is terrific.
I was excited to try out the library but ran into an issue pretty quickly with a brand new project. The example Weather Tool doesn't compile in a new Xcode project that has Main Actor set for it's default isolation.
It's pretty easy to reproduce, all you have to do is paste that into a fresh Xcode project you'll undoubtedly run into this error.
I'm actually not sure the best way to handle this in a way that's meant to be compatible with
AnyLanguageModel. I can of course switch the project tononisolatedfor the default actor isolation, but that's not a real long-term fix so I figured it was worth mentioning, to be addressed at the library-level (or with some guidance for how to best handle this).Would appreciate your thoughts, and thanks again for great work!