Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverside / Linux support #89

Open
mfreiwald opened this issue Oct 1, 2024 · 5 comments
Open

Serverside / Linux support #89

mfreiwald opened this issue Oct 1, 2024 · 5 comments

Comments

@mfreiwald
Copy link
Contributor

Any plans to make this buildable on Linux?
Since its better to not put your API-keys on the client I want to use this on my swift server project.

I created a fork and replaced URLSession by HTTPClient from async-http-client
but it's not fully tested yet and I have no idea yet what is the best approach to make it available for URLSession AND HTTPClient.

@jamesrochabrun
Copy link
Owner

Not plans at the moment, open for collaborations!

@jamesrochabrun jamesrochabrun closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
@mergesort
Copy link

I was just doing a comparison of OpenAI-compatible packages to integrate into my Vapor app, and came across this project. I've already integrated it into a local tool and think you've got a great API surface, I quite prefer it the ergonomics of this library to the MacPaw OpenAI library. Is there any chance you'd reconsider adding Linux support?

I've helped add Linux networking support to other projects before, and it's not particularly difficult to maintain, after the initial work is done you can automate the process of making sure things still work by building on Linux in a Github Action.

@jamesrochabrun
Copy link
Owner

Thanks for the interest, I am trying to get the issues as minimum while trying to handle other responsibilities 🙏

But lets see how we can move forward here.

@mfreiwald is it correct to say that this is all we need? main...mfreiwald:SwiftOpenAI:serverside

Why do we need to remove Sources/OpenAI/AIProxy/AIProxyCertificatePinning.swift

I will like to add more functionality but without sacrificing existing one, please let me know your thoughts, thanks.

@mfreiwald
Copy link
Contributor Author

No, my solution replaces URLSession completely with AsyncHttpClient.
a smaller change would be to adjust the URLSession calls so that they align with ‚FoundationNetworking‘.

I try to find some time in the next two weeks for a better solution including a PR.

@mergesort
Copy link

My suggestion would be to not depend on the Linux implementation of URLSession, but to instead continue integrating AsyncHTTPClient. There are many bugs in the Linux implementation of URLSession, not just minor ones, and they will continue to persist now that URLSession is unmaintained in favor of AsyncHTTPClient.

What I would recommend doing is isolating the networking logic, and exposing a common interface that layers over URLSession and AsyncHTTPClient in a way that the rest of your callers never need to think about. This would make it so only one file needs to change a lot, but every other file in your library (and external users) wouldn't have to be concerned with these implementation details.

If that makes sense, I'm happy to talk through this some more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants