Skip to content

Response handling error in chatbot example #2

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

Open
nileshtrivedi opened this issue Sep 26, 2024 · 2 comments
Open

Response handling error in chatbot example #2

nileshtrivedi opened this issue Sep 26, 2024 · 2 comments

Comments

@nileshtrivedi
Copy link

~/code/rb/lively/examples/chatbot (main*) » ruby -v
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23]
-----------------------------------------------------------------------
~/code/rb/lively/examples/chatbot (main*) » uname -a
Darwin workbox.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

In chatbot example, started with bundle exec ./application.rb with ollama running locally, after sending the prompt from the UI:

-- create_table(:conversations, {:if_not_exists=>true})
   -> 0.0163s
-- create_table(:conversation_messages, {:if_not_exists=>true})
   -> 0.0008s
 0.04s     info: Falcon::Service::Server [oid=0xaf0] [ec=0xb04] [pid=62914] [2024-09-26 10:31:49 +0530]
               | Starting lively on #<Async::HTTP::Endpoint http://[::]:9292/ {:reuse_address=>true, :timeout=>nil}>



20.14s     info: ChatbotView [oid=0xbe0] [ec=0xbf4] [pid=63070] [2024-09-26 10:32:09 +0530]
               | Updating conversation
               | {
               |   "id": 3,
               |   "prompt": "who are you?"
               | }
20.17s     warn: Async::Task [oid=0xc44] [ec=0xbf4] [pid=63070] [2024-09-26 10:32:09 +0530]
               | Task may have ended with unhandled exception.
               |   NoMethodError: undefined method `new' for nil (NoMethodError)
               |   
               |   						response.body = parser_for(response).new(body)
               |   						                                    ^^^^
               |   → /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-rest-0.13.0/lib/async/rest/wrapper/generic.rb:50 in `wrap_response'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-rest-0.13.0/lib/async/rest/wrapper/generic.rb:39 in `process_response'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-rest-0.13.0/lib/async/rest/wrapper/generic.rb:18 in `call'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-rest-0.13.0/lib/async/rest/representation.rb:36 in `block (2 levels) in singleton class'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-ollama-0.1.0/lib/async/ollama/client.rb:19 in `generate'
               |     application.rb:30 in `block in update_conversation'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-rest-0.13.0/lib/async/rest/resource.rb:43 in `block in open'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-2.11.0/lib/kernel/sync.rb:20 in `Sync'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-rest-0.13.0/lib/async/rest/resource.rb:42 in `open'
               |     application.rb:21 in `update_conversation'
               |     application.rb:55 in `block in handle'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-2.11.0/lib/async/task.rb:164 in `block in run'
               |     /Users/mac/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/async-2.11.0/lib/async/task.rb:377 in `block in schedule'
@izaguirrejoe
Copy link

@ioquatix I'm running into the same issue as well.

@izaguirrejoe
Copy link

Figured it out. async-ollama defaults to llama3, I had llama3.2 running. Bumping the async-ollama gem in the example to the latest gave a better error.

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

No branches or pull requests

2 participants