chaskiq / plain

100 stars 4 forks source link

[ActiveJob] [Plain::MessageProcessorJob] [564f3a91-68ae-49ef-9cb0-ea2611bd6e63] Error performing Plain::MessageProcessorJob (Job ID: 564f3a91-68ae-49ef-9cb0-ea2611bd6e63) from Async(default) #8

Open dillonwreek opened 7 months ago

dillonwreek commented 7 months ago

I followed instructions for the installation and did rails plain:load. It seems to work correctly but when I try to ask plain something I get

end of context
[ActiveJob] [Plain::MessageProcessorJob] [564f3a91-68ae-49ef-9cb0-ea2611bd6e63] Error performing Plain::MessageProcessorJob (Job ID: 564f3a91-68ae-49ef-9cb0-ea2611bd6e63) from Async(default) in 519.11ms: NoMethodError (undefined method `to_h' for #<Plain::Message id: 3, role: "user", content: "hello?", plain_conversation_id: 2, created_at: "2024-02-09 15:50:52.801029000 +0000", updated_at: "2024-02-09 15:50:52.801029000 +0000">):

the log from qdrant docker:

2024-02-09T15:56:10.960358Z INFO actix_web::middleware::logger: 172.17.0.1 "POST /collections/qdrant/points/search HTTP/1.1" 200 18715 "-" "Faraday v2.9.0" 0.002857

michelson commented 7 months ago

i think you are using a more updated openai, I've updated on my end but I I'm little short on time, I will try to upgrade it on weekend

El vie, 9 feb 2024 a la(s) 12:56 p.m., dbdill @.***) escribió:

I followed instructions for the installation and did rails plain:load. It seems to work correctly but when I try to ask plain something I get

end of context [ActiveJob] [Plain::MessageProcessorJob] [564f3a91-68ae-49ef-9cb0-ea2611bd6e63] Error performing Plain::MessageProcessorJob (Job ID: 564f3a91-68ae-49ef-9cb0-ea2611bd6e63) from Async(default) in 519.11ms: NoMethodError (undefined method `to_h' for #<Plain::Message id: 3, role: "user", content: "hello?", plain_conversation_id: 2, created_at: "2024-02-09 15:50:52.801029000 +0000", updated_at: "2024-02-09 15:50:52.801029000 +0000">):

the log from qdrant docker:

2024-02-09T15:56:10.960358Z INFO actix_web::middleware::logger: 172.17.0.1 "POST /collections/qdrant/points/search HTTP/1.1" 200 18715 "-" "Faraday v2.9.0" 0.002857

— Reply to this email directly, view it on GitHub https://github.com/chaskiq/plain/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAC5SCGQKA6YT6ME6RDU23YSZBMHAVCNFSM6AAAAABDBWBX36VHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZDONBRHA2DQMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dillonwreek commented 6 months ago

i think you are using a more updated openai

What do you mean? As in I should use an older model?

adevfz commented 6 months ago

I still get the same error even with the default model specified in the repo. This is the full trace when I send a message in a conversation

Started GET "/cable" for 127.0.0.1 at 2024-02-11 06:59:28 +0100
  ActiveRecord::SchemaMigration Load (0.3ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Started GET "/cable" [WebSocket] for 127.0.0.1 at 2024-02-11 06:59:28 +0100
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, Upgrade, HTTP_UPGRADE: websocket)
Turbo::StreamsChannel is transmitting the subscription confirmation
Turbo::StreamsChannel is streaming from Z2lkOi8vZnJlZXphbnovUGxhaW46OkNvbnZlcnNhdGlvbi8x
Started POST "/plain/conversations/1/messages" for 127.0.0.1 at 2024-02-11 06:59:38 +0100
Processing by Plain::MessagesController#create as TURBO_STREAM
  Parameters: {"authenticity_token"=>"[FILTERED]", "message"=>{"content"=>"hello"}, "commit"=>"Ask Plain", "conversation_id"=>"1"}
  Plain::Conversation Load (0.2ms)  SELECT "plain_conversations".* FROM "plain_conversations" WHERE "plain_conversations"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  TRANSACTION (0.1ms)  BEGIN
  Plain::Conversation Load (0.5ms)  SELECT "plain_conversations".* FROM "plain_conversations" WHERE "plain_conversations"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  Plain::Message Create (0.8ms)  INSERT INTO "plain_messages" ("role", "content", "plain_conversation_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["role", "user"], ["content", "hello"], ["plain_conversation_id", 1], ["created_at", "2024-02-11 05:59:38.882281"], ["updated_at", "2024-02-11 05:59:38.882281"]]
  TRANSACTION (1.4ms)  COMMIT
  Rendered vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/_message_item.html.erb (Duration: 0.7ms | Allocations: 589)
  Rendered vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/_new_message.turbo_stream.erb (Duration: 2.8ms | Allocations: 1255)
[ActionCable] Broadcasting to Z2lkOi8vZnJlZXphbnovUGxhaW46OkNvbnZlcnNhdGlvbi8x: "<turbo-stream action=\"append\" target=\"new-messages-container\"><template>\n  <div id=\"message-item-3\" \n  data-markdoc-content-value=\"hello\"\n  class=\"message-role bg-brand-200 dark:bg-brand-600 \n  mx-4 flex flex-col p-2 my-1 shadow-sm rounded-md border border-black/10 dark:border-black...
Turbo::StreamsChannel transmitting "<turbo-stream action=\"append\" target=\"new-messages-container\"><template>\n  <div id=\"message-item-3\" \n  data-markdoc-content-value=\"hello\"\n  class=\"message-role bg-brand-200 dark:bg-brand-600 \n  mx-4 flex flex-col p-2 my-1 shadow-sm rounded-md border border-black/10 dark:border-black... (via streamed from Z2lkOi8vZnJlZXphbnovUGxhaW46OkNvbnZlcnNhdGlvbi8x)
  Rendered vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/_form.html.erb (Duration: 2.3ms | Allocations: 1235)
[ActionCable] Broadcasting to Z2lkOi8vZnJlZXphbnovUGxhaW46OkNvbnZlcnNhdGlvbi8x: "<turbo-stream action=\"update\" target=\"message-form\"><template>\n<turbo-frame id=\"message-form\">\n  <form class=\"new_message\" id=\"new_message\" data-controller=\"loader\" data-action=\"turbo:submit-start-&gt;loader#formSubmitting turbo:submit-end-&gt;loader#formSubmitted\" action=\"/plai...
Turbo::StreamsChannel transmitting "<turbo-stream action=\"update\" target=\"message-form\"><template>\n<turbo-frame id=\"message-form\">\n  <form class=\"new_message\" id=\"new_message\" data-controller=\"loader\" data-action=\"turbo:submit-start-&gt;loader#formSubmitting turbo:submit-end-&gt;loader#formSubmitted\" action=\"/plai... (via streamed from Z2lkOi8vZnJlZXphbnovUGxhaW46OkNvbnZlcnNhdGlvbi8x)
[ActiveJob] Enqueued Plain::MessageProcessorJob (Job ID: 04b510ea-1c56-44e7-97d2-f46a85db9df9) to Async(default) with arguments: #<GlobalID:0x0000772d82b43008 @uri=#<URI::GID gid://company/Plain::Conversation/1>>, {:question=>"hello"}
  Rendering vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/create.turbo_stream.erb
  Rendered collection of vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/_message_item.html.erb [0 times] (Duration: 0.0ms | Allocations: 27)
  Rendered vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/_form.html.erb (Duration: 6.8ms | Allocations: 2231)
  Rendered vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/views/plain/messages/create.turbo_stream.erb (Duration: 17.7ms | Allocations: 2820)
Completed 200 OK in 100ms (Views: 20.0ms | ActiveRecord: 11.4ms | Allocations: 52249)

[ActiveJob] [Plain::MessageProcessorJob] [04b510ea-1c56-44e7-97d2-f46a85db9df9]   Plain::Conversation Load (0.2ms)  SELECT "plain_conversations".* FROM "plain_conversations" WHERE "plain_conversations"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
[ActiveJob] [Plain::MessageProcessorJob] [04b510ea-1c56-44e7-97d2-f46a85db9df9] Performing Plain::MessageProcessorJob (Job ID: 04b510ea-1c56-44e7-97d2-f46a85db9df9) from Async(default) enqueued at 2024-02-11T05:59:38.911747802Z with arguments: #<GlobalID:0x0000772d8197e4f8 @uri=#<URI::GID gid://company/Plain::Conversation/1>>, {:question=>"hello"}
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/services/plain/ai_docs.rb:28: warning: already initialized constant Langchain::Processors::JSON::EXTENSIONS
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/langchainrb-0.6.19/lib/langchain/processors/json.rb:6: warning: previous definition of EXTENSIONS was here
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/services/plain/ai_docs.rb:29: warning: already initialized constant Langchain::Processors::JSON::CONTENT_TYPES
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/langchainrb-0.6.19/lib/langchain/processors/json.rb:7: warning: previous definition of CONTENT_TYPES was here
[ActiveJob] [Plain::MessageProcessorJob] [04b510ea-1c56-44e7-97d2-f46a85db9df9]   Plain::Message Load (0.2ms)  SELECT "plain_messages".* FROM "plain_messages" WHERE "plain_messages"."plain_conversation_id" = $1  [["plain_conversation_id", 1]]
[ActiveJob] [Plain::MessageProcessorJob] [04b510ea-1c56-44e7-97d2-f46a85db9df9] Error performing Plain::MessageProcessorJob (Job ID: 04b510ea-1c56-44e7-97d2-f46a85db9df9) from Async(default) in 853.06ms: NoMethodError (undefined method `to_h' for #<Plain::Message id: 1, role: "user", content: "hello plain", plain_conversation_id: 1, created_at: "2024-02-11 05:57:26.037093000 +0000", updated_at: "2024-02-11 05:57:26.037093000 +0000">):
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activemodel-7.1.2/lib/active_model/attribute_methods.rb:489:in `method_missing'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/langchainrb-0.6.19/lib/langchain/conversation.rb:87:in `map'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/langchainrb-0.6.19/lib/langchain/conversation.rb:87:in `llm_response'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/langchainrb-0.6.19/lib/langchain/conversation.rb:61:in `message'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/services/plain/ai_docs.rb:73:in `set_conversation_title'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/models/plain/conversation.rb:33:in `add_assistant_response'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/plain-rails-0.2.0/app/jobs/plain/message_processor_job.rb:6:in `perform'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/execution.rb:69:in `block in _perform_job'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n.rb:322:in `with_locale'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:130:in `instance_exec'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/core_ext/time/zones.rb:65:in `use_zone'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:130:in `instance_exec'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:141:in `run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/execution.rb:68:in `_perform_job'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/instrumentation.rb:32:in `_perform_job'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/execution.rb:52:in `perform_now'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/instrumentation.rb:26:in `block in perform_now'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/railties/job_runtime.rb:13:in `block in instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/instrumentation.rb:40:in `block in instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/notifications.rb:206:in `block in instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/notifications.rb:206:in `instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/instrumentation.rb:39:in `instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.2/lib/active_record/railties/job_runtime.rb:11:in `instrument'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/instrumentation.rb:26:in `perform_now'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/logging.rb:18:in `block in perform_now'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/tagged_logging.rb:135:in `block in tagged'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/tagged_logging.rb:39:in `tagged'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/tagged_logging.rb:135:in `tagged'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/broadcast_logger.rb:240:in `method_missing'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/logging.rb:25:in `tag_logger'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/logging.rb:18:in `perform_now'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/execution.rb:30:in `block in execute'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/railtie.rb:67:in `block (4 levels) in <class:Railtie>'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/reloader.rb:77:in `block in wrap'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/execution_wrapper.rb:92:in `wrap'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/reloader.rb:74:in `wrap'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/railtie.rb:66:in `block (3 levels) in <class:Railtie>'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:130:in `instance_exec'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.2/lib/active_support/callbacks.rb:141:in `run_callbacks'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/execution.rb:28:in `execute'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/activejob-7.1.2/lib/active_job/queue_adapters/async_adapter.rb:70:in `perform'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `loop'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
/home/adev/lavoro/company-routeplanner/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'