Skip to content

Response handling error in chatbot example #2

@nileshtrivedi

Description

@nileshtrivedi
~/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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions