bertrend 0.3.16__tar.gz → 0.3.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. {bertrend-0.3.16 → bertrend-0.3.18}/PKG-INFO +8 -2
  2. {bertrend-0.3.16 → bertrend-0.3.18}/README.md +6 -0
  3. bertrend-0.3.18/bertrend/llm_utils/prompts.py +138 -0
  4. bertrend-0.3.18/bertrend/services/cert.pem +24 -0
  5. bertrend-0.3.18/bertrend/services/embedding_server/requirements.txt +10 -0
  6. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/start.py +1 -1
  7. bertrend-0.3.18/bertrend/services/key.pem +28 -0
  8. bertrend-0.3.18/bertrend/topic_analysis/prompts.py +76 -0
  9. bertrend-0.3.18/bertrend/trend_analysis/prompts.py +308 -0
  10. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/__init__.py +2 -1
  11. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/dashboard_analysis.py +1 -1
  12. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/i18n_translations.py +4 -0
  13. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/llm_utils.py +1 -1
  14. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/models_info.py +17 -11
  15. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/report_generation.py +2 -6
  16. {bertrend-0.3.16 → bertrend-0.3.18}/pyproject.toml +2 -2
  17. bertrend-0.3.16/bertrend/llm_utils/prompts.py +0 -94
  18. bertrend-0.3.16/bertrend/topic_analysis/prompts.py +0 -42
  19. bertrend-0.3.16/bertrend/trend_analysis/prompts.py +0 -306
  20. {bertrend-0.3.16 → bertrend-0.3.18}/AUTHORS.txt +0 -0
  21. {bertrend-0.3.16 → bertrend-0.3.18}/LICENSE.md +0 -0
  22. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/BERTopicModel.py +0 -0
  23. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/BERTrend.py +0 -0
  24. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/__init__.py +0 -0
  25. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/article_scoring/__init__.py +0 -0
  26. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/article_scoring/article_scoring.py +0 -0
  27. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/article_scoring/prompts.py +0 -0
  28. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/article_scoring/scoring_agent.py +0 -0
  29. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/config/bertopic_default_config.toml +0 -0
  30. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/config/bertrend_default_config.toml +0 -0
  31. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/config/parameters.py +0 -0
  32. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/config/services_default_config.toml +0 -0
  33. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/__init__.py +0 -0
  34. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/__init__.py +0 -0
  35. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/data_loading_component.py +0 -0
  36. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/embed_documents_component.py +0 -0
  37. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/i18n.py +0 -0
  38. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/i18n_translations.py +0 -0
  39. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/icons.py +0 -0
  40. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/parameters_component.py +0 -0
  41. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/demos_utils/state_utils.py +0 -0
  42. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/start_summarizer_app.sh +0 -0
  43. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/start_topic_analysis_app.sh +0 -0
  44. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/start_weak_signals_app.sh +0 -0
  45. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/streamlit_components/__init__.py +0 -0
  46. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/streamlit_components/clickable_df_component.py +0 -0
  47. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/streamlit_components/input_with_pills_components.py +0 -0
  48. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/summarization/__init__.py +0 -0
  49. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/summarization/summarizer_app.py +0 -0
  50. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/.streamlit/config.toml +0 -0
  51. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/__init__.py +0 -0
  52. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/app.py +0 -0
  53. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/app_utils.py +0 -0
  54. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/demo_pages/__init__.py +0 -0
  55. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/demo_pages/explore_topics.py +0 -0
  56. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/demo_pages/newsletters_generation.py +0 -0
  57. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/demo_pages/temporal_visualizations.py +0 -0
  58. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/demo_pages/topic_visualizations.py +0 -0
  59. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/demo_pages/training_page.py +0 -0
  60. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/topic_analysis/i18n_translations.py +0 -0
  61. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/weak_signals/.streamlit/config.toml +0 -0
  62. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/weak_signals/__init__.py +0 -0
  63. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/weak_signals/app.py +0 -0
  64. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/weak_signals/i18n_translations.py +0 -0
  65. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/demos/weak_signals/visualizations_utils.py +0 -0
  66. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/__init__.py +0 -0
  67. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/agent_utils.py +0 -0
  68. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/newsletter.css +0 -0
  69. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/newsletter_features.py +0 -0
  70. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/newsletter_model.py +0 -0
  71. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/newsletter_outlook_template.html +0 -0
  72. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/newsletter_template.html +0 -0
  73. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/llm_utils/openai_client.py +0 -0
  74. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/metrics/__init__.py +0 -0
  75. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/metrics/temporal_metrics_embedding.py +0 -0
  76. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/metrics/topic_metrics.py +0 -0
  77. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/resources/common_ngrams.json +0 -0
  78. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/resources/stopwords-en.json +0 -0
  79. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/resources/stopwords-fr.json +0 -0
  80. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/resources/stopwords-rte.json +0 -0
  81. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/__init__.py +0 -0
  82. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/authentication.py +0 -0
  83. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_client.py +0 -0
  84. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/README.md +0 -0
  85. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/__init__.py +0 -0
  86. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/bertrend_client_registry.json +0 -0
  87. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/config/default_config.toml +0 -0
  88. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/config/settings.py +0 -0
  89. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/main.py +0 -0
  90. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/models.py +0 -0
  91. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/routers/__init__.py +0 -0
  92. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/routers/authentication.py +0 -0
  93. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/routers/embeddings.py +0 -0
  94. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/routers/info.py +0 -0
  95. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/security.py +0 -0
  96. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/status.py +0 -0
  97. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_server/stop.py +0 -0
  98. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/embedding_service.py +0 -0
  99. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summarizer.py +0 -0
  100. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summary/__init__.py +0 -0
  101. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summary/abstractive_summarizer.py +0 -0
  102. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summary/chatgpt_summarizer.py +0 -0
  103. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summary/extractive_summarizer.py +0 -0
  104. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summary/lexrank.py +0 -0
  105. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/services/summary/prompts.py +0 -0
  106. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/README_integration_tests.md +0 -0
  107. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/__init__.py +0 -0
  108. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/conftest.py +0 -0
  109. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_abstractive_summarizer.py +0 -0
  110. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_agent_utils.py +0 -0
  111. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_article_scoring.py +0 -0
  112. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_article_scoring_models.py +0 -0
  113. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_bertrend.py +0 -0
  114. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_cache_utils.py +0 -0
  115. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_chatgpt_summarizer.py +0 -0
  116. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_config_utils.py +0 -0
  117. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_data_loading.py +0 -0
  118. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_data_structure.py +0 -0
  119. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_embedding_client.py +0 -0
  120. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_extractive_summarizer.py +0 -0
  121. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_installation.py +0 -0
  122. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_integration.py +0 -0
  123. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_mail_utils.py +0 -0
  124. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_newsletter_features.py +0 -0
  125. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_newsletter_model.py +0 -0
  126. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_openai_client.py +0 -0
  127. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_representative_docs.py +0 -0
  128. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_summarizer.py +0 -0
  129. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_temporal_metrics_embedding.py +0 -0
  130. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_topic_description.py +0 -0
  131. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_topic_metrics.py +0 -0
  132. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_topic_model.py +0 -0
  133. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_trend_analysis_data_structure.py +0 -0
  134. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_trend_analysis_prompts.py +0 -0
  135. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_trend_analysis_visualizations.py +0 -0
  136. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_trend_analysis_weak_signals.py +0 -0
  137. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_utils_init.py +0 -0
  138. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/tests/test_visualizations.py +0 -0
  139. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/topic_analysis/__init__.py +0 -0
  140. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/topic_analysis/data_structure.py +0 -0
  141. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/topic_analysis/representative_docs.py +0 -0
  142. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/topic_analysis/topic_description.py +0 -0
  143. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/topic_analysis/visualizations.py +0 -0
  144. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/trend_analysis/__init__.py +0 -0
  145. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/trend_analysis/data_structure.py +0 -0
  146. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/trend_analysis/signal_llm_template_en.html +0 -0
  147. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/trend_analysis/signal_llm_template_fr.html +0 -0
  148. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/trend_analysis/visualizations.py +0 -0
  149. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/trend_analysis/weak_signals.py +0 -0
  150. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/utils/__init__.py +0 -0
  151. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/utils/cache_utils.py +0 -0
  152. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/utils/config_utils.py +0 -0
  153. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend/utils/data_loading.py +0 -0
  154. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/__init__.py +0 -0
  155. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/common/__init__.py +0 -0
  156. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/common/crontab_utils.py +0 -0
  157. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/common/mail_utils.py +0 -0
  158. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/feeds/arxiv_feed.toml +0 -0
  159. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/feeds/decarbonation_feed.toml +0 -0
  160. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/feeds/llm_en_feed.toml +0 -0
  161. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/feeds/llm_feed.toml +0 -0
  162. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/feeds/nlp_feed.toml +0 -0
  163. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/feeds/rte_feed.toml +0 -0
  164. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/arxiv_newsletter_from_last.toml +0 -0
  165. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/decarbonation_newsletter_from_last.toml +0 -0
  166. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/decarbonation_newsletter_from_scratch.toml +0 -0
  167. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/llm_en_newsletter_from_last.toml +0 -0
  168. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/llm_newsletter_from_last.toml +0 -0
  169. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/nlp_newsletter_from_last.toml +0 -0
  170. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/rte_newsletter_from_last.toml +0 -0
  171. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/config/newsletters/rte_newsletter_from_scratch.toml +0 -0
  172. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/__init__.py +0 -0
  173. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/__main__.py +0 -0
  174. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/arxiv_provider.py +0 -0
  175. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/atom_feed_provider.py +0 -0
  176. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/bing_news_provider.py +0 -0
  177. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/data_provider.py +0 -0
  178. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/google_news_provider.py +0 -0
  179. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/newscatcher_provider.py +0 -0
  180. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/data_provider/utils.py +0 -0
  181. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/__init__.py +0 -0
  182. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/.streamlit/config.toml +0 -0
  183. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/__init__.py +0 -0
  184. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/app.py +0 -0
  185. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/app_utils.py +0 -0
  186. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/config.toml +0 -0
  187. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/import_extraction_article.ipynb +0 -0
  188. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/prompts.py +0 -0
  189. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/start_newsletter_generator.sh +0 -0
  190. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/tabs/tab1.py +0 -0
  191. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/tabs/tab2.py +0 -0
  192. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/curebot/tabs/tab3.py +0 -0
  193. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/dataviz/Main_page.py +0 -0
  194. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/dataviz/__init__.py +0 -0
  195. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/dataviz/pages/1_Data_feeds.py +0 -0
  196. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/__init__.py +0 -0
  197. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/entity_utils.py +0 -0
  198. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/spacy/__init__.py +0 -0
  199. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/spacy/common_factory.py +0 -0
  200. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/spacy/dbpedia.py +0 -0
  201. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/spacy/nlp.config +0 -0
  202. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/exploration/geolocalization/spacy/utils.py +0 -0
  203. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/install_feeds_and_newsletters.py +0 -0
  204. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/newsletters/__init__.py +0 -0
  205. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/newsletters/__main__.py +0 -0
  206. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/.streamlit/config.toml +0 -0
  207. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/.streamlit/secrets.toml +0 -0
  208. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/app.py +0 -0
  209. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/authentication.py +0 -0
  210. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/dashboard_common.py +0 -0
  211. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/dashboard_signals.py +0 -0
  212. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/data_model.py +0 -0
  213. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/detailed_report_template.html +0 -0
  214. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/feeds_common.py +0 -0
  215. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/feeds_config.py +0 -0
  216. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/feeds_data.py +0 -0
  217. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/perf_utils.py +0 -0
  218. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/process_new_data.py +0 -0
  219. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/prospective_demo/start_demo.sh +0 -0
  220. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/start_apps.sh +0 -0
  221. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/stop_apps.sh +0 -0
  222. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/tests/__init__.py +0 -0
  223. {bertrend-0.3.16 → bertrend-0.3.18}/bertrend_apps/tests/test_process_new_data.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bertrend
3
- Version: 0.3.16
3
+ Version: 0.3.18
4
4
  Summary: BERTrend analyses topic evolution over time using state-of-the-art transformer models: topic modelling and LLM
5
5
  License: LICENSE.md
6
6
  License-File: AUTHORS.txt
@@ -64,7 +64,7 @@ Requires-Dist: sentencepiece (>=0.2.0)
64
64
  Requires-Dist: starlette (>=0.46.2)
65
65
  Requires-Dist: streamlit (>=1.48)
66
66
  Requires-Dist: streamlit-code-editor (>=0.1.22)
67
- Requires-Dist: supervisor (>=4.2.5)
67
+ Requires-Dist: supervisor (>=4.3.0)
68
68
  Requires-Dist: thefuzz (>=0.22.1)
69
69
  Requires-Dist: tiktoken (>=0.8.0)
70
70
  Requires-Dist: tldextract (>=2.0.1)
@@ -165,6 +165,12 @@ BERTrend requires the following environment variables to be set:
165
165
  - Recommended: at least one GPU with 16GB RAM for faster processing
166
166
  - Python >= 3.12 is required
167
167
 
168
+ ### Docker Installation
169
+
170
+ BERTrend can be run using Docker, which provides an easy way to run the application without installing dependencies directly on your system.
171
+
172
+ For detailed instructions on using BERTrend with Docker, see the [Docker documentation](./docs/docker.md).
173
+
168
174
  ### Package Installation
169
175
 
170
176
  - (Recommended): create a new python environment using `venv` or `conda`:
@@ -84,6 +84,12 @@ BERTrend requires the following environment variables to be set:
84
84
  - Recommended: at least one GPU with 16GB RAM for faster processing
85
85
  - Python >= 3.12 is required
86
86
 
87
+ ### Docker Installation
88
+
89
+ BERTrend can be run using Docker, which provides an easy way to run the application without installing dependencies directly on your system.
90
+
91
+ For detailed instructions on using BERTrend with Docker, see the [Docker documentation](./docs/docker.md).
92
+
87
93
  ### Package Installation
88
94
 
89
95
  - (Recommended): create a new python environment using `venv` or `conda`:
@@ -0,0 +1,138 @@
1
+ # Copyright (c) 2024, RTE (https://www.rte-france.com)
2
+ # See AUTHORS.txt
3
+ # SPDX-License-Identifier: MPL-2.0
4
+ # This file is part of BERTrend.
5
+
6
+ FR_USER_SUMMARY_MULTIPLE_DOCS = """
7
+ Vous êtes une IA spécialisée dans la compréhension et la synthèse d’articles de presse.
8
+ Votre tâche : produire une synthèse concise et fidèle au contenu fourni.
9
+
10
+ Entrées :
11
+ - Mots-clés du thème : {keywords}
12
+ - Articles (Titre + Contenu) :
13
+ ```{article_list}```
14
+
15
+ Exigences de la synthèse :
16
+ 1) Contenu :
17
+ - Être directement liée au thème évoqué par les mots-clés.
18
+ - Intégrer les informations essentielles communes ou complémentaires entre les articles.
19
+ - Éviter les répétitions, les détails anecdotiques et le bruit.
20
+ - Mentionner les acteurs, faits, dates, chiffres et positions clés quand disponibles.
21
+ - Être neutre, factuelle, sans spéculation ni jugement.
22
+ 2) Forme :
23
+ - Ne pas dépasser {nb_sentences} phrases (phrases complètes, séparées par des points).
24
+ - Ne pas commencer par « Les articles… », « Ces articles… » ni toute méta-introduction.
25
+ - Commencer directement par l’information la plus saillante.
26
+ - Pas de listes, ni de puces ; texte continu.
27
+ - Pas de citations longues ; reformuler brièvement si nécessaire.
28
+ 3) Qualité & Cohérence :
29
+ - Résoudre les divergences entre articles en signalant la divergence de façon concise si pertinente.
30
+ - Éviter les doublons d’information.
31
+ - Ne pas inventer d’informations absentes de l’entrée.
32
+ - Respecter la langue des consignes (français).
33
+
34
+ Sortie attendue :
35
+ - Un seul paragraphe, {nb_sentences} phrases maximum.
36
+ - Aucune introduction, aucune conclusion générique, aucun texte en dehors de la synthèse.
37
+ """
38
+
39
+ EN_USER_SUMMARY_MULTIPLE_DOCS = """
40
+ You are an AI specialized in understanding and synthesizing news articles.
41
+ Your task: produce a concise and faithful summary of the provided content.
42
+
43
+ Inputs:
44
+ - Topic keywords: {keywords}
45
+ - Articles (Title + Content):
46
+ ```{article_list}```
47
+
48
+ Summary requirements:
49
+ 1) Content:
50
+ - Be directly related to the topic evoked by the keywords.
51
+ - Capture the essential, shared, or complementary information across articles.
52
+ - Avoid repetition, minor details, and noise.
53
+ - Include key actors, facts, dates, figures, and stated positions when available.
54
+ - Maintain a neutral, factual tone with no speculation or judgment.
55
+ 2) Form:
56
+ - Do not exceed {nb_sentences} sentences (complete sentences, period-separated).
57
+ - Do not begin with “The articles…”, “These articles…”, or any meta-introduction.
58
+ - Start immediately with the most salient information.
59
+ - No lists or bullets; continuous prose only.
60
+ - No long quotations; paraphrase briefly if needed.
61
+ 3) Quality & Consistency:
62
+ - If articles diverge, briefly note the discrepancy only if relevant.
63
+ - Avoid duplicating the same information.
64
+ - Do not invent information not present in the input.
65
+ - Output in English.
66
+
67
+ Expected output:
68
+ - A single paragraph, at most {nb_sentences} sentences.
69
+ - No introduction, no generic conclusion, and no text outside the summary.
70
+ """
71
+
72
+ # keywords: list of keywords describing the topic
73
+ # article_list: list of articles (each with title and content)
74
+ USER_SUMMARY_MULTIPLE_DOCS = {
75
+ "fr": FR_USER_SUMMARY_MULTIPLE_DOCS,
76
+ "en": EN_USER_SUMMARY_MULTIPLE_DOCS,
77
+ }
78
+
79
+ ###################### TOPIC PROMPTS
80
+
81
+ FR_USER_GENERATE_TOPIC_LABEL_SUMMARIES = """
82
+ Contexte : génération d’une newsletter sur le thème « {newsletter_title} ».
83
+ Tâche : proposer un libellé très court décrivant le sous-thème spécifique du texte fourni.
84
+
85
+ Contraintes :
86
+ - Longueur : au plus 5 mots.
87
+ - Clarté : formulation naturelle, lisible, sans jargon inutile.
88
+ - Spécificité : refléter ce qui rend le texte distinctif dans le cadre du thème « {newsletter_title} ».
89
+ - Éviter :
90
+ - Libellés trop généraux (ex. : « Actualités », « Mise à jour », « Tendances »).
91
+ - Libellés trop proches ou quasi identiques au thème principal (ex. répéter « {newsletter_title} » ou son équivalent).
92
+ - Formulations métadiscursives (« Ce texte… », « Sous-thème… »).
93
+ - Ponctuation superflue (pas de point final si possible).
94
+ - Langue : français.
95
+ - Un seul libellé attendu.
96
+
97
+ Texte :
98
+ "{title_list}"
99
+
100
+ Sortie (uniquement le libellé, sans guillemets, sans texte additionnel) :
101
+ """
102
+
103
+ EN_USER_GENERATE_TOPIC_LABEL_SUMMARIES = """
104
+ Context: generating a newsletter on the topic "{newsletter_title}".
105
+ Task: propose a very short label that captures the specific sub-topic of the provided text.
106
+
107
+ Constraints:
108
+ - Length: maximum 5 words.
109
+ - Clarity: natural, readable phrasing; avoid unnecessary jargon.
110
+ - Specificity: reflect what makes the text distinctive within the scope of "{newsletter_title}".
111
+ - Avoid:
112
+ - Overly general labels (e.g., "News", "Update", "Trends").
113
+ - Labels too close to or nearly identical to the main topic (e.g., repeating "{newsletter_title}" or its near-synonym).
114
+ - Meta-introductions ("This text…", "Subtopic…").
115
+ - Superfluous punctuation (no trailing period if possible).
116
+ - Language: English.
117
+ - Exactly one label expected.
118
+
119
+ Text:
120
+ "{title_list}"
121
+
122
+ Output (only the label, no quotes, no extra text):
123
+ """
124
+
125
+ # title_list: list or block of document excerpts belonging to the topic
126
+ USER_GENERATE_TOPIC_LABEL_SUMMARIES = {
127
+ "fr": FR_USER_GENERATE_TOPIC_LABEL_SUMMARIES,
128
+ "en": EN_USER_GENERATE_TOPIC_LABEL_SUMMARIES,
129
+ }
130
+
131
+ BERTOPIC_FRENCH_TOPIC_REPRESENTATION_PROMPT = (
132
+ "J'ai un topic qui contient les documents suivants :\n"
133
+ "[DOCUMENTS]\n"
134
+ "Le topic est décrit par les mots-clés suivants : [KEYWORDS]\n"
135
+ "Sur la base des informations ci-dessus, extraire une courte étiquette de topic dans le format suivant :\n"
136
+ "Topic : <étiquette du sujet>"
137
+ )
138
+ # Passed directly to BERTopic's OpenAI wrapper, formatted similarly to BERTopic's original prompt which can be found in its source code
@@ -0,0 +1,24 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIID9TCCAt2gAwIBAgIUM6hXH97es1ndg39f9EANtiNZJMwwDQYJKoZIhvcNAQEL
3
+ BQAwgYkxCzAJBgNVBAYTAkZSMQwwCgYDVQQIDANJREYxFjAUBgNVBAcMDUxhIETD
4
+ g8KpZmVuc2UxDDAKBgNVBAoMA1JURTENMAsGA1UECwwERFNJQTERMA8GA1UEAwwI
5
+ V2F0dEVsc2UxJDAiBgkqhkiG9w0BCQEWFXdhdHRlbHNlLmFpQGdtYWlsLmNvbTAe
6
+ Fw0yNTAzMTQxNTA3MDhaFw0yNjAzMTQxNTA3MDhaMIGJMQswCQYDVQQGEwJGUjEM
7
+ MAoGA1UECAwDSURGMRYwFAYDVQQHDA1MYSBEw4PCqWZlbnNlMQwwCgYDVQQKDANS
8
+ VEUxDTALBgNVBAsMBERTSUExETAPBgNVBAMMCFdhdHRFbHNlMSQwIgYJKoZIhvcN
9
+ AQkBFhV3YXR0ZWxzZS5haUBnbWFpbC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB
10
+ DwAwggEKAoIBAQDFVmuM5t6cLCUlZU8Bs9ejZvRa3YlnlWPFIdzD0uuyFKcEBNC3
11
+ snkTCxExdlaRVj5Ph9E6a+cxQ1V4kBQ5JOhiMzqyLA9z8RqTnkk/ReDqq4QG2nXf
12
+ +rMnYLswesKVvTO84Bd46pDVm27omeqw6sfYBmSs1roxL0gO7h8bsDLekgMkrzag
13
+ gaNNasdwA7wCSGyE4MbVojlcdFTVPEJCWDfH94sTLN1kfJZQOANfD7S9DYTaLGC+
14
+ SZ1D3/fwDdCdAodPuk+2A8kQGAjDAm6+2M3RWeSJAnQ1fRaNdXeJagRqDPRh081u
15
+ QnriqxFuZ1t3Oh/23sXebwzUh2CrMrUmkdWtAgMBAAGjUzBRMB0GA1UdDgQWBBRK
16
+ lPW4foUkhlmqxvnskcbGbQT3YzAfBgNVHSMEGDAWgBRKlPW4foUkhlmqxvnskcbG
17
+ bQT3YzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCtY+Atcdz9
18
+ /vBZw3r8L5TZ8a/xe1AmME73IS2LpXkEsjs58XPpa6lyeIIkyh3lTaH4OshmECML
19
+ H4RvdqfCOg9BblYziSp5JfZdGcbqWypcVqA207k701M2SmowAYOkaYL3L6y5O18w
20
+ OlQIL5JYvmASj7BXZSireQuJOgJjYn7f3mDEtSayQh/U+53NewbgF1gI/w4HO73L
21
+ oKYDWsyMW0ekW0dy5VCyVqjfI8cVgEF3ilpuB1dMkWyIKkiGBswgTvvechj6jjhY
22
+ xdL1Xvo9g1ZQ+2wcQ1b8KfPnE49hMQLIrd5YUa3ReXPGJhEr6bwsTN3HFgR7RTGj
23
+ CNTUWxog71Yk
24
+ -----END CERTIFICATE-----
@@ -0,0 +1,10 @@
1
+ fastapi
2
+ pydantic
3
+ pydantic_settings
4
+ python-multipart
5
+ urllib3
6
+ uvicorn
7
+ PyJWT
8
+ loguru
9
+ dotenv
10
+ sentence_transformers
@@ -17,7 +17,7 @@ os.environ["CUDA_VISIBLE_DEVICES"] = CONFIG.cuda_visible_devices
17
17
  # Start the FastAPI application
18
18
  if __name__ == "__main__":
19
19
  uvicorn.run(
20
- "wattelse.api.embedding.main:app",
20
+ "bertrend.services.embedding_server.main:app",
21
21
  host=CONFIG.host,
22
22
  port=CONFIG.port,
23
23
  workers=CONFIG.number_workers,
@@ -0,0 +1,28 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDFVmuM5t6cLCUl
3
+ ZU8Bs9ejZvRa3YlnlWPFIdzD0uuyFKcEBNC3snkTCxExdlaRVj5Ph9E6a+cxQ1V4
4
+ kBQ5JOhiMzqyLA9z8RqTnkk/ReDqq4QG2nXf+rMnYLswesKVvTO84Bd46pDVm27o
5
+ meqw6sfYBmSs1roxL0gO7h8bsDLekgMkrzaggaNNasdwA7wCSGyE4MbVojlcdFTV
6
+ PEJCWDfH94sTLN1kfJZQOANfD7S9DYTaLGC+SZ1D3/fwDdCdAodPuk+2A8kQGAjD
7
+ Am6+2M3RWeSJAnQ1fRaNdXeJagRqDPRh081uQnriqxFuZ1t3Oh/23sXebwzUh2Cr
8
+ MrUmkdWtAgMBAAECggEABTtUz6ABT9+lvneQoClt8qGUoeIUtf/SbNQIf9KUOBzv
9
+ Dp64D9618gjNlGOgSOsh7Mbbh7J7pyUzW2ZqetddJ9lW2YlsgXTncPl11K0cGOyi
10
+ K/JXxK/nVwhr/g2LIiApgnzocma5n0gnKRiHjdgzoykMOz7YIdywiuDKR1glCRyG
11
+ +NLp+f7WCh6kqoIwCmhCIH1dTg+85wUhh/dCXyWyL1EPYSBlGO8ulaVhb2Ym5hpV
12
+ B7VDAqMkODgRyh5WfUiv+1Cvy6VVX+aay47z/tAt3eoEJa2bqItSZu7alaV8sxDq
13
+ gXJFSd6j4dofeSFO9qODKoPXRrDEfA6LDCYduQ5KMQKBgQDg2llYa09vB7VesIYn
14
+ CzDK4ndLbjrcpre+KKf6pJfcMc0GI+biNzv9yg0vYRYSQExHbGdfOlf2loZHjK0Q
15
+ hr938GBQlvH0S81BWtLDe41Qogv7Fb5G4uuxrSJ33S2dn0frdQhDsTk5rgZ8/VFG
16
+ 2IQ1cbdqOW6jsy0VaYbdW0X2BQKBgQDgrFUDbIyXSj/KjuP5gm4dJBIkCxcRdK6V
17
+ ey2b6EtlYfjpPpMUZZFocYuLKnVa1+xRF65beu8YAC95srNkIUlIZFYTZ7A3cuQO
18
+ Lc3BQCzQ7smX3rY9p5W/mVfbuOV+pyulMoTa0892Bwp9a3InMT3wHW06HtgDo+Pk
19
+ dbsvXH8JiQKBgFp3f3sTseH6N/7hBxiuZ/M5KsYuk4Azk7nuoac2keMGJndR+pMJ
20
+ phl2MdfeOAMf25DhDLZDwyBzb5NaBkef72lSTW4fTTn9RZgF8saz7yeCC0/6b5QV
21
+ uL7D6hpP4wqIC2ewrqKNq3iJjBK92PWoJ4lZN3KFqP40GO+Ehb6J+pwBAoGBAK4J
22
+ 8OTxHktH0fiIDeNG/SOHwKG5EYqNF3xl6eO+40DKzvVnaqm/MA92/YC1SCkx4DbF
23
+ IGRu621tH1mnaz1iZ5EzYFYx2Rhq4Gx3YM6VduH2R6VkeUlzWxYLpDpplSUyPCYA
24
+ 51dYAnpMY/zZ0Zi4lWE+elEueWkAeNWNuY2rmiD5AoGBALKceX9ppLb5M8HwQEK8
25
+ rQ0FTYBaghm2sSOZU57KZY9YLNo56K76mEtl4iXWmPCchBP5ZYrcqXwsg+I0AHDw
26
+ yXGonYg2iz8FCAM9Z2ZL0unBvLaI990Jk/BUx+/LaKNCSevmIAsJHcNaKguTV+p1
27
+ srfPtuh8q+RA3txjrCxouA3B
28
+ -----END PRIVATE KEY-----
@@ -0,0 +1,76 @@
1
+ # Copyright (c) 2024, RTE (https://www.rte-france.com)
2
+ # See AUTHORS.txt
3
+ # SPDX-License-Identifier: MPL-2.0
4
+ # This file is part of BERTrend.
5
+
6
+ TOPIC_DESCRIPTION_PROMPT_EN = """
7
+ You are a topic analysis expert. Your task is to generate a clear, human-readable title and a detailed description for the given topic.
8
+
9
+ Input:
10
+ - Topic representation: {topic_representation}
11
+ - Context documents (may include excerpts, keywords, or summaries):
12
+ {docs_text}
13
+
14
+ Requirements:
15
+ 1) Title:
16
+ - Be concise (max 8 words)
17
+ - Be informative and specific
18
+ - Use Title Case
19
+ - Avoid jargon and buzzwords unless present in the context
20
+
21
+ 2) Description:
22
+ - ~100 words (90–120 words)
23
+ - Summarize the central idea and scope
24
+ - Highlight key themes, entities, or recurring concepts from the context
25
+ - Avoid copying long verbatim text from the context; paraphrase instead
26
+ - Be neutral, factual, and free of speculation
27
+ - Do not begin with generic phrases such as "This theme...", "This topic...", or "The theme...", or "The topic..."
28
+
29
+ 3) Style & Quality:
30
+ - No placeholders, no extraneous commentary
31
+ - No first-person voice
32
+ - No references to the prompt or instructions
33
+ - Start directly with substantive content (e.g., a key concept, scope, or claim), not with meta-introductions
34
+
35
+ Output format (strict JSON; no prose outside JSON):
36
+ "title": "Your title here",
37
+ "description": "Your ~100-word description here."
38
+ """
39
+
40
+ TOPIC_DESCRIPTION_PROMPT_FR = """
41
+ Vous êtes un expert en analyse de sujets. Votre tâche est de générer un titre clair et lisible ainsi qu’une description détaillée pour le sujet fourni.
42
+
43
+ Entrée :
44
+ - Représentation du sujet : {topic_representation}
45
+ - Contexte (extraits, mots-clés ou résumés) :
46
+ {docs_text}
47
+
48
+ Exigences :
49
+ 1) Titre :
50
+ - Concis (max. 8 mots)
51
+ - Informatif et spécifique
52
+ - Éviter le jargon sauf s’il apparaît dans le contexte
53
+
54
+ 2) Description :
55
+ - Environ 100 mots (90–120)
56
+ - Résumer l’idée centrale et le périmètre
57
+ - Mettre en avant les thèmes, entités ou concepts récurrents du contexte
58
+ - Ne pas copier de longs passages ; reformuler
59
+ - Ton neutre, factuel, sans spéculation
60
+ - Ne pas commencer par des formules génériques telles que « Ce thème… », « Ce sujet… » ou « Le thème… » ou « Le sujet… »
61
+
62
+ 3) Style & Qualité :
63
+ - Pas d’espaces réservés, pas de commentaires superflus
64
+ - Pas de première personne
65
+ - Aucune référence aux instructions
66
+ - Commencer directement par le contenu substantiel (concept clé, périmètre, ou idée centrale), sans méta-introduction
67
+
68
+ Format de sortie (JSON strict ; aucun texte hors du JSON) :
69
+ "title": "Votre titre ici",
70
+ "description": "Votre description (~100 mots) ici."
71
+ """
72
+
73
+ TOPIC_DESCRIPTION_PROMPT = {
74
+ "en": TOPIC_DESCRIPTION_PROMPT_EN,
75
+ "fr": TOPIC_DESCRIPTION_PROMPT_FR,
76
+ }
@@ -0,0 +1,308 @@
1
+ # Copyright (c) 2024, RTE (https://www.rte-france.com)
2
+ # See AUTHORS.txt
3
+ # SPDX-License-Identifier: MPL-2.0
4
+ # This file is part of BERTrend.
5
+ import os
6
+ from datetime import datetime
7
+ from pathlib import Path
8
+
9
+ from jinja2 import Template, Environment, FileSystemLoader
10
+ from loguru import logger
11
+
12
+ from bertrend import OUTPUT_PATH
13
+ from bertrend.trend_analysis.data_structure import TopicSummaryList, SignalAnalysis
14
+
15
+ # Global variables for prompts
16
+ SIGNAL_INTRO = {
17
+ "en": """As an elite strategic foresight analyst with extensive expertise across multiple domains and industries, your task is to conduct a comprehensive evaluation of a potential signal derived from the following topic summary:
18
+
19
+ {summary_from_first_prompt}
20
+
21
+ Leverage your knowledge and analytical skills to provide an in-depth analysis of this signal's potential impact and evolution:
22
+ """,
23
+ "fr": """En tant qu'analyste de prospective stratégique d'élite avec une expertise étendue dans de multiples domaines et industries, votre tâche est de mener une évaluation complète d'un signal potentiel dérivé du résumé de sujet suivant :
24
+
25
+ {summary_from_first_prompt}
26
+
27
+ Utilisez vos connaissances et compétences analytiques pour fournir une analyse approfondie de l'impact potentiel et de l'évolution de ce signal :
28
+ """,
29
+ }
30
+
31
+ SIGNAL_INSTRUCTIONS = {
32
+ "en": """
33
+ Analyze this signal only if the input data is sufficiently complete and substantive. If the subject summary lacks completeness, substance, specificity, or novelty, respond with an empty JSON dictionary: {}
34
+
35
+ === DECISION RULES (STRICT SUFFICIENCY) ===
36
+ - Overall Sufficiency: Proceed with analysis only if the topic summary contains enough concrete, non-trivial information to support evidence-based reasoning across at least one analysis dimension (Impact, Evolution, Interconnections, Drivers/Inhibitors).
37
+ - Section Sufficiency: For each analysis section (Impact, Evolution Scenarios, Interconnections and Synergies, Drivers and Inhibitors), include the section ONLY if the input contains enough detail to meet the Minimum Quality Requirements. If not, omit the section entirely (do not include placeholders).
38
+ - Evidence-First: Prefer omission over speculation. Do not infer facts not supported by the provided summary.
39
+
40
+ For substantial signals, provide the following sections (include only those that meet the standards; omit any that do not):
41
+
42
+ 1. Potential Impact Analysis:
43
+ - Examine potential effects on sectors, industries, and societal aspects.
44
+ - Cover immediate (1–2 years), medium (3–5 years), and long-term (5–10 years) horizons.
45
+ - Include ripple effects and second-order consequences when supportable.
46
+
47
+ 2. Evolution Scenarios:
48
+ - Describe plausible future developments and manifestation paths.
49
+ - Identify factors shaping the trajectory.
50
+ - Provide both optimistic and pessimistic scenarios only if both are sufficiently supported; otherwise include the supported one(s) and omit the rest.
51
+
52
+ 3. Interconnections and Synergies:
53
+ - Identify interactions with current trends or emerging phenomena.
54
+ - Discuss synergies or conflicts with existing systems or paradigms.
55
+
56
+ 4. Drivers and Inhibitors:
57
+ - Analyze accelerants and amplifiers of the signal.
58
+ - Examine barriers, constraints, or resistances.
59
+
60
+ Your analysis should be thorough and nuanced, going beyond surface-level observations, and grounded in the provided content. Make well-reasoned predictions only when they are logically supported by the input. If analysis cannot be substantiated with clear reasoning, omit that section.
61
+
62
+ === OUTPUT QUALITY STANDARDS ===
63
+ Avoid:
64
+ - Vague generalizations
65
+ - Obvious conclusions without new insight
66
+ - Insufficient evidence
67
+ - Generic observations
68
+ - Circular reasoning
69
+ - Superficial treatment
70
+ - Unsubstantiated speculation
71
+ - Outdated perspectives
72
+
73
+ === MINIMUM QUALITY REQUIREMENTS (APPLY PER SECTION) ===
74
+ Each included section must demonstrate at least 2 of:
75
+ - Specific Context: Clear temporal, geographic, or sectoral boundaries with examples
76
+ - Concrete Evidence: Quantifiable insights, verifiable examples, or substantiated claims from the input
77
+ - Novel Perspectives: Non-obvious connections or emerging patterns grounded in the input
78
+ - Actionable Intelligence: Guidance that enables decision-making or planning
79
+ - Cross-Domain Impact: Implications across multiple sectors or domains
80
+ - Measurable Dimensions: Metrics, indicators, or tracking mechanisms
81
+ - Causal Analysis: Clear cause-and-effect or contributing factors
82
+ - Strategic Relevance: Direct link to business, policy, or societal decisions
83
+
84
+ === OUTPUT REQUIREMENTS ===
85
+ - Section-Level Omission: Omit any section that cannot meet the Minimum Quality Requirements with the provided information.
86
+ - Evidence-Based: Use specific, quantifiable language with concrete examples derived from the input.
87
+ - Confidence Levels: Clearly distinguish high-confidence assessments from speculative insights.
88
+ - Decision-Focused: Prioritize actionable intelligence for strategic decision-makers.
89
+ - Balanced Objectivity: Maintain rigor while acknowledging uncertainties and limitations.
90
+ - Temporal Structure: Organize insights across immediate (1–2 years), medium (3–5 years), and long-term (5–10 years) where applicable.
91
+ - Final Validation: Before finalizing, remove any statement that cannot be traced to or logically derived from the provided summary.
92
+
93
+ If no section can meet these standards, return an empty JSON dictionary: {}
94
+ """,
95
+ "fr": """
96
+ Analysez ce signal uniquement si les données d’entrée sont suffisamment complètes et substantielles. Si le résumé du sujet manque de complétude, de substance, de spécificité ou de nouveauté, répondez avec un dictionnaire JSON vide : {}
97
+
98
+ === RÈGLES DE DÉCISION (SUFFISANCE STRICTE) ===
99
+ - Suffisance Globale : Poursuivez l’analyse uniquement si le résumé contient des informations concrètes et non triviales permettant un raisonnement fondé sur des preuves pour au moins une dimension d’analyse (Impact, Évolution, Interconnexions, Moteurs/Inhibiteurs).
100
+ - Suffisance par Section : Pour chaque section (Impact, Scénarios d’Évolution, Interconnexions et Synergies, Moteurs et Inhibiteurs), incluez la section UNIQUEMENT si les informations permettent d’atteindre les Exigences Minimales de Qualité. Sinon, omettez entièrement la section (pas d’espace réservé).
101
+ - Primauté des Preuves : Préférez l’omission à la spéculation. N’inférez pas de faits non étayés par le résumé fourni.
102
+
103
+ Pour les signaux substantiels, fournissez les sections suivantes (n’incluez que celles qui respectent les standards ; omettez celles qui ne les atteignent pas) :
104
+
105
+ 1. Analyse de l’Impact Potentiel :
106
+ - Effets potentiels sur secteurs, industries et aspects sociétaux.
107
+ - Couvrez les horizons immédiat (1–2 ans), moyen (3–5 ans) et long terme (5–10 ans).
108
+ - Incluez les effets d’entraînement et de second ordre lorsque c’est étayé.
109
+
110
+ 2. Scénarios d’Évolution :
111
+ - Décrivez des développements plausibles et voies de manifestation futures.
112
+ - Identifiez les facteurs influençant la trajectoire.
113
+ - Fournissez des scénarios optimistes et pessimistes uniquement si tous deux sont suffisamment étayés ; sinon, incluez seulement ceux qui le sont et omettez le reste.
114
+
115
+ 3. Interconnexions et Synergies :
116
+ - Interactions avec les tendances actuelles ou phénomènes émergents.
117
+ - Synergies ou conflits avec les systèmes ou paradigmes existants.
118
+
119
+ 4. Moteurs et Inhibiteurs :
120
+ - Facteurs accélérateurs/amplificateurs du signal.
121
+ - Obstacles, contraintes ou résistances.
122
+
123
+ Votre analyse doit être approfondie, nuancée et ancrée dans le contenu fourni. Proposez des prédictions bien raisonnées uniquement lorsqu’elles sont logiquement étayées par l’entrée. Si une section ne peut être étayée par un raisonnement clair, omettez-la.
124
+
125
+ === STANDARDS DE QUALITÉ DE SORTIE ===
126
+ À éviter :
127
+ - Généralisations vagues
128
+ - Conclusions évidentes sans nouveaux éclairages
129
+ - Preuves insuffisantes
130
+ - Observations génériques
131
+ - Raisonnement circulaire
132
+ - Traitement superficiel
133
+ - Spéculation non étayée
134
+ - Perspectives obsolètes
135
+
136
+ === EXIGENCES MINIMALES DE QUALITÉ (PAR SECTION) ===
137
+ Chaque section incluse doit démontrer au moins 2 des éléments suivants :
138
+ - Contexte Spécifique : Limites temporelles, géographiques ou sectorielles claires avec exemples
139
+ - Preuves Concrètes : Insights quantifiables, exemples vérifiables, ou affirmations étayées par l’entrée
140
+ - Perspectives Nouvelles : Connexions non évidentes ou schémas émergents ancrés dans l’entrée
141
+ - Intelligence Actionnable : Conseils permettant la décision ou la planification
142
+ - Impact Trans-Domaine : Implications multi-sectorielles
143
+ - Dimensions Mesurables : Métriques, indicateurs ou mécanismes de suivi
144
+ - Analyse Causale : Relations de cause à effet ou facteurs contributifs clairs
145
+ - Pertinence Stratégique : Lien direct avec décisions business, politiques ou sociétales
146
+
147
+ === EXIGENCES DE SORTIE ===
148
+ - Omission par Section : Omettez toute section qui ne peut atteindre les exigences minimales avec les informations disponibles.
149
+ - Basé sur les Preuves : Utilisez un langage spécifique et quantifiable avec des exemples concrets tirés de l’entrée.
150
+ - Niveaux de Confiance : Distinguez clairement les évaluations à haute confiance des insights spéculatifs.
151
+ - Orienté Décision : Priorisez l’intelligence actionnable pour les décideurs stratégiques.
152
+ - Objectivité Équilibrée : Rigueur analytique en reconnaissant les incertitudes et limitations.
153
+ - Structure Temporelle : Organisez les insights sur les horizons immédiat (1–2 ans), moyen (3–5 ans) et long terme (5–10 ans) lorsque pertinent.
154
+ - Validation Finale : Avant de finaliser, retirez toute affirmation qui ne peut être retracée ou logiquement dérivée du résumé fourni.
155
+
156
+ Si aucune section ne peut respecter ces standards, renvoyez un dictionnaire JSON vide : {}
157
+ """,
158
+ }
159
+
160
+ TOPIC_SUMMARY_PROMPT = {
161
+ "en": """
162
+ As an expert analyst specializing in trend analysis and strategic foresight, your task is to provide a comprehensive evolution summary of Topic {topic_number}. Use only the information provided below:
163
+
164
+ {content_summary}
165
+
166
+ Structure your analysis as follows:
167
+
168
+ For the first timestamp:
169
+
170
+ ## [Concise yet impactful title capturing the essence of the topic at this point]
171
+ ### Date: [Relevant date or time frame - format %Y-%m-%d]
172
+ ### Key Developments
173
+ - [Bullet point summarizing a major development or trend]
174
+ - [Additional bullet points as needed]
175
+
176
+ ### Analysis
177
+ [2-3 sentences maximum providing deeper insights into the developments, their potential implications, and their significance in the broader context of the topic's evolution]
178
+
179
+ For all subsequent timestamps:
180
+
181
+ ## [Concise yet impactful title capturing the essence of the topic at this point]
182
+ ### Date: [Relevant date or time frame - format %Y-%m-%d]
183
+ ### Key Developments
184
+ - [Bullet point summarizing a major development or trend]
185
+ - [Additional bullet points as needed]
186
+
187
+ ### Analysis
188
+ [2-3 sentences maximum providing deeper insights into the developments, their potential implications, and their significance in the broader context of the topic's evolution]
189
+
190
+ ### What's New
191
+ [1-2 sentences maximum highlighting how this period differs from the previous one, focusing on new elements or significant changes]
192
+
193
+ Provide your analysis using only this format, based solely on the information given. Do not include any additional summary or overview sections beyond what is specified in this structure.
194
+ """,
195
+ "fr": """
196
+ En tant qu'analyste expert spécialisé dans l'analyse des tendances et la prospective stratégique, votre tâche est de fournir un résumé complet de l'évolution du Sujet {topic_number}. Utilisez uniquement les informations fournies ci-dessous :
197
+
198
+ {content_summary}
199
+
200
+ Structurez votre analyse comme suit :
201
+
202
+ Pour le premier timestamp :
203
+
204
+ ## [Titre concis mais percutant capturant l'essence du sujet à ce moment]
205
+ ### Date : [Date ou période pertinente - format %Y-%m-%d]
206
+ ### Développements Clés
207
+ - [Point résumant un développement majeur ou une tendance]
208
+ - [Points supplémentaires si nécessaire]
209
+
210
+ ### Analyse
211
+ [2-3 phrases maximum fournissant des insights plus profonds sur les développements, leurs implications potentielles et leur importance dans le contexte plus large de l'évolution du sujet]
212
+
213
+ Pour tous les timestamps suivants :
214
+
215
+ ## [Titre concis mais percutant capturant l'essence du sujet à ce moment]
216
+ ### Date : [Date ou période pertinente - format %Y-%m-%d]
217
+ ### Développements Clés
218
+ - [Point résumant un développement majeur ou une tendance]
219
+ - [Points supplémentaires si nécessaire]
220
+
221
+ ### Analyse
222
+ [2-3 phrases maximum fournissant des insights plus profonds sur les développements, leurs implications potentielles et leur importance dans le contexte plus large de l'évolution du sujet]
223
+
224
+ ### Nouveautés
225
+ [1-2 phrases maximum soulignant en quoi cette période diffère de la précédente, en se concentrant sur les nouveaux éléments ou les changements significatifs]
226
+
227
+ Fournissez votre analyse en utilisant uniquement ce format, basé uniquement sur les informations données. N'incluez pas de sections de résumé ou d'aperçu supplémentaires au-delà de ce qui est spécifié dans cette structure.
228
+ """,
229
+ }
230
+
231
+
232
+ def get_prompt(
233
+ language: str,
234
+ prompt_type: str,
235
+ topic_number: int = None,
236
+ content_summary: str = None,
237
+ summary_from_first_prompt: str = None,
238
+ ):
239
+ lang = "en" if language == "English" else "fr"
240
+
241
+ if prompt_type == "weak_signal":
242
+ prompt = (
243
+ SIGNAL_INTRO[lang].format(
244
+ summary_from_first_prompt=summary_from_first_prompt
245
+ )
246
+ + SIGNAL_INSTRUCTIONS[lang]
247
+ )
248
+
249
+ elif prompt_type == "topic_summary":
250
+ prompt = TOPIC_SUMMARY_PROMPT[lang].format(
251
+ topic_number=topic_number, content_summary=content_summary
252
+ )
253
+ else:
254
+ raise ValueError(f"Unsupported prompt type: {prompt_type}")
255
+
256
+ return prompt
257
+
258
+
259
+ def save_html_output(html_output, output_file="signal_llm.html"):
260
+ """Function to save the model's output as HTML"""
261
+ output_path = OUTPUT_PATH / output_file
262
+
263
+ # Save the cleaned HTML
264
+ with open(output_path, "w", encoding="utf-8") as file:
265
+ file.write(html_output)
266
+ logger.debug(f"Cleaned HTML output saved to {output_path}")
267
+
268
+
269
+ def fill_html_template(
270
+ topic_summary_list: TopicSummaryList,
271
+ signal_analysis: SignalAnalysis,
272
+ language: str = "fr",
273
+ ) -> str:
274
+ """Fill the HTML template with appropriate data"""
275
+ # Setup Jinja2 environment
276
+ template_dir = os.path.dirname(os.path.abspath(__file__))
277
+ env = Environment(
278
+ loader=FileSystemLoader(template_dir),
279
+ )
280
+ template = env.get_template(
281
+ "signal_llm_template_en.html"
282
+ if language == "en"
283
+ else "signal_llm_template_fr.html"
284
+ )
285
+
286
+ # Sort the list by date from most recent to least recent
287
+ try:
288
+ sorted_topic_summary_by_time_period = sorted(
289
+ topic_summary_list.topic_summary_by_time_period,
290
+ key=lambda x: datetime.strptime(x.date, "%Y-%m-%d"),
291
+ reverse=True,
292
+ )
293
+ topic_summary_list.topic_summary_by_time_period = (
294
+ sorted_topic_summary_by_time_period
295
+ )
296
+ except Exception as e:
297
+ logger.warning("Cannot sort summaries by date, probably wrong date format")
298
+
299
+ # Render the template with the provided data
300
+ rendered_html = template.render(
301
+ topic_summary_list=topic_summary_list, signal_analysis=signal_analysis
302
+ )
303
+
304
+ # FIXME: many \n are added...
305
+ rendered_html = rendered_html.replace("\n", "")
306
+ rendered_html = rendered_html.replace("\\'", "'")
307
+
308
+ return rendered_html
@@ -28,12 +28,13 @@ URLS_COLUMN = "URLs"
28
28
  # Models & analysis
29
29
  DEFAULT_GRANULARITY = 7
30
30
  DEFAULT_WINDOW_SIZE = 7
31
+ DEFAULT_LANGUAGE = "en"
31
32
 
32
33
  DEFAULT_ANALYSIS_CFG = {
33
34
  "model_config": {
34
35
  "granularity": DEFAULT_GRANULARITY,
35
36
  "window_size": DEFAULT_WINDOW_SIZE,
36
- "language": "English",
37
+ "language": DEFAULT_LANGUAGE,
37
38
  "split_by_paragraph": True,
38
39
  },
39
40
  "analysis_config": {
@@ -118,7 +118,7 @@ def display_detailed_analysis(
118
118
  desc["analysis"]
119
119
  )
120
120
  # Use current language for HTML template
121
- lang = get_current_internationalization_language()
121
+ lang = st.session_state.model_analysis_cfg[model_id]["model_config"]["language"]
122
122
  formatted_html = fill_html_template(summaries, signal_analysis, lang)
123
123
  st.html(formatted_html)
124
124