Skip to content

(feat): add Faraday proxy support#502

Closed
danilrwx wants to merge 4 commits intoalexrudall:mainfrom
danilrwx:main
Closed

(feat): add Faraday proxy support#502
danilrwx wants to merge 4 commits intoalexrudall:mainfrom
danilrwx:main

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
Contributor

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
Contributor

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:

@danilrwx
Copy link
Author

danilrwx commented Aug 1, 2025

@alexrudall awesome, then I'll close the PR.

@danilrwx danilrwx closed this Aug 1, 2025
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