naeural-client 2.7.5__tar.gz → 2.7.6__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 (155) hide show
  1. {naeural_client-2.7.5 → naeural_client-2.7.6}/PKG-INFO +1 -1
  2. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/_ver.py +1 -1
  3. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/generic_session.py +3 -3
  4. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/environment.py +3 -3
  5. {naeural_client-2.7.5 → naeural_client-2.7.6}/nepctl.MD +1 -1
  6. {naeural_client-2.7.5 → naeural_client-2.7.6}/pyproject.toml +1 -1
  7. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/.example_env +1 -1
  8. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex01_part1_connect.py +16 -3
  9. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex01_part2_filter.py +8 -4
  10. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex01_part3_adv_filter.py +11 -1
  11. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex02_part1_deploy_webapi.py +15 -3
  12. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex02_part2_deploy_plugin.py +14 -4
  13. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex08_custom_webapi.py +1 -1
  14. naeural_client-2.7.6/tutorials/ex10_telegram_echo_bot.py +57 -0
  15. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex11_telegram_blackjack_bot.py +23 -3
  16. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex12_telegram_smart_bot.py +12 -8
  17. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex13_launch_repo_based_webapp.py +2 -2
  18. naeural_client-2.7.5/tutorials/ex10_telegram_echo_bot.py +0 -45
  19. {naeural_client-2.7.5 → naeural_client-2.7.6}/.devcontainer/Dockerfile +0 -0
  20. {naeural_client-2.7.5 → naeural_client-2.7.6}/.devcontainer/devcontainer.json +0 -0
  21. {naeural_client-2.7.5 → naeural_client-2.7.6}/.gitattributes +0 -0
  22. {naeural_client-2.7.5 → naeural_client-2.7.6}/.github/workflows/python-publish.yml +0 -0
  23. {naeural_client-2.7.5 → naeural_client-2.7.6}/.gitignore +0 -0
  24. {naeural_client-2.7.5 → naeural_client-2.7.6}/.vscode/launch.json +0 -0
  25. {naeural_client-2.7.5 → naeural_client-2.7.6}/LICENSE +0 -0
  26. {naeural_client-2.7.5 → naeural_client-2.7.6}/README.md +0 -0
  27. {naeural_client-2.7.5 → naeural_client-2.7.6}/TODOs.md +0 -0
  28. {naeural_client-2.7.5 → naeural_client-2.7.6}/__init__.py +0 -0
  29. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/__init__.py +0 -0
  30. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/__init__.py +0 -0
  31. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/distributed_custom_code_presets.py +0 -0
  32. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/instance.py +0 -0
  33. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/payload/__init__.py +0 -0
  34. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/payload/payload.py +0 -0
  35. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/pipeline.py +0 -0
  36. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/plugin_template.py +0 -0
  37. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/responses.py +0 -0
  38. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/transaction.py +0 -0
  39. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base/webapp_pipeline.py +0 -0
  40. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/base_decentra_object.py +0 -0
  41. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/bc/__init__.py +0 -0
  42. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/bc/base.py +0 -0
  43. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/bc/chain.py +0 -0
  44. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/bc/ec.py +0 -0
  45. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/certs/__init__.py +0 -0
  46. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt +0 -0
  47. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/certs/s624dbd4.ala.us-east-1.emqxsl.com.crt +0 -0
  48. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/cli/README.md +0 -0
  49. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/cli/cli.py +0 -0
  50. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/cli/cli_commands.py +0 -0
  51. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/cli/nodes.py +0 -0
  52. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/cli/oracles.py +0 -0
  53. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/code_cheker/__init__.py +0 -0
  54. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/code_cheker/base.py +0 -0
  55. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/code_cheker/checker.py +0 -0
  56. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/comm/__init__.py +0 -0
  57. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/comm/amqp_wrapper.py +0 -0
  58. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/comm/mqtt_wrapper.py +0 -0
  59. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/README.md +0 -0
  60. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/__init__.py +0 -0
  61. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/apps.py +0 -0
  62. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/base.py +0 -0
  63. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/comms.py +0 -0
  64. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/formatter.py +0 -0
  65. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/heartbeat.py +0 -0
  66. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/misc.py +0 -0
  67. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/const/payload.py +0 -0
  68. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/__init__.py +0 -0
  69. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/__init__.py +0 -0
  70. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +0 -0
  71. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/custom_webapi_01_plugin.py +0 -0
  72. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/net_mon_01_plugin.py +0 -0
  73. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/telegram_basic_bot_01_plugin.py +0 -0
  74. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/telegram_conversational_bot_01_plugin.py +0 -0
  75. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/instance/view_scene_01_plugin.py +0 -0
  76. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/default/session/mqtt_session.py +0 -0
  77. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/__init__.py +0 -0
  78. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/base/__init__.py +0 -0
  79. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/base/base_formatter.py +0 -0
  80. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/default/__init__.py +0 -0
  81. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/default/a_dummy.py +0 -0
  82. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/default/aixp1.py +0 -0
  83. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/default/default.py +0 -0
  84. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/io_formatter/io_formatter_manager.py +0 -0
  85. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/__init__.py +0 -0
  86. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/base_logger.py +0 -0
  87. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/__init__.py +0 -0
  88. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/class_instance_mixin.py +0 -0
  89. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/computer_vision_mixin.py +0 -0
  90. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/datetime_mixin.py +0 -0
  91. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/download_mixin.py +0 -0
  92. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/general_serialization_mixin.py +0 -0
  93. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/json_serialization_mixin.py +0 -0
  94. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/pickle_serialization_mixin.py +0 -0
  95. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/process_mixin.py +0 -0
  96. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/resource_size_mixin.py +0 -0
  97. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/timers_mixin.py +0 -0
  98. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/upload_mixin.py +0 -0
  99. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/logger_mixins/utils_mixin.py +0 -0
  100. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/small_logger.py +0 -0
  101. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/tzlocal/__init__.py +0 -0
  102. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/tzlocal/unix.py +0 -0
  103. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/tzlocal/utils.py +0 -0
  104. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/tzlocal/win32.py +0 -0
  105. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/logging/tzlocal/windows_tz.py +0 -0
  106. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/plugins_manager_mixin.py +0 -0
  107. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/utils/__init__.py +0 -0
  108. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/utils/comm_utils.py +0 -0
  109. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/utils/config.py +0 -0
  110. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/utils/dotenv.py +0 -0
  111. {naeural_client-2.7.5 → naeural_client-2.7.6}/naeural_client/utils/oracle_sync/oracle_tester.py +0 -0
  112. {naeural_client-2.7.5 → naeural_client-2.7.6}/requirements.txt +0 -0
  113. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/8. custom_code_fastapi_assets/index.html +0 -0
  114. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/9. code_sandbox_from_scratch_assets/index.html +0 -0
  115. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/_example_pk_sdk.pem +0 -0
  116. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex03_custom_code_on_one_remote__example_1.py +0 -0
  117. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex04_custom_code_on_one_remote__example_2.py +0 -0
  118. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex05_custom_code_on_one_remote__example_3.py +0 -0
  119. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex06_custom_code_on_multiple_remotes__example_1.py +0 -0
  120. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex07_custom_code_on_multiple_remotes__example_2.py +0 -0
  121. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/ex09_code_sandbox_from_scratch.py +0 -0
  122. {naeural_client-2.7.5 → naeural_client-2.7.6}/tutorials/video_presentation/1. hello_world.ipynb +0 -0
  123. {naeural_client-2.7.5 → naeural_client-2.7.6}/winrun.bat +0 -0
  124. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/README.md +0 -0
  125. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/auth_check.py +0 -0
  126. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/cstore_check.py +0 -0
  127. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/keys_check.py +0 -0
  128. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/ora_check.py +0 -0
  129. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/payload_check.py +0 -0
  130. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/session_check.py +0 -0
  131. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/_checks/web3_check.py +0 -0
  132. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/decentralized/chain_dist_example.py +0 -0
  133. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/decentralized/chain_dist_example_initiator.py +0 -0
  134. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/decentralized/chain_dist_example_worker.py +0 -0
  135. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/enc_dec/enc_dec_test.py +0 -0
  136. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/eth/eth_sign.py +0 -0
  137. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/eth/info.md +0 -0
  138. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/eth/sign.py +0 -0
  139. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/multi-enc-dec/multi_test1.py +0 -0
  140. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/multi-enc-dec/multi_test2.py +0 -0
  141. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/sign/simple_payload_checker.py +0 -0
  142. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/sign/test_sign1.py +0 -0
  143. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/sign/test_sign2.py +0 -0
  144. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/test1.py +0 -0
  145. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/utils/get_documentation.py +0 -0
  146. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/various/attach_example.py +0 -0
  147. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/various/ex1.py +0 -0
  148. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/various/hello.py +0 -0
  149. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/various/remote_exec.py +0 -0
  150. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/various/save_images.py +0 -0
  151. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/wl/wl_add.py +0 -0
  152. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/xarchive/_tutorials/3. simple_real_time_custom_code.py +0 -0
  153. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/xarchive/_tutorials/4. real_time_custom_code_2.py +0 -0
  154. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/xarchive/_tutorials/8. chatbot.py +0 -0
  155. {naeural_client-2.7.5 → naeural_client-2.7.6}/xperimental/xarchive/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.5
3
+ Version: 2.7.6
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -1,4 +1,4 @@
1
- __VER__ = "2.7.5"
1
+ __VER__ = "2.7.6"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -2388,13 +2388,13 @@ class GenericSession(BaseDecentrAIObject):
2388
2388
  if telegram_bot_token is None:
2389
2389
  telegram_bot_token = os.getenv(telegram_bot_token_env_key)
2390
2390
  if telegram_bot_token is None:
2391
- message = f"Warning! No Telegram bot token provided as via env {ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY} or explicitly as `telegram_bot_token` param."
2391
+ message = f"Warning! No Telegram bot token provided as via env '{telegram_bot_token_env_key}' or explicitly as `telegram_bot_token` param."
2392
2392
  raise ValueError(message)
2393
2393
 
2394
2394
  if telegram_bot_name is None:
2395
- telegram_bot_name = os.getenv(telegram_bot_name_env_key)
2395
+ telegram_bot_name = os.getenv(telegram_bot_name_env_key, name)
2396
2396
  if telegram_bot_name is None:
2397
- message = f"Warning! No Telegram bot name provided as via env {ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY} or explicitly as `telegram_bot_name` param."
2397
+ message = f"Warning! No Telegram bot name provided as via env '{telegram_bot_name_env_key}' or explicitly as `telegram_bot_name` param."
2398
2398
  raise ValueError(message)
2399
2399
 
2400
2400
 
@@ -29,7 +29,7 @@ class ENVIRONMENT:
29
29
  EE_SECURED = 'EE_SECURED'
30
30
  AIXP_SECURED = 'AIXP_SECURED'
31
31
 
32
- TELEGRAM_BOT_TOKEN_ENV_KEY = 'TELEGRAM_BOT_TOKEN'
33
- TELEGRAM_BOT_NAME_ENV_KEY = 'TELEGRAM_BOT_NAME'
32
+ TELEGRAM_BOT_TOKEN_ENV_KEY = 'EE_TELEGRAM_BOT_TOKEN'
33
+ TELEGRAM_BOT_NAME_ENV_KEY = 'EE_TELEGRAM_BOT_NAME'
34
34
 
35
- TELEGRAM_API_AGENT_TOKEN_ENV_KEY = 'TELEGRAM_API_AGENT_TOKEN'
35
+ TELEGRAM_API_AGENT_TOKEN_ENV_KEY = 'EE_TELEGRAM_API_AGENT_TOKEN'
@@ -21,7 +21,7 @@ EE_MQTT=
21
21
 
22
22
  EE_SECURED=true
23
23
 
24
- TARGET_NODE=
24
+ EE_TARGET_NODE=
25
25
  ```
26
26
 
27
27
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "naeural_client"
7
- version = "2.7.5"
7
+ version = "2.7.6"
8
8
  authors = [
9
9
  { name="Andrei Ionut Damian", email="andrei.damian@me.com" },
10
10
  { name="Cristan Bleotiu", email="cristibleotiu@gmail.com" },
@@ -5,4 +5,4 @@ EE_HOSTNAME=r9092118.ala.eu-central-1.emqxsl.com
5
5
  EE_PORT=8883
6
6
  EE_SECURED=true
7
7
 
8
- TARGET_NODE=0xai....
8
+ EE_TARGET_NODE=0xai....
@@ -46,9 +46,22 @@ class MessageHandler:
46
46
  node_alias = heartbeat[PAYLOAD_DATA.EE_ID]
47
47
  short_addr = self.shorten_address(node_addr)
48
48
  cpu = heartbeat[HEARTBEAT_DATA.CPU]
49
- if node_alias.startswith("mnoderunner"):
50
- self.hb = heartbeat
51
- session.P(f"{node_alias} <{short_addr}> has a {cpu}", color='magenta')
49
+ cpu_load = heartbeat[HEARTBEAT_DATA.CPU_USED]
50
+ mem = heartbeat[HEARTBEAT_DATA.MACHINE_MEMORY]
51
+ mem_avail = heartbeat[HEARTBEAT_DATA.AVAILABLE_MEMORY]
52
+ disk_avail = heartbeat[HEARTBEAT_DATA.AVAILABLE_DISK]
53
+ disk_total = heartbeat[HEARTBEAT_DATA.TOTAL_DISK]
54
+ disk_load = (disk_total - disk_avail) / disk_total * 100
55
+ mem_load = (mem - mem_avail) / mem * 100
56
+ self.hb = heartbeat # simple storage of the last heartbeat
57
+ plugins = heartbeat[HEARTBEAT_DATA.ACTIVE_PLUGINS] or []
58
+ pipelines = heartbeat[HEARTBEAT_DATA.CONFIG_STREAMS] or []
59
+ session.P(
60
+ "<{}> {} {} Load: {:.1f}% CPU, {:.1f}% RAM, {:.1f}% Disk, {} plugins, {} pipelines".format(
61
+ short_addr, node_alias, cpu, cpu_load, mem_load, disk_load, len(plugins), len(pipelines)
62
+ ),
63
+ color='magenta'
64
+ )
52
65
  return
53
66
 
54
67
 
@@ -134,9 +134,13 @@ if __name__ == '__main__':
134
134
 
135
135
  # Observation:
136
136
  # next code is not mandatory - it is used to keep the session open and cleanup the resources
137
- # in production, you would not need this code as the script can close after the pipeline will be sent
138
- session.run(
139
- wait=15, # wait for the user to stop the execution or a given time
140
- close_pipelines=True # when the user stops the execution, the remote edge-node pipelines will be closed
137
+ # due to the fact that this is a example/tutorial and maybe we dont want to keep the pipeline
138
+ # active after the session is closed we use close_pipelines=True
139
+ # in production, you would not need this code as the script can close
140
+ # after the pipeline will be sent
141
+ session.wait(
142
+ seconds=120, # we wait the session for 60 seconds
143
+ close_pipelines=True, # we close the pipelines after the session
144
+ close_session=True, # we close the session after the session
141
145
  )
142
146
  session.P("Main thread exiting...")
@@ -142,7 +142,17 @@ if __name__ == '__main__':
142
142
  # silent=True,
143
143
  )
144
144
 
145
- session.wait(seconds=20) # wait for the user to stop the execution or a given time
145
+ # Observation:
146
+ # next code is not mandatory - it is used to keep the session open and cleanup the resources
147
+ # due to the fact that this is a example/tutorial and maybe we dont want to keep the pipeline
148
+ # active after the session is closed we use close_pipelines=True
149
+ # in production, you would not need this code as the script can close
150
+ # after the pipeline will be sent
151
+ session.wait(
152
+ seconds=120, # we wait the session for 60 seconds
153
+ close_pipelines=True, # we close the pipelines after the session
154
+ close_session=True, # we close the session after the session
155
+ )
146
156
  session.P("Main thread exiting...")
147
157
 
148
158
  netinfo = session.get_network_known_nodes()
@@ -24,7 +24,13 @@ def run_predict(plugin: CustomPluginTemplate, inputs: list[int], nr_steps: int)
24
24
  if __name__ == '__main__':
25
25
 
26
26
  session = Session(silent=True)
27
+
27
28
  my_node = "0xai_ApM1AbzLq1VtsLIidmvzt1Nv4Cyl5Wed0fHNMoZv9u4X"
29
+
30
+ # NOTE: When working with SDK please use the nodes internal addresses. While the EVM address of the node
31
+ # is basically based on the same sk/pk it is in a different format and not directly usable with the SDK
32
+ # the internal node address is easily spoted as starting with 0xai_ and can be found
33
+ # via `docker exec r1node get_node_info` or via the launcher UI
28
34
 
29
35
  app, _ = session.create_web_app(
30
36
  node=my_node,
@@ -42,8 +48,14 @@ if __name__ == '__main__':
42
48
  except Exception as e:
43
49
  print("Error deploying webapp: ", e)
44
50
 
51
+ # Observation:
52
+ # next code is not mandatory - it is used to keep the session open and cleanup the resources
53
+ # due to the fact that this is a example/tutorial and maybe we dont want to keep the pipeline
54
+ # active after the session is closed we use close_pipelines=True
55
+ # in production, you would not need this code as the script can close
56
+ # after the pipeline will be sent
45
57
  session.wait(
46
- close_pipeline_on_timeout=True,
47
- close_session_on_timeout=True,
48
- seconds=300
58
+ seconds=120, # we wait the session for 60 seconds
59
+ close_pipelines=True, # we close the pipelines after the session
60
+ close_session=True, # we close the session after the session
49
61
  )
@@ -20,6 +20,12 @@ def instance_on_data(pipeline: Pipeline, data: Payload):
20
20
  if __name__ == '__main__':
21
21
  # create a session
22
22
  # the network credentials are read from the .env file automatically
23
+
24
+ # NOTE: When working with SDK please use the nodes internal addresses. While the EVM address of the node
25
+ # is basically based on the same sk/pk it is in a different format and not directly usable with the SDK
26
+ # the internal node address is easily spoted as starting with 0xai_ and can be found
27
+ # via `docker exec r1node get_node_info` or via the launcher UI
28
+
23
29
  session: Session = Session(encrypt_comms=True)
24
30
 
25
31
  session.wait_for_any_node()
@@ -57,9 +63,13 @@ if __name__ == '__main__':
57
63
 
58
64
  # Observation:
59
65
  # next code is not mandatory - it is used to keep the session open and cleanup the resources
60
- # in production, you would not need this code as the script can close after the pipeline will be sent
61
- session.run(
62
- wait=60, # wait for the user to stop the execution or a given time
63
- close_pipelines=True # when the user stops the execution, the remote edge-node pipelines will be closed
66
+ # due to the fact that this is a example/tutorial and maybe we dont want to keep the pipeline
67
+ # active after the session is closed we use close_pipelines=True
68
+ # in production, you would not need this code as the script can close
69
+ # after the pipeline will be sent
70
+ session.wait(
71
+ seconds=120, # we wait the session for 60 seconds
72
+ close_pipelines=True, # we close the pipelines after the session
73
+ close_session=True, # we close the session after the session
64
74
  )
65
75
  session.P("Main thread exiting...")
@@ -44,7 +44,7 @@ def predict(plugin: CustomPluginTemplate, series: list[int], steps: int) -> list
44
44
  if __name__ == "__main__":
45
45
  session = Session(silent=True)
46
46
 
47
- node = os.environ.get("TARGET_NODE", "INSERT_YOUR_NODE_ADDRESS_HERE")
47
+ node = os.environ.get("EE_TARGET_NODE", "INSERT_YOUR_NODE_ADDRESS_HERE")
48
48
  session.P(f"Waiting for node {node} to be available for deployment...")
49
49
  session.wait_for_node(node)
50
50
 
@@ -0,0 +1,57 @@
1
+ import os
2
+ import time
3
+
4
+ from naeural_client import Session, CustomPluginTemplate, PLUGIN_TYPES
5
+
6
+ def reply(plugin: CustomPluginTemplate, message: str, user: str):
7
+ """
8
+ This function is used to reply to a message. The given parameters are mandatory
9
+ """
10
+ # for each user message we increase a counter
11
+ plugin.int_cache[user] += 1 # int_cache is a default dict that allows persistence in the plugin
12
+ plugin.P(f"Replying to the {plugin.int_cache[user]} msg of '{user}' on message '{message}'")
13
+ result = f"The answer to your {plugin.int_cache[user]} question is in the question itself: {message}"
14
+ return result
15
+
16
+
17
+ if __name__ == "__main__":
18
+ session = Session()
19
+
20
+ # NOTE: When working with SDK please use the nodes internal addresses. While the EVM address of the node
21
+ # is basically based on the same sk/pk it is in a different format and not directly usable with the SDK
22
+ # the internal node address is easily spoted as starting with 0xai_ and can be found
23
+ # via `docker exec r1node get_node_info` or via the launcher UI
24
+
25
+ # this tutorial assumes you have started your own local node for dev-testing purposes
26
+ # you can either supply the node address via env or directly here
27
+ # Note: in order to get the environment variable first you have to create the Session
28
+ # object that will load the environment variables
29
+ my_node = os.getenv("EE_TARGET_NODE", "0xai_my_own_node_address")
30
+
31
+ session.wait_for_node(my_node)
32
+
33
+
34
+ # now we create a telegram bot pipeline & plugin instance and for that we only need the Telegram token
35
+ # we can chose to use the token directly via `telegram_bot_token` parameter
36
+ # or use the environment key EE_TELEGRAM_BOT_TOKEN
37
+ # in this case for this simple example we are going to use the token directly
38
+ pipeline, _ = session.create_telegram_simple_bot(
39
+ node=my_node,
40
+ name="telegram_bot_echo",
41
+ telegram_bot_token="your_token_goes_here", # we use the token directly
42
+ message_handler=reply,
43
+ )
44
+
45
+ pipeline.deploy() # we deploy the pipeline
46
+
47
+ # Observation:
48
+ # next code is not mandatory - it is used to keep the session open and cleanup the resources
49
+ # due to the fact that this is a example/tutorial and maybe we dont want to keep the pipeline
50
+ # active after the session is closed we use close_pipelines=True
51
+ # in production, you would not need this code as the script can close
52
+ # after the pipeline will be sent
53
+ session.wait(
54
+ seconds=120, # we wait the session for 120 seconds
55
+ close_pipelines=True, # we close the pipelines after the session
56
+ close_session=True, # we close the session after the session
57
+ )
@@ -186,12 +186,20 @@ def reply(plugin, message: str, user: str):
186
186
 
187
187
 
188
188
  if __name__ == "__main__":
189
- my_node = os.getenv("TARGET_NODE") # we can specify a node here, if we want to connect to a specific
190
189
 
191
- session = Session() # assume .env is available and will be used for the connection and tokens
190
+ session = Session()
191
+
192
+ # assume .env is available and will be used for the connection and tokens
193
+ # NOTE: When working with SDK please use the nodes internal addresses. While the EVM address of the node
194
+ # is basically based on the same sk/pk it is in a different format and not directly usable with the SDK
195
+ # the internal node address is easily spoted as starting with 0xai_ and can be found
196
+ # via `docker exec r1node get_node_info` or via the launcher UI
197
+ my_node = os.getenv("EE_TARGET_NODE", "0xai_your_node_address") # we can specify a node here, if we want to connect to a specific
198
+
192
199
  session.wait_for_node(my_node) # wait for the node to be active
193
200
 
194
-
201
+ # unlike the previous example, we are going to use the token from the environment
202
+ # and deploy the app on the target node and leave it there
195
203
  pipeline, _ = session.create_telegram_simple_bot(
196
204
  node=my_node,
197
205
  name="telegram_bot_blackjack",
@@ -200,4 +208,16 @@ if __name__ == "__main__":
200
208
 
201
209
  pipeline.deploy() # we deploy the pipeline
202
210
 
211
+
212
+ # Observation:
213
+ # next code is not mandatory - it is used to keep the session open and cleanup the resources
214
+ # due to the fact that this is a example/tutorial and maybe we dont want to keep the pipeline
215
+ # active after the session is closed we use close_pipelines=True
216
+ # in production, you would not need this code as the script can close
217
+ # after the pipeline will be sent
218
+ session.wait(
219
+ seconds=600, # we wait the session for 10 minutes
220
+ close_pipelines=True, # we close the pipelines after the session
221
+ close_session=True, # we close the session after the session
222
+ )
203
223
 
@@ -2,21 +2,25 @@ import os
2
2
  from naeural_client import Session
3
3
 
4
4
  if __name__ == "__main__":
5
- my_node = os.getenv("TARGET_NODE") # we specify a node here
6
- # The node can also be specified directly, without using the environment variable.
7
- # my_node = "<target_edge_node_identifier>"
8
5
 
9
- if my_node is None:
10
- # In case the node is not specified, we exit the script.
11
- print("Please specify the node to connect to.")
12
- exit(1)
13
-
14
6
  # We define the system prompt
15
7
  SYSTEM_PROMPT = """
16
8
  Hi! I am a simple echo bot. I will repeat everything you say to me.
17
9
  """
18
10
 
19
11
  session = Session() # assume .env is available and will be used for the connection and tokens
12
+
13
+ # NOTE: When working with SDK please use the nodes internal addresses. While the EVM address of the node
14
+ # is basically based on the same sk/pk it is in a different format and not directly usable with the SDK
15
+ # the internal node address is easily spoted as starting with 0xai_ and can be found
16
+ # via `docker exec r1node get_node_info` or via the launcher UI
17
+
18
+ my_node = os.getenv("EE_TARGET_NODE") # we specify a node here
19
+ # The node can also be specified directly, without using the environment variable.
20
+ # my_node = "<target_edge_node_identifier>"
21
+
22
+ assert my_node is not None, "Please provide the target edge node identifier"
23
+
20
24
  session.wait_for_node(my_node) # wait for the node to be active
21
25
 
22
26
  # Now we create a telegram bot pipeline & plugin instance.
@@ -12,8 +12,8 @@ if __name__ == "__main__":
12
12
  session = Session()
13
13
 
14
14
  nodes = [
15
- environ.get("TARGET_NODE_1", "INSERT_YOUR_NODE_ADDRESS_HERE"),
16
- environ.get("TARGET_NODE_2", "INSERT_YOUR_NODE_ADDRESS_HERE")
15
+ environ.get("EE_TARGET_NODE_1", "INSERT_YOUR_NODE_ADDRESS_HERE"),
16
+ environ.get("EE_TARGET_NODE_2", "INSERT_YOUR_NODE_ADDRESS_HERE")
17
17
  ]
18
18
 
19
19
  if isinstance(nodes, str):
@@ -1,45 +0,0 @@
1
- import os
2
- import time
3
-
4
- from naeural_client import Session, CustomPluginTemplate, PLUGIN_TYPES
5
-
6
- def reply(plugin: CustomPluginTemplate, message: str, user: str):
7
- """
8
- This function is used to reply to a message. The given parameters are mandatory
9
- """
10
- # for each user message we increase a counter
11
- plugin.int_cache[user] += 1 # int_cache is a default dict that allows persistence in the plugin
12
- plugin.P(f"Replying to the {plugin.int_cache[user]} msg of '{user}' on message '{message}'")
13
- result = f"The answer to your {plugin.int_cache[user]} question is in the question itself: {message}"
14
- return result
15
-
16
-
17
- if __name__ == "__main__":
18
- # TELEGRAM_BOT_TOKEN_ENV_KEY = "TELEGRAM_BOT_TOKEN" # this is the default - we can specify a env key here
19
- my_node = os.getenv("TARGET_NODE") # we can specify a node here, if we want to connect to a specific
20
-
21
- session = Session() # assume .env is available and will be used for the connection and tokens
22
- session.wait_for_node(my_node) # wait for the node to be active
23
-
24
-
25
- # now we create a telegram bot pipeline & plugin instance
26
- # we can chose to use the token directly or use the environment key
27
- # instance: PLUGIN_TYPES.TELEGRAM_BASIC_BOT_01
28
- pipeline, _ = session.create_telegram_simple_bot(
29
- node=my_node,
30
- name="telegram_bot_echo",
31
- # telegram_bot_token=os.getenv("TELEGRAM_BOT_TOKEN"), # we use the token directly
32
- # telegram_bot_token_env_key=TELEGRAM_BOT_TOKEN_ENV_KEY, # not mandatory - we can use the default
33
- message_handler=reply,
34
- )
35
-
36
- pipeline.deploy() # we deploy the pipeline
37
-
38
- # Observation:
39
- # next code is not mandatory - it is used to keep the session open and cleanup the resources
40
- # in production, you would not need this code as the script can close after the pipeline will be sent
41
- session.run(
42
- wait=120, # we run the session for 60 seconds
43
- close_pipelines=True, # we close the pipelines after the session
44
- close_session=True, # we close the session after the session
45
- )
File without changes
File without changes
File without changes