Repository navigation
Build on WASI - #370
Draft
mergesort wants to merge 2 commits into
Draft
Build on WASI#370mergesort wants to merge 2 commits into
mergesort wants to merge 2 commits into
Conversation
Collaborator
|
Thanks, @mergesort. A runtime error works for me. The message says exactly what to do, and a compile-time check would need a WASI-only variant of each remote model's init. Yes, please add a WASI build job here, so that we find out when something breaks the build. |
WASI has no URLSession, so leave out the URLSession transport and the HTTPTypesFoundation dependency there. A remote model on WASI needs its transport given, such as one that sends requests with the host's fetch; the default throws, saying so. Depends on EventSource building on WASI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Added the WASI CI target, thanks a lot! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey @mattt, this is the companion to the EventSource PR, where I mentioned I'd be putting up a PR to add WASI support. As noted, my goal is to run Swift with full Foundation on Cloudflare Workers, and to be able to use AnyLanguageModel as an AI proxy in the process.
Since WASI doesn't have sockets, Foundation there doesn't have URLSession, which is the only thing preventing AnyLanguageModel from building on WASI. The good thing is that you already have support for
HTTPTransport, so the changes here are very minor, and using it looks like this:(
FetchTransportis a small transport in my project that calls the Worker'sfetch.)Everything is conditional on WASI, so nothing should change on any other platform.
Just a few thoughts/open questions:
transport:required on WASI it would become a compile-time matter, but that would mean a WASI-specific init signature for every remote model, so I started with a smaller change. Happy to switch if you'd prefer, but I don't think it's worth a bigger change.wasi-supportbranches here and here.Thanks again, really appreciate the work you've done with AnyLanguageModel!