naeural-client 2.1.2__tar.gz → 2.1.3__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 (124) hide show
  1. {naeural_client-2.1.2 → naeural_client-2.1.3}/PKG-INFO +1 -1
  2. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/_ver.py +1 -1
  3. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/generic_session.py +144 -1
  4. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/apps.py +2 -1
  5. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/environment.py +2 -0
  6. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/instance/__init__.py +2 -2
  7. naeural_client-2.1.2/naeural_client/default/instance/basic_telegram_bot_01_plugin.py → naeural_client-2.1.3/naeural_client/default/instance/telegram_basic_bot_01_plugin.py +1 -1
  8. naeural_client-2.1.3/naeural_client/default/instance/telegram_conversational_bot_01_plugin.py +7 -0
  9. {naeural_client-2.1.2 → naeural_client-2.1.3}/pyproject.toml +1 -1
  10. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex10_telegram_echo_bot.py +4 -11
  11. naeural_client-2.1.3/tutorials/ex11_telegram_smart_bot.py +48 -0
  12. naeural_client-2.1.2/tutorials/ex11_telegram_smart_bot.py +0 -44
  13. {naeural_client-2.1.2 → naeural_client-2.1.3}/.devcontainer/Dockerfile +0 -0
  14. {naeural_client-2.1.2 → naeural_client-2.1.3}/.devcontainer/devcontainer.json +0 -0
  15. {naeural_client-2.1.2 → naeural_client-2.1.3}/.gitattributes +0 -0
  16. {naeural_client-2.1.2 → naeural_client-2.1.3}/.github/workflows/python-publish.yml +0 -0
  17. {naeural_client-2.1.2 → naeural_client-2.1.3}/.gitignore +0 -0
  18. {naeural_client-2.1.2 → naeural_client-2.1.3}/.vscode/launch.json +0 -0
  19. {naeural_client-2.1.2 → naeural_client-2.1.3}/LICENSE +0 -0
  20. {naeural_client-2.1.2 → naeural_client-2.1.3}/README.md +0 -0
  21. {naeural_client-2.1.2 → naeural_client-2.1.3}/TODOs.md +0 -0
  22. {naeural_client-2.1.2 → naeural_client-2.1.3}/__init__.py +0 -0
  23. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/__init__.py +0 -0
  24. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/__init__.py +0 -0
  25. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/distributed_custom_code_presets.py +0 -0
  26. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/instance.py +0 -0
  27. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/payload/__init__.py +0 -0
  28. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/payload/payload.py +0 -0
  29. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/pipeline.py +0 -0
  30. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/plugin_template.py +0 -0
  31. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/responses.py +0 -0
  32. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base/transaction.py +0 -0
  33. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/base_decentra_object.py +0 -0
  34. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/bc/__init__.py +0 -0
  35. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/bc/base.py +0 -0
  36. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/bc/chain.py +0 -0
  37. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/bc/ec.py +0 -0
  38. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/certs/__init__.py +0 -0
  39. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt +0 -0
  40. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/code_cheker/__init__.py +0 -0
  41. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/code_cheker/base.py +0 -0
  42. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/code_cheker/checker.py +0 -0
  43. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/comm/__init__.py +0 -0
  44. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/comm/amqp_wrapper.py +0 -0
  45. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/comm/mqtt_wrapper.py +0 -0
  46. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/README.md +0 -0
  47. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/__init__.py +0 -0
  48. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/base.py +0 -0
  49. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/comms.py +0 -0
  50. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/formatter.py +0 -0
  51. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/heartbeat.py +0 -0
  52. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/misc.py +0 -0
  53. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/const/payload.py +0 -0
  54. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/__init__.py +0 -0
  55. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +0 -0
  56. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/instance/custom_web_app_01_plugin.py +0 -0
  57. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/instance/net_mon_01_plugin.py +0 -0
  58. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/instance/view_scene_01_plugin.py +0 -0
  59. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/default/session/mqtt_session.py +0 -0
  60. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/__init__.py +0 -0
  61. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/base/__init__.py +0 -0
  62. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/base/base_formatter.py +0 -0
  63. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/default/__init__.py +0 -0
  64. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/default/a_dummy.py +0 -0
  65. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/default/aixp1.py +0 -0
  66. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/default/default.py +0 -0
  67. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/io_formatter/io_formatter_manager.py +0 -0
  68. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/__init__.py +0 -0
  69. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/base_logger.py +0 -0
  70. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/__init__.py +0 -0
  71. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/class_instance_mixin.py +0 -0
  72. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/computer_vision_mixin.py +0 -0
  73. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/datetime_mixin.py +0 -0
  74. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/download_mixin.py +0 -0
  75. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/general_serialization_mixin.py +0 -0
  76. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/json_serialization_mixin.py +0 -0
  77. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/pickle_serialization_mixin.py +0 -0
  78. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/process_mixin.py +0 -0
  79. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/resource_size_mixin.py +0 -0
  80. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/timers_mixin.py +0 -0
  81. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/upload_mixin.py +0 -0
  82. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/logger_mixins/utils_mixin.py +0 -0
  83. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/small_logger.py +0 -0
  84. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/tzlocal/__init__.py +0 -0
  85. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/tzlocal/unix.py +0 -0
  86. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/tzlocal/utils.py +0 -0
  87. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/tzlocal/win32.py +0 -0
  88. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/logging/tzlocal/windows_tz.py +0 -0
  89. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/plugins_manager_mixin.py +0 -0
  90. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/utils/__init__.py +0 -0
  91. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/utils/comm_utils.py +0 -0
  92. {naeural_client-2.1.2 → naeural_client-2.1.3}/naeural_client/utils/dotenv.py +0 -0
  93. {naeural_client-2.1.2 → naeural_client-2.1.3}/requirements.txt +0 -0
  94. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/.example_env +0 -0
  95. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/8. custom_code_fastapi_assets/index.html +0 -0
  96. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/9. code_sandbox_from_scratch_assets/index.html +0 -0
  97. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/_example_pk_sdk.pem +0 -0
  98. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex01_part1_connect.py +0 -0
  99. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex01_part2_filter.py +0 -0
  100. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex02_first_deploy.py +0 -0
  101. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex03_custom_code_on_one_remote__example_1.py +0 -0
  102. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex04_custom_code_on_one_remote__example_2.py +0 -0
  103. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex05_custom_code_on_one_remote__example_3.py +0 -0
  104. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex06_custom_code_on_multiple_remotes__example_1.py +0 -0
  105. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex07_custom_code_on_multiple_remotes__example_2.py +0 -0
  106. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex08_custom_web_app.py +0 -0
  107. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/ex09_code_sandbox_from_scratch.py +0 -0
  108. {naeural_client-2.1.2 → naeural_client-2.1.3}/tutorials/video_presentation/1. hello_world.ipynb +0 -0
  109. {naeural_client-2.1.2 → naeural_client-2.1.3}/winrun.bat +0 -0
  110. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/.example_env +0 -0
  111. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/README.md +0 -0
  112. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/_archive/test.py +0 -0
  113. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/_tutorials/3. simple_real_time_custom_code.py +0 -0
  114. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/_tutorials/4. real_time_custom_code_2.py +0 -0
  115. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/_tutorials/8. chatbot.py +0 -0
  116. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/attach_example.py +0 -0
  117. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/decentralized/chain_dist_example.py +0 -0
  118. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/decentralized/chain_dist_example_initiator.py +0 -0
  119. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/decentralized/chain_dist_example_worker.py +0 -0
  120. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/ex1.py +0 -0
  121. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/hello.py +0 -0
  122. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/remote_exec.py +0 -0
  123. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/save_images.py +0 -0
  124. {naeural_client-2.1.2 → naeural_client-2.1.3}/xperimental/utils/get_documentation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: naeural_client
3
- Version: 2.1.2
3
+ Version: 2.1.3
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/Naeural Edge ProtocolEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/Naeural Edge ProtocolEdgeProtocol/naeural_client/issues
@@ -1,4 +1,4 @@
1
- __VER__ = "2.1.2"
1
+ __VER__ = "2.1.3"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -1717,7 +1717,7 @@ class GenericSession(BaseDecentrAIObject):
1717
1717
  *,
1718
1718
  node,
1719
1719
  name,
1720
- signature=PLUGIN_SIGNATURES.BASIC_TELEGRAM_BOT_01,
1720
+ signature=PLUGIN_SIGNATURES.TELEGRAM_BASIC_BOT_01,
1721
1721
  message_handler=None,
1722
1722
  telegram_bot_token=None,
1723
1723
  telegram_bot_token_env_key=ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY,
@@ -1725,7 +1725,41 @@ class GenericSession(BaseDecentrAIObject):
1725
1725
  telegram_bot_name_env_key=ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY,
1726
1726
  **kwargs
1727
1727
  ):
1728
+ """
1729
+ Create a new basic Telegram bot on a node.
1730
+
1731
+ Parameters
1732
+ ----------
1728
1733
 
1734
+ node : str
1735
+ Address or Name of the Naeural Edge Protocol edge node that will handle this Telegram bot.
1736
+
1737
+ name : str
1738
+ Name of the Telegram bot.
1739
+
1740
+ signature : str, optional
1741
+ The signature of the plugin that will be used. Defaults to PLUGIN_SIGNATURES.TELEGRAM_BASIC_BOT_01.
1742
+
1743
+ message_handler : callable, optional
1744
+ The message handler function that will be called when a message is received. Defaults to None.
1745
+
1746
+ telegram_bot_token : str, optional
1747
+ The Telegram bot token. Defaults to None.
1748
+
1749
+ telegram_bot_token_env_key : str, optional
1750
+ The environment variable key that holds the Telegram bot token. Defaults to ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY.
1751
+
1752
+ telegram_bot_name : str, optional
1753
+ The Telegram bot name. Defaults to None.
1754
+
1755
+ telegram_bot_name_env_key : str, optional
1756
+ The environment variable key that holds the Telegram bot name. Defaults to ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY.
1757
+
1758
+ Returns
1759
+ -------
1760
+ tuple
1761
+ `Pipeline` and a `Instance` objects tuple.
1762
+ """
1729
1763
  assert callable(message_handler), "The `message_handler` method parameter must be provided."
1730
1764
 
1731
1765
  if telegram_bot_token is None:
@@ -1765,6 +1799,115 @@ class GenericSession(BaseDecentrAIObject):
1765
1799
  )
1766
1800
  return pipeline, instance
1767
1801
 
1802
+
1803
+ def create_telegram_conversational_bot(
1804
+ self,
1805
+ *,
1806
+ node,
1807
+ name,
1808
+ signature=PLUGIN_SIGNATURES.TELEGRAM_CONVERSATIONAL_BOT_01,
1809
+ telegram_bot_token=None,
1810
+ telegram_bot_token_env_key=ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY,
1811
+ telegram_bot_name=None,
1812
+ telegram_bot_name_env_key=ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY,
1813
+
1814
+ system_prompt=None,
1815
+ agent_type="API",
1816
+ api_token_env_key=ENVIRONMENT.TELEGRAM_API_AGENT_TOKEN_ENV_KEY,
1817
+ api_token=None,
1818
+ rag_source_url=None,
1819
+ **kwargs
1820
+ ):
1821
+
1822
+ """
1823
+ Create a new conversational Telegram bot on a node.
1824
+
1825
+ Parameters
1826
+ ----------
1827
+
1828
+ node : str
1829
+ Address or Name of the Naeural Edge Protocol edge node that will handle this Telegram bot.
1830
+
1831
+ name : str
1832
+ Name of the Telegram bot.
1833
+
1834
+ signature : str, optional
1835
+ The signature of the plugin that will be used. Defaults to PLUGIN_SIGNATURES.TELEGRAM_BASIC_BOT_01.
1836
+
1837
+ telegram_bot_token : str, optional
1838
+ The Telegram bot token. Defaults to None.
1839
+
1840
+ telegram_bot_token_env_key : str, optional
1841
+ The environment variable key that holds the Telegram bot token. Defaults to ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY.
1842
+
1843
+ telegram_bot_name : str, optional
1844
+ The Telegram bot name. Defaults to None.
1845
+
1846
+ telegram_bot_name_env_key : str, optional
1847
+ The environment variable key that holds the Telegram bot name. Defaults to ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY.
1848
+
1849
+ system_prompt : str, optional
1850
+ The system prompt. Defaults to None.
1851
+
1852
+ agent_type : str, optional
1853
+ The agent type. Defaults to "API".
1854
+
1855
+ api_token_env_key : str, optional
1856
+ The environment variable key that holds the API token. Defaults to ENVIRONMENT.TELEGRAM_API_AGENT_TOKEN_ENV_KEY.
1857
+
1858
+ api_token : str, optional
1859
+ The API token. Defaults to None.
1860
+
1861
+ rag_source_url : str, optional
1862
+ The RAG database source URL upon which the bot will be able to generate responses. Defaults to None.
1863
+
1864
+ Returns
1865
+ -------
1866
+ tuple
1867
+ `Pipeline` and a `Instance` objects tuple.
1868
+ """
1869
+ if agent_type == "API":
1870
+ if api_token is None:
1871
+ api_token = os.getenv(api_token_env_key)
1872
+ if api_token is None:
1873
+ message = f"Warning! No API token provided as via env {ENVIRONMENT.TELEGRAM_API_AGENT_TOKEN_ENV_KEY} or explicitly as `api_token` param."
1874
+ raise ValueError(message)
1875
+
1876
+ if telegram_bot_token is None:
1877
+ telegram_bot_token = os.getenv(telegram_bot_token_env_key)
1878
+ if telegram_bot_token is None:
1879
+ message = f"Warning! No Telegram bot token provided as via env {ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY} or explicitly as `telegram_bot_token` param."
1880
+ raise ValueError(message)
1881
+
1882
+ if telegram_bot_name is None:
1883
+ telegram_bot_name = os.getenv(telegram_bot_name_env_key)
1884
+ if telegram_bot_name is None:
1885
+ message = f"Warning! No Telegram bot name provided as via env {ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY} or explicitly as `telegram_bot_name` param."
1886
+ raise ValueError(message)
1887
+
1888
+
1889
+ pipeline: Pipeline = self.create_pipeline(
1890
+ node=node,
1891
+ name=name,
1892
+ # default TYPE is "Void"
1893
+ )
1894
+
1895
+
1896
+ obfuscated_token = telegram_bot_token[:4] + "*" * (len(telegram_bot_token) - 4)
1897
+ self.P(f"Creating telegram bot {telegram_bot_name} with token {obfuscated_token}...", color='b')
1898
+ instance = pipeline.create_plugin_instance(
1899
+ signature=signature,
1900
+ instance_id=self.log.get_unique_id(),
1901
+ telegram_bot_token=telegram_bot_token,
1902
+ telegram_bot_name=telegram_bot_name,
1903
+ system_prompt=system_prompt,
1904
+ agent_type=agent_type,
1905
+ api_token=api_token,
1906
+ rag_source_url=rag_source_url,
1907
+ **kwargs
1908
+ )
1909
+ return pipeline, instance
1910
+
1768
1911
 
1769
1912
  def broadcast_instance_command_and_wait_for_response_payload(
1770
1913
  self,
@@ -7,5 +7,6 @@ class PLUGIN_SIGNATURES:
7
7
  VIEW_SCENE_01 = 'VIEW_SCENE_01'
8
8
  CUSTOM_WEB_APP_01 = 'CUSTOM_CODE_FASTAPI_01'
9
9
  CHAIN_DIST_CUSTOM_JOB_01 = 'PROCESS_REAL_TIME_COLLECTED_DATA_CUSTOM_EXEC_CHAIN_DIST'
10
- BASIC_TELEGRAM_BOT_01 = 'BASIC_TELEGRAM_BOT_01'
10
+ TELEGRAM_BASIC_BOT_01 = 'TELEGRAM_BASIC_BOT_01'
11
+ TELEGRAM_CONVERSATIONAL_BOT_01 = 'TELEGRAM_CONVERSATIONAL_BOT_01'
11
12
  # INSERT_NEW_PLUGIN_HERE
@@ -31,3 +31,5 @@ class ENVIRONMENT:
31
31
 
32
32
  TELEGRAM_BOT_TOKEN_ENV_KEY = 'TELEGRAM_BOT_TOKEN'
33
33
  TELEGRAM_BOT_NAME_ENV_KEY = 'TELEGRAM_BOT_NAME'
34
+
35
+ TELEGRAM_API_AGENT_TOKEN_ENV_KEY = 'TELEGRAM_API_AGENT_TOKEN'
@@ -2,7 +2,7 @@ from .net_mon_01_plugin import NetMon01
2
2
  from .view_scene_01_plugin import ViewScene01
3
3
  from .custom_web_app_01_plugin import CustomWebApp01
4
4
  from .chain_dist_custom_job_01_plugin import ChainDistCustomJob01
5
- from .basic_telegram_bot_01_plugin import BasicTelegramBot01
5
+ from .telegram_basic_bot_01_plugin import BasicTelegramBot01
6
6
 
7
7
 
8
8
  class PLUGIN_TYPES:
@@ -13,4 +13,4 @@ class PLUGIN_TYPES:
13
13
  VIEW_SCENE_01 = ViewScene01
14
14
  CUSTOM_WEB_APP_01 = CustomWebApp01
15
15
  CHAIN_DIST_CUSTOM_JOB_01 = ChainDistCustomJob01
16
- BASIC_TELEGRAM_BOT_01 = BasicTelegramBot01
16
+ TELEGRAM_BASIC_BOT_01 = BasicTelegramBot01
@@ -2,6 +2,6 @@ from ...base import Instance
2
2
  from ...const import PLUGIN_SIGNATURES
3
3
 
4
4
  class BasicTelegramBot01(Instance):
5
- signature = PLUGIN_SIGNATURES.BASIC_TELEGRAM_BOT_01
5
+ signature = PLUGIN_SIGNATURES.TELEGRAM_BASIC_BOT_01
6
6
 
7
7
 
@@ -0,0 +1,7 @@
1
+ from ...base import Instance
2
+ from ...const import PLUGIN_SIGNATURES
3
+
4
+ class TelegramConversationalBot01(Instance):
5
+ signature = PLUGIN_SIGNATURES.TELEGRAM_CONVERSATIONAL_BOT_01
6
+
7
+
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "naeural_client"
7
- version = "2.1.2"
7
+ version = "2.1.3"
8
8
  authors = [
9
9
  { name="Stefan Saraev", email="saraevstefan@gmail.com" },
10
10
  { name="Andrei Ionut Damian", email="andrei.damian@me.com" },
@@ -19,21 +19,14 @@ if __name__ == "__main__":
19
19
  my_node = os.getenv("TARGET_NODE") # we can specify a node here, if we want to connect to a specific
20
20
 
21
21
  session = Session() # assume .env is available and will be used for the connection and tokens
22
- time.sleep(10) # wait 10 sec to collect network status
23
-
24
- if my_node:
25
- node = my_node
26
- session.P(f"Using the specified node: {node}", color='b')
27
- else:
28
- session.wait_for_any_node() # we wait for any node to present itself as active
29
- node = session.get_active_nodes()[0] # we get the first active node
30
-
22
+ session.wait_for_node(my_node) # wait for the node to be active
23
+
31
24
 
32
25
  # now we create a telegram bot pipeline & plugin instance
33
26
  # we can chose to use the token directly or use the environment key
34
- # instance: PLUGIN_TYPES.BASIC_TELEGRAM_BOT_01
27
+ # instance: PLUGIN_TYPES.TELEGRAM_BASIC_BOT_01
35
28
  pipeline, _ = session.create_telegram_simple_bot(
36
- node=node,
29
+ node=my_node,
37
30
  name="telegram_bot_echo",
38
31
  # telegram_bot_token=os.getenv("TELEGRAM_BOT_TOKEN"), # we use the token directly
39
32
  # telegram_bot_token_env_key=TELEGRAM_BOT_TOKEN_ENV_KEY, # not mandatory - we can use the default
@@ -0,0 +1,48 @@
1
+ import os
2
+ import time
3
+
4
+ from naeural_client import Session, CustomPluginTemplate
5
+
6
+ if __name__ == "__main__":
7
+ my_node = os.getenv("TARGET_NODE") # we specify a node here
8
+
9
+ if my_node is None:
10
+ print("Please specify the node to connect to.")
11
+ exit(1)
12
+
13
+ SYSTEM_PROMPT = """
14
+ Hi! I am a simple echo bot. I will repeat everything you say to me.
15
+ """
16
+
17
+ session = Session() # assume .env is available and will be used for the connection and tokens
18
+ session.wait_for_node(my_node) # wait for the node to be active
19
+
20
+
21
+ # now we create a telegram bot pipeline & plugin instance
22
+ # we can chose to use the token directly or use the environment key
23
+ pipeline, _ = session.create_telegram_conversational_bot(
24
+ node=my_node,
25
+ name="telegram_chatbot",
26
+
27
+ # telegram_bot_token=None, # not mantatory - can be used to specify the token directly
28
+ # telegram_bot_token_env_key=ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY, # not mandatory - we can use the default
29
+ # telegram_bot_name=None, # not mandatory - can be used to specify the bot name directly
30
+ # telegram_bot_name_env_key=ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY, # not mandatory - we can use the default
31
+
32
+ system_prompt=SYSTEM_PROMPT, # simple bot based on system prompt only
33
+ agent_type="API", # "API", "HOSTED"
34
+ # api_token_env_key=ENVIRONMENT.TELEGRAM_API_AGENT_TOKEN_ENV_KEY, # not mandatory - we can use the default
35
+ # api_token=None, # not mandatory - can be used to specify the token directly
36
+ rag_source_url=None, # no rag source for this example
37
+ )
38
+
39
+ pipeline.deploy() # we deploy the pipeline
40
+
41
+ # # Observation:
42
+ # # next code is not mandatory - it is used to keep the session open and cleanup the resources
43
+ # # in production, you would not need this code as the script can close after the pipeline will be sent
44
+ # session.run(
45
+ # wait=60, # we run the session for 60 seconds
46
+ # close_pipelines=True, # we close the pipelines after the session
47
+ # close_session=True, # we close the session after the session
48
+ # )
@@ -1,44 +0,0 @@
1
- import os
2
-
3
- from naeural_client import Session, CustomPluginTemplate, PLUGIN_TYPES
4
-
5
- if __name__ == "__main__":
6
- # TELEGRAM_BOT_TOKEN_ENV_KEY = "TELEGRAM_BOT_TOKEN" # we can specify the token here
7
- MY_NODE = None # we can specify a node here, if we want to connect to a specific
8
-
9
- SYSTEM_PROMPT = """
10
- Hi! I am a simple echo bot. I will repeat everything you say to me.
11
- """
12
-
13
- session = Session() # assume .env is available and will be used for the connection and tokens
14
-
15
- if MY_NODE:
16
- node = MY_NODE
17
- else:
18
- session.wait_for_any_node() # we wait for any node to present itself as active
19
- node = session.get_active_nodes()[0] # we get the first active node
20
-
21
-
22
- # now we create a telegram bot pipeline & plugin instance
23
- # we can chose to use the token directly or use the environment key
24
- # instance: PLUGIN_TYPES.BASIC_TELEGRAM_BOT_01
25
- pipeline, _ = session.create_telegram_conversational_bot(
26
- node=node,
27
- name="telegram_bot_echo",
28
- # telegram_bot_token_env_key=TELEGRAM_BOT_TOKEN_ENV_KEY, # this is not mandatory
29
- system_prompt=SYSTEM_PROMPT, # simple bot based on system prompt only
30
- # rag_source=rag_db_url, # advanced
31
- # bot_type="API" # "API", "HOSTED"
32
- # api_token_env_key="BOT_API_TOKEN", # if bot_type is "API" - this is a default
33
- )
34
-
35
- pipeline.deploy() # we deploy the pipeline
36
-
37
- # # Observation:
38
- # # next code is not mandatory - it is used to keep the session open and cleanup the resources
39
- # # in production, you would not need this code as the script can close after the pipeline will be sent
40
- # session.run(
41
- # wait=60, # we run the session for 60 seconds
42
- # close_pipelines=True, # we close the pipelines after the session
43
- # close_session=True, # we close the session after the session
44
- # )
File without changes
File without changes
File without changes