Conversation
dblock
left a comment
There was a problem hiding this comment.
This fixes the issue.
Consider a different pattern in this code to make it cleaner?
def client
@client ||= Raix.configuration.openai_client || Raix.configuration.openrouter_client || configure_api_client
end
def configure_api_client
raise MissingToken unless configuration.api_token
...
rescue
"Error configuring ..."
end |
My take on this is that since the client is state on the If we did that then this PR would look more like this: def configure_api_client
return unless configuration.api_token
return if Raix.configuration.client?
# ...
endOpen to other thoughts though - I'm new here. 😉 |
|
I am good with this change @jonallured, will let the maintainers merge. |
|
Hi @jonallured, thank you for catching this regression and taking the time to submit a fix! 🙏 Good news - this issue has already been addressed in the current codebase. The You can see the implementation in Thanks again for your contribution and for helping make Roast better! Your vigilance in catching this regression was much appreciated. |
As of #56 we had a little regression where an initializer that set the Raix api client would get clobbered by the
configure_api_clientmethod because the guard was no longer short circuiting. What this PR does is establish in a test that whenRaix.configurationhas either anopenrouter_clientor anopenai_clientthen we should bail on theconfigure_api_clientmethod.I did this by checking the state of the
Raix.configurationbut I also opened OlympiaAI/raix#25 because it would be cool for this configuration object to answer the question of whether it has a client. LMK if there's a preferences on whether to merge this as-is or to merge that and then use that solution instead!