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

(feat): add Faraday proxy support #502

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

danilrwx
Copy link

Summary

Adding the ability to use a proxy when proxy from ENV is not suitable.

proxy = {
  :uri      => 'http://proxy.example.com',
  :user     => 'foo',
  :password => 'bar'
}

OpenAI::Client.new(access_token: "access_token_goes_here", proxy: proxy)

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?

@cpb
Copy link

cpb commented Aug 19, 2024

I checked out this branch (rebasing on alexrudall:ruby-openai main) and it worked for me!

I noticed this branch is missing test coverage. I found a couple libraries with test coverage for the proxy configuration:

@alexrudall would you accept this PR with or without test coverage? Or would you prefer oktokit style test coverage?

@alexrudall
Copy link
Owner

alexrudall commented Oct 10, 2024

Apologies for the delay in review.

  • @danilrwx Thanks very much for this PR and for adding to the README - a bit more about when/why you might want to do this could be really helpful.

  • @cpb - yes, a simple 'happy path' test would be great, can probably be added to 1 of the specs in spec/openai/client/client_spec.rb

  • Just realised - I believe you can already do this by just passing a block here

  • In which case, this could be just added to the existing README example to help users do this.

@cpb
Copy link

cpb commented Oct 19, 2024

* In which case, this could be just added to the existing README example to help users do this.

Thank for the feedback @alexrudall, see:

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

Successfully merging this pull request may close these issues.

3 participants