Confusing error without a token ('Raix::ChatCompletion#openai_request': undefined method 'chat' for nil (NoMethodError)) · Issue #10 · Shopify/roast · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
~/src/github.com/Shopify/roast (main)$ ./exe/roast execute examples/grading/workflow.yml test/roast/resources_test.rb
🔥🔥🔥 Everyone loves a good roast 🔥🔥🔥
Starting workflow...
Workflow: /Users/dblock/src/github.com/Shopify/roast/examples/grading/workflow.yml
Options: {}
Running workflow for file: test/roast/resources_test.rb
Executing: read_dependencies (Resource type: none)
Exiting due to error: NoMethodError: undefined method 'chat' for nil
/Users/dblock/.gem/ruby/3.4.2/gems/raix-0.8.4/lib/raix/chat_completion.rb:230:in 'Raix::ChatCompletion#openai_request': undefined method 'chat' for nil (NoMethodError)
Raix.configuration.openai_client.chat(parameters: params.compact.merge(model:, messages:))
^^^^^
from /Users/dblock/.gem/ruby/3.4.2/gems/raix-0.8.4/lib/raix/chat_completion.rb:111:in 'Raix::ChatCompletion#chat_completion'
from /Users/dblock/.gem/ruby/3.4.2/gems/raix-0.8.4/lib/raix/function_dispatch.rb:104:in 'Raix::FunctionDispatch#chat_completion'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/base_workflow.rb:78:in 'Roast::Workflow::BaseWorkflow#chat_completion'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/base_step.rb:38:in 'Roast::Workflow::BaseStep#chat_completion'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/base_step.rb:32:in 'Roast::Workflow::BaseStep#call'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/workflow_executor.rb:60:in 'Roast::Workflow::WorkflowExecutor#execute_step'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/workflow_executor.rb:113:in 'Roast::Workflow::WorkflowExecutor#execute_string_step'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/workflow_executor.rb:29:in 'block in Roast::Workflow::WorkflowExecutor#execute_steps'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/workflow_executor.rb:22:in 'Array#each'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/workflow_executor.rb:22:in 'Roast::Workflow::WorkflowExecutor#execute_steps'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/configuration_parser.rb:242:in 'Roast::Workflow::ConfigurationParser#parse'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/configuration_parser.rb:49:in 'block in Roast::Workflow::ConfigurationParser#begin!'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/configuration_parser.rb:46:in 'Array#each'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast/workflow/configuration_parser.rb:46:in 'Roast::Workflow::ConfigurationParser#begin!'
from /Users/dblock/src/github.com/Shopify/roast/lib/roast.rb:28:in 'Roast::CLI#execute'
from /Users/dblock/.gem/ruby/3.4.2/gems/thor-1.3.2/lib/thor/command.rb:28:in 'Thor::Command#run'
from /Users/dblock/.gem/ruby/3.4.2/gems/thor-1.3.2/lib/thor/invocation.rb:127:in 'Thor::Invocation#invoke_command'
from /Users/dblock/.gem/ruby/3.4.2/gems/thor-1.3.2/lib/thor.rb:538:in 'Thor.dispatch'
from /Users/dblock/.gem/ruby/3.4.2/gems/thor-1.3.2/lib/thor/base.rb:584:in 'Thor::Base::ClassMethods#start'
from ./exe/roast:17:in '<main>'
Should we also fallback on a global ENV['OPENAI_API_TOKEN']?
The text was updated successfully, but these errors were encountered:
My reading of the docs was that the default was api_token: $(echo $OPENAI_API_KEY). Since the workflow doesn't work until that is added, it's not. Is there a recommended way to share keys?
@dereklucas Could you please elaborate what you mean by "sharing"? With others?
At Shopify we have a tool that obtains a short lived token so that's why this was built like this I believe. It probably makes sense to default to OPENAI_API_TOKEN in code so that the behavior is to use that by default. Please feel free to PR that change!
@dblock yeah sorry that's not worded correctly: I meant sharing workflows in a company without sharing the keys. Defaulting to ENV['OPENAI_API_TOKEN'] like you've said is probably the simplest option.
Without a token the error is not helpful.
Should we also fallback on a global
ENV['OPENAI_API_TOKEN']
?The text was updated successfully, but these errors were encountered: