arshai 0.2.0__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 (231) hide show
  1. arshai-0.2.0/LICENSE +21 -0
  2. arshai-0.2.0/PKG-INFO +440 -0
  3. arshai-0.2.0/README.md +403 -0
  4. arshai-0.2.0/arshai/__init__.py +73 -0
  5. arshai-0.2.0/arshai/_version.py +6 -0
  6. arshai-0.2.0/arshai/agents/__init__.py +3 -0
  7. arshai-0.2.0/arshai/agents/conversation.py +249 -0
  8. arshai-0.2.0/arshai/callbacks/accounting.py +23 -0
  9. arshai-0.2.0/arshai/callbacks/chat_history.py +256 -0
  10. arshai-0.2.0/arshai/clients/__init__.py +0 -0
  11. arshai-0.2.0/arshai/clients/arshai/accounting.py +69 -0
  12. arshai-0.2.0/arshai/clients/arshai/chat_history_client.py +538 -0
  13. arshai-0.2.0/arshai/clients/utils/redis_client.py +52 -0
  14. arshai-0.2.0/arshai/compat.py +118 -0
  15. arshai-0.2.0/arshai/config/__init__.py +10 -0
  16. arshai-0.2.0/arshai/config/config_manager.py +173 -0
  17. arshai-0.2.0/arshai/config/settings.py +437 -0
  18. arshai-0.2.0/arshai/config.py +75 -0
  19. arshai-0.2.0/arshai/core/__init__.py +20 -0
  20. arshai-0.2.0/arshai/core/interfaces/__init__.py +64 -0
  21. arshai-0.2.0/arshai/core/interfaces/iagent.py +122 -0
  22. arshai-0.2.0/arshai/core/interfaces/idatabase_client.py +84 -0
  23. arshai-0.2.0/arshai/core/interfaces/idocument.py +13 -0
  24. arshai-0.2.0/arshai/core/interfaces/idto.py +76 -0
  25. arshai-0.2.0/arshai/core/interfaces/iembedding.py +49 -0
  26. arshai-0.2.0/arshai/core/interfaces/ifile_loader.py +49 -0
  27. arshai-0.2.0/arshai/core/interfaces/iindexing.py +40 -0
  28. arshai-0.2.0/arshai/core/interfaces/illm.py +132 -0
  29. arshai-0.2.0/arshai/core/interfaces/imemorymanager.py +257 -0
  30. arshai-0.2.0/arshai/core/interfaces/inood.py +9 -0
  31. arshai-0.2.0/arshai/core/interfaces/inotification.py +81 -0
  32. arshai-0.2.0/arshai/core/interfaces/ireranker.py +49 -0
  33. arshai-0.2.0/arshai/core/interfaces/isearch_client.py +59 -0
  34. arshai-0.2.0/arshai/core/interfaces/isetting.py +112 -0
  35. arshai-0.2.0/arshai/core/interfaces/ispeech.py +179 -0
  36. arshai-0.2.0/arshai/core/interfaces/itext_processor.py +69 -0
  37. arshai-0.2.0/arshai/core/interfaces/itext_splitter.py +56 -0
  38. arshai-0.2.0/arshai/core/interfaces/itool.py +45 -0
  39. arshai-0.2.0/arshai/core/interfaces/ivector_db_client.py +178 -0
  40. arshai-0.2.0/arshai/core/interfaces/iwebsearch.py +68 -0
  41. arshai-0.2.0/arshai/core/interfaces/iworkflow.py +199 -0
  42. arshai-0.2.0/arshai/core/interfaces/iworkflowrunner.py +109 -0
  43. arshai-0.2.0/arshai/document_loaders/__init__.py +81 -0
  44. arshai-0.2.0/arshai/document_loaders/config.py +219 -0
  45. arshai-0.2.0/arshai/document_loaders/file_loaders/__init__.py +27 -0
  46. arshai-0.2.0/arshai/document_loaders/file_loaders/audio_loader.py +128 -0
  47. arshai-0.2.0/arshai/document_loaders/file_loaders/base_loader.py +191 -0
  48. arshai-0.2.0/arshai/document_loaders/file_loaders/excel_loader.py +119 -0
  49. arshai-0.2.0/arshai/document_loaders/file_loaders/html_loader.py +92 -0
  50. arshai-0.2.0/arshai/document_loaders/file_loaders/pdf_loader.py +47 -0
  51. arshai-0.2.0/arshai/document_loaders/file_loaders/powerpoint_loader.py +91 -0
  52. arshai-0.2.0/arshai/document_loaders/file_loaders/unstructured_loader.py +148 -0
  53. arshai-0.2.0/arshai/document_loaders/file_loaders/word_loader.py +61 -0
  54. arshai-0.2.0/arshai/document_loaders/processors/__init__.py +18 -0
  55. arshai-0.2.0/arshai/document_loaders/processors/context_enricher.py +274 -0
  56. arshai-0.2.0/arshai/document_loaders/processors/text_cleaner.py +213 -0
  57. arshai-0.2.0/arshai/document_loaders/processors/utils.py +32 -0
  58. arshai-0.2.0/arshai/document_loaders/text_splitters/__init__.py +15 -0
  59. arshai-0.2.0/arshai/document_loaders/text_splitters/recursive_splitter.py +194 -0
  60. arshai-0.2.0/arshai/embeddings/__init__.py +11 -0
  61. arshai-0.2.0/arshai/embeddings/mgte_embeddings.py +99 -0
  62. arshai-0.2.0/arshai/embeddings/openai_embeddings.py +146 -0
  63. arshai-0.2.0/arshai/extensions/__init__.py +18 -0
  64. arshai-0.2.0/arshai/extensions/base.py +184 -0
  65. arshai-0.2.0/arshai/extensions/hooks.py +223 -0
  66. arshai-0.2.0/arshai/extensions/loader.py +279 -0
  67. arshai-0.2.0/arshai/factories/__init__.py +58 -0
  68. arshai-0.2.0/arshai/factories/agent_factory.py +55 -0
  69. arshai-0.2.0/arshai/factories/embedding_factory.py +62 -0
  70. arshai-0.2.0/arshai/factories/llm_factory.py +65 -0
  71. arshai-0.2.0/arshai/factories/memory_factory.py +73 -0
  72. arshai-0.2.0/arshai/factories/reranker_factory.py +68 -0
  73. arshai-0.2.0/arshai/factories/search_factory.py +101 -0
  74. arshai-0.2.0/arshai/factories/speech_factory.py +67 -0
  75. arshai-0.2.0/arshai/factories/vector_db_factory.py +84 -0
  76. arshai-0.2.0/arshai/indexings/multimodel_indexing.py +264 -0
  77. arshai-0.2.0/arshai/llms/azure.py +575 -0
  78. arshai-0.2.0/arshai/llms/openai.py +646 -0
  79. arshai-0.2.0/arshai/memory/__init__.py +20 -0
  80. arshai-0.2.0/arshai/memory/long_term/factories.py +24 -0
  81. arshai-0.2.0/arshai/memory/memory_manager.py +141 -0
  82. arshai-0.2.0/arshai/memory/memory_types.py +14 -0
  83. arshai-0.2.0/arshai/memory/short_term/factories.py +24 -0
  84. arshai-0.2.0/arshai/memory/working_memory/__init__.py +6 -0
  85. arshai-0.2.0/arshai/memory/working_memory/in_memory_manager.py +157 -0
  86. arshai-0.2.0/arshai/memory/working_memory/redis_memory_manager.py +110 -0
  87. arshai-0.2.0/arshai/prompts/general.py +36 -0
  88. arshai-0.2.0/arshai/prompts/guardrails.py +59 -0
  89. arshai-0.2.0/arshai/prompts/human_intervention.py +57 -0
  90. arshai-0.2.0/arshai/prompts/human_like_conversation.py +31 -0
  91. arshai-0.2.0/arshai/prompts/working_memory.py +305 -0
  92. arshai-0.2.0/arshai/rerankers/flashrank_reranker.py +99 -0
  93. arshai-0.2.0/arshai/rerankers/voyage_reranker.py +101 -0
  94. arshai-0.2.0/arshai/speech/__init__.py +15 -0
  95. arshai-0.2.0/arshai/speech/azure.py +199 -0
  96. arshai-0.2.0/arshai/speech/openai.py +181 -0
  97. arshai-0.2.0/arshai/tools/__init__.py +1 -0
  98. arshai-0.2.0/arshai/tools/knowledge_base_tool.py +188 -0
  99. arshai-0.2.0/arshai/tools/web_search_tool.py +94 -0
  100. arshai-0.2.0/arshai/utils/__init__.py +7 -0
  101. arshai-0.2.0/arshai/utils/logging.py +120 -0
  102. arshai-0.2.0/arshai/vector_db/__init__.py +5 -0
  103. arshai-0.2.0/arshai/vector_db/milvus_client.py +608 -0
  104. arshai-0.2.0/arshai/web_search/searxng.py +131 -0
  105. arshai-0.2.0/arshai/workflows/__init__.py +18 -0
  106. arshai-0.2.0/arshai/workflows/node.py +144 -0
  107. arshai-0.2.0/arshai/workflows/workflow_config.py +110 -0
  108. arshai-0.2.0/arshai/workflows/workflow_orchestrator.py +200 -0
  109. arshai-0.2.0/arshai/workflows/workflow_runner.py +277 -0
  110. arshai-0.2.0/pyproject.toml +83 -0
  111. arshai-0.2.0/seedwork/__init__.py +0 -0
  112. arshai-0.2.0/seedwork/interfaces/__init__.py +12 -0
  113. arshai-0.2.0/seedwork/interfaces/iagent.py +122 -0
  114. arshai-0.2.0/seedwork/interfaces/idatabase_client.py +84 -0
  115. arshai-0.2.0/seedwork/interfaces/idocument.py +13 -0
  116. arshai-0.2.0/seedwork/interfaces/idto.py +76 -0
  117. arshai-0.2.0/seedwork/interfaces/iembedding.py +49 -0
  118. arshai-0.2.0/seedwork/interfaces/ifile_loader.py +49 -0
  119. arshai-0.2.0/seedwork/interfaces/iindexing.py +40 -0
  120. arshai-0.2.0/seedwork/interfaces/illm.py +132 -0
  121. arshai-0.2.0/seedwork/interfaces/imemorymanager.py +257 -0
  122. arshai-0.2.0/seedwork/interfaces/inood.py +9 -0
  123. arshai-0.2.0/seedwork/interfaces/inotification.py +81 -0
  124. arshai-0.2.0/seedwork/interfaces/ireranker.py +49 -0
  125. arshai-0.2.0/seedwork/interfaces/isearch_client.py +59 -0
  126. arshai-0.2.0/seedwork/interfaces/isetting.py +112 -0
  127. arshai-0.2.0/seedwork/interfaces/ispeech.py +179 -0
  128. arshai-0.2.0/seedwork/interfaces/itext_processor.py +69 -0
  129. arshai-0.2.0/seedwork/interfaces/itext_splitter.py +56 -0
  130. arshai-0.2.0/seedwork/interfaces/itool.py +45 -0
  131. arshai-0.2.0/seedwork/interfaces/ivector_db_client.py +178 -0
  132. arshai-0.2.0/seedwork/interfaces/iwebsearch.py +68 -0
  133. arshai-0.2.0/seedwork/interfaces/iworkflow.py +199 -0
  134. arshai-0.2.0/seedwork/interfaces/iworkflowrunner.py +109 -0
  135. arshai-0.2.0/src/agents/README.md +234 -0
  136. arshai-0.2.0/src/agents/__init__.py +3 -0
  137. arshai-0.2.0/src/agents/conversation.py +249 -0
  138. arshai-0.2.0/src/callbacks/README.md +204 -0
  139. arshai-0.2.0/src/callbacks/accounting.py +23 -0
  140. arshai-0.2.0/src/callbacks/chat_history.py +256 -0
  141. arshai-0.2.0/src/clients/README.md +57 -0
  142. arshai-0.2.0/src/clients/__init__.py +0 -0
  143. arshai-0.2.0/src/clients/arshai/README.md +271 -0
  144. arshai-0.2.0/src/clients/arshai/accounting.py +69 -0
  145. arshai-0.2.0/src/clients/arshai/chat_history_client.py +538 -0
  146. arshai-0.2.0/src/clients/utils/README.md +91 -0
  147. arshai-0.2.0/src/clients/utils/redis_client.py +52 -0
  148. arshai-0.2.0/src/config/README.md +167 -0
  149. arshai-0.2.0/src/config/__init__.py +10 -0
  150. arshai-0.2.0/src/config/config_manager.py +173 -0
  151. arshai-0.2.0/src/config/settings.py +437 -0
  152. arshai-0.2.0/src/document_loaders/README.md +296 -0
  153. arshai-0.2.0/src/document_loaders/__init__.py +81 -0
  154. arshai-0.2.0/src/document_loaders/config.py +219 -0
  155. arshai-0.2.0/src/document_loaders/file_loaders/README.md +265 -0
  156. arshai-0.2.0/src/document_loaders/file_loaders/__init__.py +27 -0
  157. arshai-0.2.0/src/document_loaders/file_loaders/audio_loader.py +128 -0
  158. arshai-0.2.0/src/document_loaders/file_loaders/base_loader.py +191 -0
  159. arshai-0.2.0/src/document_loaders/file_loaders/excel_loader.py +119 -0
  160. arshai-0.2.0/src/document_loaders/file_loaders/html_loader.py +92 -0
  161. arshai-0.2.0/src/document_loaders/file_loaders/pdf_loader.py +47 -0
  162. arshai-0.2.0/src/document_loaders/file_loaders/powerpoint_loader.py +91 -0
  163. arshai-0.2.0/src/document_loaders/file_loaders/unstructured_loader.py +148 -0
  164. arshai-0.2.0/src/document_loaders/file_loaders/word_loader.py +61 -0
  165. arshai-0.2.0/src/document_loaders/processors/README.md +286 -0
  166. arshai-0.2.0/src/document_loaders/processors/__init__.py +18 -0
  167. arshai-0.2.0/src/document_loaders/processors/context_enricher.py +274 -0
  168. arshai-0.2.0/src/document_loaders/processors/text_cleaner.py +213 -0
  169. arshai-0.2.0/src/document_loaders/processors/utils.py +32 -0
  170. arshai-0.2.0/src/document_loaders/text_splitters/README.md +260 -0
  171. arshai-0.2.0/src/document_loaders/text_splitters/__init__.py +15 -0
  172. arshai-0.2.0/src/document_loaders/text_splitters/recursive_splitter.py +194 -0
  173. arshai-0.2.0/src/embeddings/README.md +298 -0
  174. arshai-0.2.0/src/embeddings/__init__.py +11 -0
  175. arshai-0.2.0/src/embeddings/mgte_embeddings.py +99 -0
  176. arshai-0.2.0/src/embeddings/openai_embeddings.py +146 -0
  177. arshai-0.2.0/src/factories/README.md +120 -0
  178. arshai-0.2.0/src/factories/__init__.py +29 -0
  179. arshai-0.2.0/src/factories/agent_factory.py +55 -0
  180. arshai-0.2.0/src/factories/embedding_factory.py +62 -0
  181. arshai-0.2.0/src/factories/llm_factory.py +65 -0
  182. arshai-0.2.0/src/factories/memory_factory.py +73 -0
  183. arshai-0.2.0/src/factories/reranker_factory.py +68 -0
  184. arshai-0.2.0/src/factories/search_factory.py +101 -0
  185. arshai-0.2.0/src/factories/speech_factory.py +67 -0
  186. arshai-0.2.0/src/factories/vector_db_factory.py +84 -0
  187. arshai-0.2.0/src/indexings/multimodel_indexing.py +264 -0
  188. arshai-0.2.0/src/llms/README.md +339 -0
  189. arshai-0.2.0/src/llms/azure.py +575 -0
  190. arshai-0.2.0/src/llms/openai.py +646 -0
  191. arshai-0.2.0/src/memory/README.md +263 -0
  192. arshai-0.2.0/src/memory/__init__.py +20 -0
  193. arshai-0.2.0/src/memory/long_term/factories.py +24 -0
  194. arshai-0.2.0/src/memory/memory_manager.py +141 -0
  195. arshai-0.2.0/src/memory/memory_types.py +14 -0
  196. arshai-0.2.0/src/memory/short_term/factories.py +24 -0
  197. arshai-0.2.0/src/memory/working_memory/README.md +313 -0
  198. arshai-0.2.0/src/memory/working_memory/__init__.py +6 -0
  199. arshai-0.2.0/src/memory/working_memory/in_memory_manager.py +157 -0
  200. arshai-0.2.0/src/memory/working_memory/redis_memory_manager.py +110 -0
  201. arshai-0.2.0/src/prompts/README.md +186 -0
  202. arshai-0.2.0/src/prompts/general.py +36 -0
  203. arshai-0.2.0/src/prompts/guardrails.py +59 -0
  204. arshai-0.2.0/src/prompts/human_intervention.py +57 -0
  205. arshai-0.2.0/src/prompts/human_like_conversation.py +31 -0
  206. arshai-0.2.0/src/prompts/working_memory.py +305 -0
  207. arshai-0.2.0/src/rerankers/README.md +258 -0
  208. arshai-0.2.0/src/rerankers/flashrank_reranker.py +99 -0
  209. arshai-0.2.0/src/rerankers/voyage_reranker.py +101 -0
  210. arshai-0.2.0/src/speech/README.md +173 -0
  211. arshai-0.2.0/src/speech/__init__.py +15 -0
  212. arshai-0.2.0/src/speech/azure.py +199 -0
  213. arshai-0.2.0/src/speech/openai.py +181 -0
  214. arshai-0.2.0/src/tools/README.md +258 -0
  215. arshai-0.2.0/src/tools/__init__.py +1 -0
  216. arshai-0.2.0/src/tools/knowledge_base_tool.py +188 -0
  217. arshai-0.2.0/src/tools/web_search_tool.py +94 -0
  218. arshai-0.2.0/src/utils/README.md +124 -0
  219. arshai-0.2.0/src/utils/__init__.py +7 -0
  220. arshai-0.2.0/src/utils/logging.py +120 -0
  221. arshai-0.2.0/src/vector_db/README.md +332 -0
  222. arshai-0.2.0/src/vector_db/__init__.py +5 -0
  223. arshai-0.2.0/src/vector_db/milvus_client.py +608 -0
  224. arshai-0.2.0/src/web_search/README.md +157 -0
  225. arshai-0.2.0/src/web_search/searxng.py +131 -0
  226. arshai-0.2.0/src/workflows/README.md +402 -0
  227. arshai-0.2.0/src/workflows/__init__.py +18 -0
  228. arshai-0.2.0/src/workflows/node.py +144 -0
  229. arshai-0.2.0/src/workflows/workflow_config.py +110 -0
  230. arshai-0.2.0/src/workflows/workflow_orchestrator.py +200 -0
  231. arshai-0.2.0/src/workflows/workflow_runner.py +277 -0
arshai-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Arshai Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
arshai-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,440 @@
1
+ Metadata-Version: 2.3
2
+ Name: arshai
3
+ Version: 0.2.0
4
+ Summary: A powerful agent framework for building conversational AI systems
5
+ License: MIT
6
+ Keywords: ai,agents,llm,workflow,rag,conversational-ai,multi-agent,vector-db,embeddings
7
+ Author: Nima Nazarian
8
+ Author-email: nimunzn@gmail.com
9
+ Requires-Python: >=3.11,<3.13
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Provides-Extra: all
20
+ Provides-Extra: milvus
21
+ Provides-Extra: redis
22
+ Provides-Extra: rerankers
23
+ Requires-Dist: aiohttp (>=3.11.16,<4.0.0)
24
+ Requires-Dist: flashrank (>=0.1.0,<0.2.0) ; extra == "rerankers" or extra == "all"
25
+ Requires-Dist: openai (>=1.0.0,<2.0.0)
26
+ Requires-Dist: pdf2image (>=1.17.0,<2.0.0)
27
+ Requires-Dist: pydantic (>=2.0.0,<3.0.0)
28
+ Requires-Dist: pymilvus (>=2.3.0,<3.0.0) ; extra == "milvus" or extra == "all"
29
+ Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
30
+ Requires-Dist: redis (>=5.0.0,<6.0.0) ; extra == "redis" or extra == "all"
31
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
32
+ Requires-Dist: voyageai (>=0.3.2,<0.4.0)
33
+ Project-URL: Documentation, https://arshai.readthedocs.io
34
+ Project-URL: Homepage, https://github.com/nimunzn/arshai
35
+ Project-URL: Repository, https://github.com/nimunzn/arshai
36
+ Description-Content-Type: text/markdown
37
+
38
+ # Arshai
39
+
40
+ A powerful AI application framework for building complex, intelligent systems with conversational agents, workflow orchestration, and advanced memory management.
41
+
42
+ ```mermaid
43
+ graph TD
44
+ App([Applications]) --> WF[Workflow System]
45
+ WF --> AG[Agent System]
46
+ AG --> LLM[LLM Providers]
47
+ AG --> MEM[Memory Management]
48
+ AG --> TL[Tool System]
49
+ WF --> DOC[Document Processing]
50
+ DOC --> VDB[Vector Databases]
51
+ DOC --> EMB[Embedding Models]
52
+
53
+ subgraph "Framework Layers"
54
+ WF
55
+ AG
56
+ MEM
57
+ TL
58
+ DOC
59
+ LLM
60
+ VDB
61
+ EMB
62
+ end
63
+ ```
64
+
65
+ ## Overview
66
+
67
+ Arshai is designed to empower developers to build sophisticated AI applications by providing a flexible, modular framework based on clean architecture principles. At its core, Arshai follows an interface-first design that enables easy extension, customization, and implementation of complex AI systems.
68
+
69
+ ### Key Features
70
+
71
+ - **Agent Framework**: Create intelligent conversational agents with advanced memory management
72
+ - **Workflow Orchestration**: Design complex multi-agent systems with directed graph workflows
73
+ - **Memory Management**: Implement sophisticated conversation memory with multiple storage options
74
+ - **Tool Integration**: Extend agent capabilities with custom tools and external integrations
75
+ - **LLM Integration**: Connect with leading LLM providers (OpenAI, Azure OpenAI) with consistent APIs
76
+ - **RAG Capabilities**: Build powerful retrieval-augmented generation systems with document processing
77
+ - **Structured Outputs**: Enforce structured responses with schema validation
78
+ - **Streaming Support**: Enable real-time streaming responses throughout the stack
79
+
80
+ ## Architecture
81
+
82
+ Arshai implements a clean, layered architecture with clear separation of concerns:
83
+
84
+ ```mermaid
85
+ classDiagram
86
+ class Interfaces {
87
+ <<package>>
88
+ +IAgent
89
+ +IWorkflowOrchestrator
90
+ +IMemoryManager
91
+ +ITool
92
+ +ILLM
93
+ +IVectorDBClient
94
+ }
95
+
96
+ class Implementation {
97
+ <<package>>
98
+ +ConversationAgent
99
+ +BaseWorkflowOrchestrator
100
+ +MemoryManagerService
101
+ +WebSearchTool
102
+ +OpenAIClient
103
+ +AzureClient
104
+ }
105
+
106
+ class Applications {
107
+ <<package>>
108
+ +RAG Systems
109
+ +Conversational Assistants
110
+ +Knowledge Bases
111
+ +Multi-agent Systems
112
+ }
113
+
114
+ Interfaces <|-- Implementation
115
+ Implementation <-- Applications
116
+ ```
117
+
118
+ ### Core Components
119
+
120
+ #### Workflow System
121
+
122
+ The orchestration layer that manages the flow of execution between agents:
123
+ - **Workflow Runner**: Interface for executing workflows
124
+ - **Workflow Orchestrator**: Manages node execution and state management
125
+ - **Nodes**: Wrappers around agents that adapt them for specific business requirements
126
+ - **Workflow State**: Carries data and context between nodes
127
+
128
+ #### Agent System
129
+
130
+ The intelligent components that process information and make decisions:
131
+ - **Conversational Agent**: Primary agent implementation for handling user interactions
132
+ - **Memory Integration**: Contextual awareness through working memory
133
+ - **Tool Usage**: Tool calling capabilities for extended functionality
134
+ - **Response Structuring**: Schema-based response structuring
135
+
136
+ #### Memory Management
137
+
138
+ The system that manages conversation context and knowledge:
139
+ - **Memory Manager Service**: Orchestrates different memory types
140
+ - **Working Memory**: Stores and retrieves conversation context
141
+ - **Multiple Providers**: In-memory and Redis implementations
142
+
143
+ #### Tool System
144
+
145
+ Extends agent capabilities with specific functionalities:
146
+ - **Web Search Tool**: Retrieve information from the web
147
+ - **Knowledge Base Tool**: Query vector databases for relevant information
148
+ - **Custom Tool Support**: Framework for developing new tools
149
+
150
+ #### LLM Integration
151
+
152
+ Connects to large language models through a unified interface:
153
+ - **OpenAI Provider**: Integration with OpenAI models
154
+ - **Azure Provider**: Integration with Azure OpenAI service
155
+ - **Streaming Support**: Real-time response generation
156
+ - **Function Calling**: Tool integration through function definitions
157
+
158
+ ## Getting Started
159
+
160
+ ### Installation
161
+
162
+ ```bash
163
+ # Install with pip
164
+ pip install arshai
165
+
166
+ # Or with Poetry (recommended)
167
+ poetry add arshai
168
+
169
+ # With optional dependencies
170
+ pip install arshai[all] # Includes redis, milvus, flashrank
171
+ ```
172
+
173
+ ### Quick Start
174
+
175
+ Create a conversational agent:
176
+
177
+ ```python
178
+ from arshai import Settings, IAgentConfig, IAgentInput
179
+
180
+ # Initialize settings
181
+ settings = Settings()
182
+
183
+ # Create agent configuration
184
+ agent_config = IAgentConfig(
185
+ task_context="You are a helpful assistant that specializes in Python programming.",
186
+ tools=[]
187
+ )
188
+
189
+ # Create conversation agent
190
+ agent = settings.create_agent("conversation", agent_config)
191
+
192
+ # Process a message
193
+ response, usage = agent.process_message(
194
+ IAgentInput(
195
+ message="How do I use list comprehensions in Python?",
196
+ conversation_id="conversation_123"
197
+ )
198
+ )
199
+
200
+ print(f"Agent response: {response}")
201
+ ```
202
+
203
+ ### Building a Workflow
204
+
205
+ Create a simple workflow with multiple agents:
206
+
207
+ ```python
208
+ from arshai import (
209
+ Settings,
210
+ WorkflowRunner,
211
+ BaseWorkflowConfig,
212
+ IWorkflowState,
213
+ IUserContext
214
+ )
215
+
216
+ # Initialize settings
217
+ settings = Settings()
218
+
219
+ # Define workflow configuration
220
+ class QAWorkflow(BaseWorkflowConfig):
221
+ def _create_nodes(self):
222
+ return {
223
+ "query_router": self._create_router_node(),
224
+ "research_agent": self._create_research_node(),
225
+ "synthesizer": self._create_synthesis_node()
226
+ }
227
+
228
+ def _define_edges(self):
229
+ return {
230
+ "query_router": {
231
+ "research": "research_agent"
232
+ },
233
+ "research_agent": "synthesizer"
234
+ }
235
+
236
+ def _route_input(self, input_data):
237
+ return "research"
238
+
239
+ # Create workflow runner
240
+ workflow_config = QAWorkflow(settings)
241
+ workflow_runner = WorkflowRunner(workflow_config)
242
+
243
+ # Initialize state
244
+ user_context = IUserContext(user_id="user123")
245
+ initial_state = IWorkflowState(user_context=user_context)
246
+
247
+ # Run workflow
248
+ result = workflow_runner.run({
249
+ "message": "What are the environmental impacts of electric vehicles?",
250
+ "state": initial_state
251
+ })
252
+
253
+ print(result.get("response", ""))
254
+ ```
255
+
256
+ ### Using Tools
257
+
258
+ Extend agents with tool capabilities:
259
+
260
+ ```python
261
+ from arshai import Settings, IAgentConfig, IAgentInput
262
+ from arshai.tools.web_search_tool import WebSearchTool
263
+
264
+ # Initialize settings
265
+ settings = Settings()
266
+
267
+ # Create tools
268
+ web_search = WebSearchTool(settings)
269
+
270
+ # Create agent with tools
271
+ agent_config = IAgentConfig(
272
+ task_context="You are a research assistant that can search the web for information.",
273
+ tools=[web_search]
274
+ )
275
+
276
+ agent = settings.create_agent("conversation", agent_config)
277
+
278
+ # Process a message that might trigger tool usage
279
+ response, usage = agent.process_message(
280
+ IAgentInput(
281
+ message="What are the latest breakthroughs in fusion energy?",
282
+ conversation_id="research_123"
283
+ )
284
+ )
285
+
286
+ print(f"Agent response with web search: {response}")
287
+ ```
288
+
289
+ ### Using Plugins
290
+
291
+ Extend Arshai with custom plugins:
292
+
293
+ ```python
294
+ from arshai.extensions import load_plugin
295
+
296
+ # Load a custom plugin
297
+ plugin = load_plugin("my_custom_plugin", config={
298
+ "api_key": "your_secret_key"
299
+ })
300
+
301
+ # Use plugin's tools with agents
302
+ custom_tool = plugin.get_tool("specialized_tool")
303
+ agent_config = IAgentConfig(
304
+ task_context="Agent with custom capabilities",
305
+ tools=[custom_tool]
306
+ )
307
+ ```
308
+
309
+ ## Examples
310
+
311
+ Explore the `examples/` directory for complete working examples:
312
+
313
+ - `basic_usage.py`: Demonstrates core agent functionality
314
+ - `simple_workflow.py`: Shows basic workflow construction
315
+ - `advanced_workflow.py`: Builds complex multi-agent workflows
316
+ - `file_indexing_example.py`: Demonstrates document processing and indexing
317
+ - `rag_system_usage.py`: Implements retrieval-augmented generation
318
+ - `configuration.py`: Shows configuration management techniques
319
+
320
+ ## Component Documentation
321
+
322
+ Each major component has its own detailed documentation:
323
+
324
+ - [Agents System](src/agents/README.md)
325
+ - [Memory Management](src/memory/README.md)
326
+ - [LLM Integration](src/llms/README.md)
327
+ - [Tools System](src/tools/README.md)
328
+ - [Workflow System](src/workflows/README.md)
329
+
330
+ ## Real-World Applications
331
+
332
+ Arshai has been used to build several production systems:
333
+
334
+ 1. **Chetor Assistant**: An AI conversational system with integrated knowledge organization
335
+ 2. **Petro RAG**: A specialized RAG system for the petroleum industry
336
+
337
+ ## Configuration
338
+
339
+ Arshai uses a flexible configuration system that can be customized through:
340
+
341
+ - Environment variables
342
+ - Configuration files (YAML, JSON)
343
+ - Direct settings injection
344
+
345
+ Example configuration:
346
+
347
+ ```yaml
348
+ # config.yaml
349
+ llm:
350
+ provider: openai
351
+ model: gpt-4
352
+ temperature: 0.7
353
+
354
+ memory:
355
+ working_memory:
356
+ provider: redis
357
+ ttl: 86400
358
+
359
+ workflows:
360
+ debug_mode: true
361
+ ```
362
+
363
+ ## Extension Points
364
+
365
+ Arshai v0.2.0 introduces a powerful plugin system for extensibility:
366
+
367
+ ### Plugin System
368
+
369
+ Create and distribute custom plugins:
370
+
371
+ ```python
372
+ from arshai.extensions.base import Plugin, PluginMetadata
373
+ from arshai.extensions.hooks import hook, HookType
374
+
375
+ class MyPlugin(Plugin):
376
+ def get_metadata(self):
377
+ return PluginMetadata(
378
+ name="my_plugin",
379
+ version="1.0.0",
380
+ author="Your Name",
381
+ description="Custom plugin for specialized tasks"
382
+ )
383
+
384
+ def initialize(self):
385
+ # Set up your plugin
386
+ pass
387
+
388
+ def shutdown(self):
389
+ # Clean up resources
390
+ pass
391
+
392
+ # Add hooks to extend behavior
393
+ @hook(HookType.BEFORE_AGENT_PROCESS)
394
+ def custom_preprocessing(context):
395
+ # Modify agent input before processing
396
+ pass
397
+ ```
398
+
399
+ ### Extension Methods
400
+
401
+ 1. **Plugin System**: Create reusable plugins with tools, hooks, and providers
402
+ 2. **Custom Agents**: Implement the `IAgent` interface for specialized agents
403
+ 3. **Custom Tools**: Add new capabilities by implementing the `ITool` interface
404
+ 4. **Hook System**: Extend behavior without modifying core code
405
+ 5. **Custom Nodes**: Create specialized workflow nodes for business logic
406
+ 6. **New LLM Providers**: Add support for new LLM providers by implementing the `ILLM` interface
407
+ 7. **Custom Memory Providers**: Implement new storage backends with the `IMemoryManager` interface
408
+
409
+ ## Migration from v0.1.x
410
+
411
+ If you're upgrading from an older version of Arshai:
412
+
413
+ 1. **Read the [Migration Guide](MIGRATION_GUIDE.md)** for detailed instructions
414
+ 2. **Use the migration script** for automatic import updates:
415
+ ```bash
416
+ python scripts/migrate_imports.py --path /path/to/your/project
417
+ ```
418
+ 3. **Enable compatibility mode** for gradual migration:
419
+ ```python
420
+ from arshai.compat import enable_compatibility_mode
421
+ enable_compatibility_mode()
422
+ ```
423
+
424
+ ## What's New in v0.2.0
425
+
426
+ - ๐Ÿ—๏ธ **Unified package structure** under `arshai` namespace
427
+ - ๐Ÿ”Œ **Plugin system** for easy extensibility
428
+ - ๐Ÿช **Hook system** for behavior customization
429
+ - ๐Ÿ“ฆ **PyPI distribution** for easy installation
430
+ - ๐Ÿ”„ **Backward compatibility** layer for smooth migration
431
+ - ๐Ÿ“š **Enhanced documentation** and examples
432
+ - ๐Ÿงช **Improved testing** and CI/CD
433
+
434
+ ## Contributing
435
+
436
+ Contributions are welcome! Please check out our [Contributing Guidelines](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
437
+
438
+ ## License
439
+
440
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.