-
Notifications
You must be signed in to change notification settings - Fork 17
Fix model access errors unhelpful #43
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
base: main
Are you sure you want to change the base?
Conversation
a7874d4
to
377d6a6
Compare
Looks pretty good, add a test please that hits those errors? |
377d6a6
to
d043935
Compare
@dblock Sorry about that. I was unsure of how best to stub/mock in order to trigger these specific errors but I think I've got it figured out now. Have a look and let me know what you think. |
d043935
to
445319e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good.
I really dislike catching NoMethodError
though - we should prevent this from happening in code before the error happens. Why are we ever calling .chat
on a client that could not be initialized? (you can totally split this PR if you want and add the NoResourceFound
handling first).
lib/roast/workflow/base_workflow.rb
Outdated
rescue NoMethodError => e | ||
execution_time = Time.now - start_time | ||
|
||
if e.message.include?("undefined method 'chat' for nil") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we catch this one earlier? IMO it should never get here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the logic to much earlier in the code for catching this sort of misconfiguration.
259038c
to
25943d5
Compare
25943d5
to
9f3372c
Compare
@dblock I've added a test that should cover the OpenRouter api token missing. I think this should be enough to ensure we've tested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to make errors more descriptive when things go wrong, this commit adds a few error types to handle api interactions more gracefully when things go wrong. Specifically, it currently handles when a model can't be found or is innaccesible with the api token provided. Also when an api token isn't provided, instead of an unhelpful NoMethodError, we let end users know the token wasn't provided or isn't valid.
9f3372c
to
ca8e563
Compare
I've rebased against the latest main branch so there shouldn't be any more conflicts. |
In order to make errors more descriptive when things go wrong, this commit adds a few error types to handle api interactions more gracefully when things go wrong. Specifically, it currently handles when a model can't be found or is innaccesible with the api token provided. Also when an api token isn't provided, instead of an unhelpful NoMethodError, we let end users know the token wasn't provided or isn't valid.
This resolves #13