Remplissage des embeddings IA abandonné

Bonjour :wave:

J’ai commencé à utiliser Discourse Ai - OpenAi API. J’ai d’abord configuré les sujets connexes (text-embedding-ada-002). Lorsque j’essaie d’exécuter la tâche rake pour le remplissage. J’ai obtenu l’erreur suivante.

....rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass (NoMethodError)

          response[:data].first[:embedding]
                  ^^^^^^^
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/text_embedding_ada_002.rb:37:in `vector_from'
/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:145:in `generate_representation_from'
/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:19:in `block (2 levels) in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `block in find_each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:245:in `block in in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `loop'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:137:in `find_in_batches'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:70:in `find_each'
/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:17:in `block in <main>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => ai:embeddings:backfill

Et voyez également ce qui suit dans /logs.
Screenshot 2024-01-27 at 7.09.32

Merci pour votre aide ! :slightly_smiling_face:

1 « J'aime »

On dirait que vous recevez une réponse nulle.

Avez-vous vérifié ai embeddings enabled et ajouté votre clé API dans les paramètres ?

Oui, voici à quoi ressemblent les paramètres.

Screenshot 2024-01-27 at 9.08.56
Screenshot 2024-01-27 at 9.07.17


Le Jobs::EmbeddingsBackfill semble s’exécuter mais échoue toujours avec l’erreur que j’ai mentionnée dans le fil de discussion.
Screenshot 2024-01-27 at 9.11.36

Il semble qu’il soit connecté à OpenAi.

1 « J'aime »

Je pense que le problème était la limite de débit, j’ai dû mettre à niveau le niveau sur OpenAI et j’ai changé le modèle en text-embedding-3-large. Maintenant, j’ai beaucoup de points pendant le rake, ce qui est bon signe. :sweat_smile: Je mettrai à jour ce post quand ce sera terminé.

Modification 1 : Après 10 heures de points, le rake s'est terminé avec une interruption
rake aborted!

Faraday::TimeoutError: Net::ReadTimeout with #<TCPSocket:(closed)> (Faraday::TimeoutError)

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:229:in `rbuf_fill'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:199:in `readuntil'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:209:in `readline'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http/response.rb:158:in `read_status_line'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http/response.rb:147:in `read_new'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2342:in `block in transport_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2333:in `catch'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2333:in `transport_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2306:in `request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/net_patches.rb:19:in `block in request_with_mini_profiler'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/mini_profiler/profiling_methods.rb:50:in `step'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/net_patches.rb:18:in `request_with_mini_profiler'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:113:in `block in request_with_wrapped_block'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:1570:in `start'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:112:in `request_with_wrapped_block'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:102:in `perform_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:66:in `block in call'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/adapter.rb:45:in `connection'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:65:in `call'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/request/url_encoded.rb:25:in `call'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/rack_builder.rb:152:in `build_response'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/connection.rb:444:in `run_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/connection.rb:280:in `post'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday.rb:145:in `method_missing'

/var/www/discourse/plugins/discourse-ai/lib/inference/open_ai_embeddings.rb:18:in `perform!'

/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/text_embedding_3_large.rb:39:in `vector_from'

/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:147:in `generate_representation_from'

/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:30:in `block (2 levels) in <main>'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `each'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `block in find_each'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:245:in `block in in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `loop'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:137:in `find_in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:70:in `find_each'

/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:28:in `block in <main>'

/usr/local/bin/bundle:25:in `load'

/usr/local/bin/bundle:25:in `<main>'

Caused by:

Net::ReadTimeout: Net::ReadTimeout with #<TCPSocket:(closed)> (Net::ReadTimeout)

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:229:in `rbuf_fill'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:199:in `readuntil'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:209:in `readline'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http/response.rb:158:in `read_status_line'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http/response.rb:147:in `read_new'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2342:in `block in transport_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2333:in `catch'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2333:in `transport_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:2306:in `request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/net_patches.rb:19:in `block in request_with_mini_profiler'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/mini_profiler/profiling_methods.rb:50:in `step'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.3.0/lib/patches/net_patches.rb:18:in `request_with_mini_profiler'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:113:in `block in request_with_wrapped_block'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-http-0.4.1/lib/net/http.rb:1570:in `start'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:112:in `request_with_wrapped_block'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:102:in `perform_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:66:in `block in call'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/adapter.rb:45:in `connection'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:65:in `call'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/request/url_encoded.rb:25:in `call'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/rack_builder.rb:152:in `build_response'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/connection.rb:444:in `run_request'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday/connection.rb:280:in `post'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/faraday-2.9.0/lib/faraday.rb:145:in `method_missing'

/var/www/discourse/plugins/discourse-ai/lib/inference/open_ai_embeddings.rb:18:in `perform!'

/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/text_embedding_3_large.rb:39:in `vector_from'

/var/www/discourse/plugins/discourse-ai/lib/embeddings/vector_representations/base.rb:147:in `generate_representation_from'

/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:30:in `block (2 levels) in <main>'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `each'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:71:in `block in find_each'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:245:in `block in in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `loop'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:229:in `in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:137:in `find_in_batches'

/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/relation/batches.rb:70:in `find_each'

/var/www/discourse/plugins/discourse-ai/lib/tasks/modules/embeddings/database.rake:28:in `block in <main>'

/usr/local/bin/bundle:25:in `load'

/usr/local/bin/bundle:25:in `<main>'

Tasks: TOP => ai:embeddings:backfill

(See full trace by running task with --trace)

J’ai redémarré le rake. Dans ce cas, fera-t-il uniquement les sujets non modifiés ou à nouveau tous les sujets ? :smile:

Modification 2 : Le rake a de nouveau été interrompu avec la même erreur. Mais je pense que ces processus ont couvert la plupart des sujets et que Jobs::EmbeddingsBackfill dans Sidekiq semble fonctionner correctement maintenant. Je pense donc que cela pourrait suffire pour les sujets restants :slight_smile:

3 « J'aime »

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.