pygpt-net 2.4.41__py3-none-any.whl → 2.4.44__py3-none-any.whl

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 (183) hide show
  1. CHANGELOG.md +19 -0
  2. README.md +151 -71
  3. pygpt_net/CHANGELOG.txt +19 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/app.py +3 -1
  6. pygpt_net/controller/attachment.py +31 -3
  7. pygpt_net/controller/audio/__init__.py +2 -2
  8. pygpt_net/controller/camera.py +1 -10
  9. pygpt_net/controller/chat/attachment.py +37 -36
  10. pygpt_net/controller/chat/audio.py +2 -2
  11. pygpt_net/controller/config/placeholder.py +20 -4
  12. pygpt_net/controller/idx/common.py +7 -3
  13. pygpt_net/controller/ui/mode.py +16 -21
  14. pygpt_net/core/attachments/__init__.py +7 -2
  15. pygpt_net/core/attachments/context.py +52 -34
  16. pygpt_net/core/audio/__init__.py +4 -1
  17. pygpt_net/core/audio/whisper.py +37 -0
  18. pygpt_net/core/bridge/worker.py +2 -2
  19. pygpt_net/core/db/__init__.py +2 -1
  20. pygpt_net/core/debug/attachments.py +1 -0
  21. pygpt_net/core/debug/events.py +22 -10
  22. pygpt_net/core/debug/tabs.py +6 -3
  23. pygpt_net/core/history.py +3 -2
  24. pygpt_net/core/idx/__init__.py +23 -6
  25. pygpt_net/core/idx/chat.py +15 -5
  26. pygpt_net/core/idx/indexing.py +47 -14
  27. pygpt_net/core/idx/ui/__init__.py +22 -0
  28. pygpt_net/core/idx/ui/loaders.py +217 -0
  29. pygpt_net/core/installer.py +2 -4
  30. pygpt_net/core/models.py +62 -17
  31. pygpt_net/core/modes.py +11 -13
  32. pygpt_net/core/notepad.py +4 -4
  33. pygpt_net/core/plugins.py +27 -16
  34. pygpt_net/core/presets.py +20 -9
  35. pygpt_net/core/profile.py +11 -3
  36. pygpt_net/core/render/web/parser.py +3 -1
  37. pygpt_net/core/settings.py +5 -5
  38. pygpt_net/core/tabs/tab.py +10 -2
  39. pygpt_net/core/tokens.py +8 -6
  40. pygpt_net/core/web/__init__.py +105 -0
  41. pygpt_net/core/{web.py → web/helpers.py} +93 -67
  42. pygpt_net/data/config/config.json +4 -4
  43. pygpt_net/data/config/models.json +3 -3
  44. pygpt_net/data/config/modes.json +3 -3
  45. pygpt_net/data/config/settings.json +5 -5
  46. pygpt_net/data/locale/locale.de.ini +3 -3
  47. pygpt_net/data/locale/locale.en.ini +12 -9
  48. pygpt_net/data/locale/locale.es.ini +3 -3
  49. pygpt_net/data/locale/locale.fr.ini +3 -3
  50. pygpt_net/data/locale/locale.it.ini +3 -3
  51. pygpt_net/data/locale/locale.pl.ini +3 -3
  52. pygpt_net/data/locale/locale.uk.ini +3 -3
  53. pygpt_net/data/locale/locale.zh.ini +3 -3
  54. pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
  55. pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
  56. pygpt_net/item/attachment.py +5 -1
  57. pygpt_net/item/ctx.py +111 -3
  58. pygpt_net/migrations/Version20241215110000.py +25 -0
  59. pygpt_net/migrations/__init__.py +3 -1
  60. pygpt_net/plugin/agent/__init__.py +7 -2
  61. pygpt_net/plugin/audio_output/__init__.py +6 -1
  62. pygpt_net/plugin/base/plugin.py +58 -26
  63. pygpt_net/plugin/base/worker.py +20 -17
  64. pygpt_net/plugin/cmd_files/__init__.py +3 -2
  65. pygpt_net/plugin/cmd_history/config.py +2 -2
  66. pygpt_net/plugin/cmd_web/__init__.py +3 -4
  67. pygpt_net/plugin/cmd_web/config.py +71 -3
  68. pygpt_net/plugin/cmd_web/websearch.py +20 -12
  69. pygpt_net/plugin/cmd_web/worker.py +67 -4
  70. pygpt_net/plugin/idx_llama_index/config.py +3 -3
  71. pygpt_net/plugin/mailer/__init__.py +123 -0
  72. pygpt_net/plugin/mailer/config.py +149 -0
  73. pygpt_net/plugin/mailer/runner.py +285 -0
  74. pygpt_net/plugin/mailer/worker.py +123 -0
  75. pygpt_net/provider/agents/base.py +5 -2
  76. pygpt_net/provider/agents/openai.py +4 -2
  77. pygpt_net/provider/agents/openai_assistant.py +4 -2
  78. pygpt_net/provider/agents/planner.py +4 -2
  79. pygpt_net/provider/agents/react.py +4 -2
  80. pygpt_net/provider/audio_output/openai_tts.py +5 -11
  81. pygpt_net/provider/core/assistant/base.py +5 -3
  82. pygpt_net/provider/core/assistant/json_file.py +8 -5
  83. pygpt_net/provider/core/assistant_file/base.py +4 -3
  84. pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
  85. pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
  86. pygpt_net/provider/core/assistant_store/base.py +6 -4
  87. pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
  88. pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
  89. pygpt_net/provider/core/attachment/base.py +5 -3
  90. pygpt_net/provider/core/attachment/json_file.py +7 -3
  91. pygpt_net/provider/core/calendar/base.py +5 -3
  92. pygpt_net/provider/core/calendar/db_sqlite/__init__.py +6 -5
  93. pygpt_net/provider/core/calendar/db_sqlite/storage.py +5 -4
  94. pygpt_net/provider/core/config/base.py +8 -6
  95. pygpt_net/provider/core/config/json_file.py +9 -7
  96. pygpt_net/provider/core/config/patch.py +6 -0
  97. pygpt_net/provider/core/ctx/base.py +27 -25
  98. pygpt_net/provider/core/ctx/db_sqlite/__init__.py +51 -35
  99. pygpt_net/provider/core/ctx/db_sqlite/storage.py +92 -38
  100. pygpt_net/provider/core/ctx/db_sqlite/utils.py +37 -11
  101. pygpt_net/provider/core/index/base.py +129 -23
  102. pygpt_net/provider/core/index/db_sqlite/__init__.py +130 -23
  103. pygpt_net/provider/core/index/db_sqlite/storage.py +130 -23
  104. pygpt_net/provider/core/index/db_sqlite/utils.py +4 -2
  105. pygpt_net/provider/core/mode/base.py +5 -3
  106. pygpt_net/provider/core/mode/json_file.py +7 -6
  107. pygpt_net/provider/core/model/base.py +6 -4
  108. pygpt_net/provider/core/model/json_file.py +9 -7
  109. pygpt_net/provider/core/notepad/base.py +5 -3
  110. pygpt_net/provider/core/notepad/db_sqlite/__init__.py +5 -4
  111. pygpt_net/provider/core/notepad/db_sqlite/storage.py +4 -3
  112. pygpt_net/provider/core/plugin_preset/base.py +4 -2
  113. pygpt_net/provider/core/plugin_preset/json_file.py +5 -3
  114. pygpt_net/provider/core/preset/base.py +6 -4
  115. pygpt_net/provider/core/preset/json_file.py +9 -9
  116. pygpt_net/provider/core/prompt/base.py +6 -3
  117. pygpt_net/provider/core/prompt/json_file.py +11 -6
  118. pygpt_net/provider/gpt/assistants.py +15 -6
  119. pygpt_net/provider/gpt/audio.py +5 -5
  120. pygpt_net/provider/gpt/chat.py +7 -5
  121. pygpt_net/provider/gpt/completion.py +8 -4
  122. pygpt_net/provider/gpt/image.py +3 -3
  123. pygpt_net/provider/gpt/store.py +46 -12
  124. pygpt_net/provider/gpt/vision.py +16 -11
  125. pygpt_net/provider/llms/anthropic.py +7 -2
  126. pygpt_net/provider/llms/azure_openai.py +26 -5
  127. pygpt_net/provider/llms/base.py +47 -9
  128. pygpt_net/provider/llms/google.py +7 -2
  129. pygpt_net/provider/llms/hugging_face.py +13 -3
  130. pygpt_net/provider/llms/hugging_face_api.py +18 -4
  131. pygpt_net/provider/llms/local.py +7 -2
  132. pygpt_net/provider/llms/ollama.py +30 -6
  133. pygpt_net/provider/llms/openai.py +32 -6
  134. pygpt_net/provider/loaders/base.py +14 -0
  135. pygpt_net/provider/loaders/hub/yt/base.py +5 -0
  136. pygpt_net/provider/loaders/web_database.py +13 -5
  137. pygpt_net/provider/loaders/web_github_issues.py +5 -1
  138. pygpt_net/provider/loaders/web_google_calendar.py +9 -1
  139. pygpt_net/provider/loaders/web_google_docs.py +6 -1
  140. pygpt_net/provider/loaders/web_google_drive.py +10 -1
  141. pygpt_net/provider/loaders/web_google_gmail.py +2 -1
  142. pygpt_net/provider/loaders/web_google_keep.py +5 -1
  143. pygpt_net/provider/loaders/web_google_sheets.py +5 -1
  144. pygpt_net/provider/loaders/web_microsoft_onedrive.py +15 -1
  145. pygpt_net/provider/loaders/web_page.py +4 -2
  146. pygpt_net/provider/loaders/web_rss.py +2 -1
  147. pygpt_net/provider/loaders/web_sitemap.py +2 -1
  148. pygpt_net/provider/loaders/web_twitter.py +4 -2
  149. pygpt_net/provider/loaders/web_yt.py +17 -2
  150. pygpt_net/provider/vector_stores/__init__.py +45 -14
  151. pygpt_net/provider/vector_stores/base.py +35 -8
  152. pygpt_net/provider/vector_stores/chroma.py +13 -3
  153. pygpt_net/provider/vector_stores/ctx_attachment.py +32 -13
  154. pygpt_net/provider/vector_stores/elasticsearch.py +12 -3
  155. pygpt_net/provider/vector_stores/pinecode.py +12 -3
  156. pygpt_net/provider/vector_stores/redis.py +12 -3
  157. pygpt_net/provider/vector_stores/simple.py +12 -3
  158. pygpt_net/provider/vector_stores/temp.py +16 -4
  159. pygpt_net/provider/web/base.py +10 -3
  160. pygpt_net/provider/web/google_custom_search.py +9 -3
  161. pygpt_net/provider/web/microsoft_bing.py +9 -3
  162. pygpt_net/tools/__init__.py +13 -5
  163. pygpt_net/tools/audio_transcriber/__init__.py +4 -3
  164. pygpt_net/tools/base.py +15 -8
  165. pygpt_net/tools/code_interpreter/__init__.py +4 -3
  166. pygpt_net/tools/html_canvas/__init__.py +4 -3
  167. pygpt_net/tools/image_viewer/__init__.py +10 -4
  168. pygpt_net/tools/indexer/__init__.py +15 -46
  169. pygpt_net/tools/indexer/ui/web.py +20 -78
  170. pygpt_net/tools/media_player/__init__.py +4 -3
  171. pygpt_net/tools/text_editor/__init__.py +36 -10
  172. pygpt_net/ui/layout/chat/output.py +2 -2
  173. pygpt_net/ui/layout/ctx/ctx_list.py +86 -18
  174. pygpt_net/ui/menu/audio.py +12 -1
  175. pygpt_net/ui/widget/dialog/url.py +151 -14
  176. pygpt_net/ui/widget/element/group.py +15 -2
  177. pygpt_net/ui/widget/lists/context.py +23 -9
  178. pygpt_net/utils.py +1 -1
  179. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/METADATA +152 -72
  180. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/RECORD +183 -173
  181. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/LICENSE +0 -0
  182. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/WHEEL +0 -0
  183. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/entry_points.txt +0 -0
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.08.19 20:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -30,12 +30,17 @@ class Loader(BaseLoader):
30
30
  "args": {
31
31
  "folder_id": {
32
32
  "type": "str",
33
+ "label": "Folder ID",
33
34
  },
34
35
  "file_ids": {
35
36
  "type": "list",
37
+ "label": "File IDs",
38
+ "description": "List of file ids, separated by comma (,)",
36
39
  },
37
40
  "mime_types": {
38
41
  "type": "list",
42
+ "label": "Mime Types",
43
+ "description": "List of mime types, separated by comma (,)",
39
44
  },
40
45
  },
41
46
  }
@@ -98,8 +103,12 @@ class Loader(BaseLoader):
98
103
  if "file_ids" in kwargs and kwargs.get("file_ids"):
99
104
  if isinstance(kwargs.get("file_ids"), list):
100
105
  args["file_ids"] = kwargs.get("file_ids") # list of file ids
106
+ elif isinstance(kwargs.get("file_ids"), str):
107
+ args["file_ids"] = self.explode(kwargs.get("file_ids"))
101
108
 
102
109
  if "mime_types" in kwargs and kwargs.get("mime_types"):
103
110
  if isinstance(kwargs.get("mime_types"), list):
104
111
  args["mime_types"] = kwargs.get("mime_types") # list of mime types
112
+ elif isinstance(kwargs.get("mime_types"), str):
113
+ args["mime_types"] = self.explode(kwargs.get("mime_types"))
105
114
  return args
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.17 01:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -30,6 +30,7 @@ class Loader(BaseLoader):
30
30
  "args": {
31
31
  "query": {
32
32
  "type": "str",
33
+ "label": "Query",
33
34
  },
34
35
  },
35
36
  }
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.17 01:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -30,6 +30,8 @@ class Loader(BaseLoader):
30
30
  "args": {
31
31
  "document_ids": {
32
32
  "type": "list",
33
+ "label": "Document IDs",
34
+ "description": "List of document ids, separated by comma (,)",
33
35
  },
34
36
  },
35
37
  }
@@ -74,4 +76,6 @@ class Loader(BaseLoader):
74
76
  if "document_ids" in kwargs and kwargs.get("document_ids"):
75
77
  if isinstance(kwargs.get("document_ids"), list):
76
78
  args["document_ids"] = kwargs.get("document_ids") # list of document ids
79
+ elif isinstance(kwargs.get("document_ids"), str):
80
+ args["document_ids"] = self.explode(kwargs.get("document_ids"))
77
81
  return args
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.17 01:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -30,6 +30,8 @@ class Loader(BaseLoader):
30
30
  "args": {
31
31
  "spreadsheet_ids": {
32
32
  "type": "list",
33
+ "label": "Spreadsheet IDs",
34
+ "description": "List of spreadsheet ids, separated by comma (,)",
33
35
  },
34
36
  },
35
37
  }
@@ -78,4 +80,6 @@ class Loader(BaseLoader):
78
80
  if "spreadsheet_ids" in kwargs and kwargs.get("spreadsheet_ids"):
79
81
  if isinstance(kwargs.get("spreadsheet_ids"), list):
80
82
  args["spreadsheet_ids"] = kwargs.get("spreadsheet_ids") # spreadsheet ids
83
+ elif isinstance(kwargs.get("spreadsheet_ids"), str):
84
+ args["spreadsheet_ids"] = self.explode(kwargs.get("spreadsheet_ids"))
81
85
  return args
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.17 01:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -30,18 +30,26 @@ class Loader(BaseLoader):
30
30
  "args": {
31
31
  "folder_id": {
32
32
  "type": "str",
33
+ "label": "Folder ID",
33
34
  },
34
35
  "file_ids": {
35
36
  "type": "list",
37
+ "label": "File IDs",
38
+ "description": "List of file ids, separated by comma (,)",
36
39
  },
37
40
  "mime_types": {
38
41
  "type": "list",
42
+ "label": "Mime Types",
43
+ "description": "List of mime types, separated by comma (,)",
39
44
  },
40
45
  "folder_path": {
41
46
  "type": "str",
47
+ "label": "Folder Path",
42
48
  },
43
49
  "file_paths": {
44
50
  "type": "list",
51
+ "label": "File Paths",
52
+ "description": "List of file paths, separated by comma (,)",
45
53
  },
46
54
  },
47
55
  }
@@ -98,10 +106,14 @@ class Loader(BaseLoader):
98
106
  if "file_ids" in kwargs and kwargs.get("file_ids"):
99
107
  if isinstance(kwargs.get("file_ids"), list):
100
108
  args["file_ids"] = kwargs.get("file_ids") # list of file ids
109
+ elif isinstance(kwargs.get("file_ids"), str):
110
+ args["file_ids"] = self.explode(kwargs.get("file_ids"))
101
111
 
102
112
  if "mime_types" in kwargs and kwargs.get("mime_types"):
103
113
  if isinstance(kwargs.get("mime_types"), list):
104
114
  args["mime_types"] = kwargs.get("mime_types") # list of mime types
115
+ elif isinstance(kwargs.get("mime_types"), str):
116
+ args["mime_types"] = self.explode(kwargs.get("mime_types"))
105
117
 
106
118
  if "folder_path" in kwargs and kwargs.get("folder_path"):
107
119
  if isinstance(kwargs.get("folder_path"), str):
@@ -110,4 +122,6 @@ class Loader(BaseLoader):
110
122
  if "file_paths" in kwargs and kwargs.get("file_paths"):
111
123
  if isinstance(kwargs.get("file_paths"), list):
112
124
  args["file_paths"] = kwargs.get("file_paths") # list of file paths
125
+ elif isinstance(kwargs.get("file_paths"), str):
126
+ args["file_paths"] = self.explode(kwargs.get("file_paths"))
113
127
  return args
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.03.12 06:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from llama_index.core.readers.base import BaseReader
@@ -19,7 +19,7 @@ class Loader(BaseLoader):
19
19
  def __init__(self, *args, **kwargs):
20
20
  super().__init__(*args, **kwargs)
21
21
  self.id = "webpage"
22
- self.name = "Webpages"
22
+ self.name = "Webpage"
23
23
  self.type = ["web"]
24
24
  self.instructions = [
25
25
  {
@@ -28,6 +28,8 @@ class Loader(BaseLoader):
28
28
  "args": {
29
29
  "url": {
30
30
  "type": "str",
31
+ "label": "URL",
32
+ "description": "URL of the webpage to index, e.g. https://www.example.com",
31
33
  },
32
34
  },
33
35
  }
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.03.12 06:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from llama_index.core.readers.base import BaseReader
@@ -28,6 +28,7 @@ class Loader(BaseLoader):
28
28
  "args": {
29
29
  "url": {
30
30
  "type": "str",
31
+ "label": "URL",
31
32
  },
32
33
  },
33
34
  }
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.17 01:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from llama_index.core.readers.base import BaseReader
@@ -28,6 +28,7 @@ class Loader(BaseLoader):
28
28
  "args": {
29
29
  "url": {
30
30
  "type": "str",
31
+ "label": "URL",
31
32
  },
32
33
  },
33
34
  }
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.04.17 01:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -30,9 +30,11 @@ class Loader(BaseLoader):
30
30
  "args": {
31
31
  "users": {
32
32
  "type": "list",
33
+ "label": "Twitter/X usernames",
33
34
  },
34
35
  "max_tweets": {
35
36
  "type": "int",
37
+ "label": "Max tweets",
36
38
  },
37
39
  },
38
40
  }
@@ -80,7 +82,7 @@ class Loader(BaseLoader):
80
82
  if isinstance(kwargs.get("users"), list):
81
83
  args["twitterhandles"] = kwargs.get("users") # usernames
82
84
  elif isinstance(kwargs.get("users"), str):
83
- args["twitterhandles"] = [kwargs.get("users")]
85
+ args["twitterhandles"] = self.explode(kwargs.get("users"))
84
86
 
85
87
  if "max_tweets" in kwargs and kwargs.get("max_tweets"):
86
88
  if isinstance(kwargs.get("max_tweets"), int):
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.26 04:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from llama_index.core.readers.base import BaseReader
@@ -28,11 +28,25 @@ class Loader(BaseLoader):
28
28
  "args": {
29
29
  "url": {
30
30
  "type": "str",
31
+ "label": "Youtube URL",
32
+ "description": "URL of the YouTube video, e.g. https://www.youtube.com/watch?v=CRRlbK5w8AE",
31
33
  },
32
34
  },
33
35
  }
34
36
  }
35
37
  ]
38
+ self.init_args = {
39
+ "languages": ["en"],
40
+ }
41
+ self.init_args_types = {
42
+ "languages": "list",
43
+ }
44
+ self.init_args_labels = {
45
+ "languages": "Languages",
46
+ }
47
+ self.init_args_desc = {
48
+ "languages": "List of languages to extract from the video, separated by comma (,), e.g. 'en,de,fr'. Default is 'en'",
49
+ }
36
50
 
37
51
  def get(self) -> BaseReader:
38
52
  """
@@ -40,7 +54,8 @@ class Loader(BaseLoader):
40
54
 
41
55
  :return: Data reader instance
42
56
  """
43
- return YoutubeTranscriptReader()
57
+ args = self.get_args()
58
+ return YoutubeTranscriptReader(**args)
44
59
 
45
60
  def prepare_args(self, **kwargs) -> dict:
46
61
  """
@@ -6,11 +6,13 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.23 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import hashlib
13
+ from typing import Optional, Tuple, List
13
14
 
15
+ from llama_index.core.indices.service_context import ServiceContext
14
16
  from llama_index.core.indices.base import BaseIndex
15
17
  from llama_index.core.indices.vector_store.base import VectorStoreIndex
16
18
 
@@ -31,7 +33,7 @@ class Storage:
31
33
  self.indexes = {}
32
34
  self.tmp_storage = TempProvider(window=window)
33
35
 
34
- def get_storage(self) -> BaseStore or None:
36
+ def get_storage(self) -> Optional[BaseStore]:
35
37
  """
36
38
  Get current vector store provider
37
39
 
@@ -44,7 +46,7 @@ class Storage:
44
46
  return None
45
47
  return self.storages[current]
46
48
 
47
- def get_tmp_storage(self) -> BaseStore or None:
49
+ def get_tmp_storage(self) -> Optional[TempProvider]:
48
50
  """
49
51
  Get temp vector store provider
50
52
 
@@ -52,16 +54,19 @@ class Storage:
52
54
  """
53
55
  return self.tmp_storage
54
56
 
55
- def get_ctx_idx_storage(self, path: str) -> BaseStore or None:
57
+ def get_ctx_idx_storage(self, path: str) -> CtxAttachmentProvider:
56
58
  """
57
59
  Get temp vector store provider
58
60
 
59
61
  :param path: Path to index on disk
60
62
  :return: vector store provider instance
61
63
  """
62
- return CtxAttachmentProvider(window=self.window, path=path)
64
+ return CtxAttachmentProvider(
65
+ window=self.window,
66
+ path=path
67
+ )
63
68
 
64
- def register(self, name: str, storage=None):
69
+ def register(self, name: str, storage: BaseStore):
65
70
  """
66
71
  Register vector store provider
67
72
 
@@ -71,7 +76,7 @@ class Storage:
71
76
  storage.attach(window=self.window)
72
77
  self.storages[name] = storage
73
78
 
74
- def get_ids(self) -> list:
79
+ def get_ids(self) -> List[str]:
75
80
  """
76
81
  Return all vector store providers IDs
77
82
 
@@ -79,7 +84,7 @@ class Storage:
79
84
  """
80
85
  return list(self.storages.keys())
81
86
 
82
- def exists(self, id: str = None) -> bool:
87
+ def exists(self, id: Optional[str] = None) -> bool:
83
88
  """
84
89
  Check if index exists
85
90
 
@@ -102,7 +107,11 @@ class Storage:
102
107
  raise Exception('Storage engine not found!')
103
108
  storage.create(id)
104
109
 
105
- def get(self, id: str, service_context=None) -> BaseIndex:
110
+ def get(
111
+ self,
112
+ id: str,
113
+ service_context: Optional[ServiceContext]
114
+ ) -> BaseIndex:
106
115
  """
107
116
  Get index instance
108
117
 
@@ -118,7 +127,11 @@ class Storage:
118
127
  service_context=service_context,
119
128
  )
120
129
 
121
- def store(self, id: str, index: BaseIndex = None):
130
+ def store(
131
+ self,
132
+ id: str,
133
+ index: Optional[BaseIndex] = None
134
+ ):
122
135
  """
123
136
  Store index
124
137
 
@@ -173,7 +186,11 @@ class Storage:
173
186
  doc_id=doc_id,
174
187
  )
175
188
 
176
- def get_tmp(self, identifier: str, service_context=None) -> (str, BaseIndex):
189
+ def get_tmp(
190
+ self,
191
+ identifier: str,
192
+ service_context: Optional[ServiceContext] = None
193
+ ) -> Tuple[str, BaseIndex]:
177
194
  """
178
195
  Get tmp index instance
179
196
 
@@ -191,7 +208,11 @@ class Storage:
191
208
  service_context=service_context,
192
209
  )
193
210
 
194
- def store_tmp(self, id: str, index: BaseIndex = None):
211
+ def store_tmp(
212
+ self,
213
+ id: str,
214
+ index: Optional[BaseIndex] = None
215
+ ):
195
216
  """
196
217
  Store index
197
218
 
@@ -228,7 +249,11 @@ class Storage:
228
249
  raise Exception('Storage engine not found!')
229
250
  storage.clean(id)
230
251
 
231
- def get_ctx_idx(self, path: str, service_context=None) -> (str, BaseIndex):
252
+ def get_ctx_idx(
253
+ self,
254
+ path: str,
255
+ service_context: Optional[ServiceContext] = None
256
+ ) -> BaseIndex:
232
257
  """
233
258
  Get context index instance
234
259
 
@@ -241,10 +266,15 @@ class Storage:
241
266
  if storage is None:
242
267
  raise Exception('Storage engine not found!')
243
268
  return storage.get(
269
+ id="",
244
270
  service_context=service_context,
245
271
  )
246
272
 
247
- def store_ctx_idx(self, path: str, index: BaseIndex = None):
273
+ def store_ctx_idx(
274
+ self,
275
+ path: str,
276
+ index: Optional[BaseIndex] = None
277
+ ):
248
278
  """
249
279
  Store context index
250
280
 
@@ -255,6 +285,7 @@ class Storage:
255
285
  if storage is None:
256
286
  raise Exception('Storage engine not found!')
257
287
  storage.store(
288
+ id="",
258
289
  index=index,
259
290
  )
260
291
 
@@ -6,11 +6,12 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.08.20 19:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
13
13
  import shutil
14
+ from typing import Optional
14
15
 
15
16
  from llama_index.core.indices.base import BaseIndex
16
17
  from llama_index.core.indices.service_context import ServiceContext
@@ -31,7 +32,12 @@ class BaseStore:
31
32
  self.prefix = "" # prefix for index directory
32
33
  self.indexes = {}
33
34
 
34
- def index_from_store(self, vector_store, storage_context: StorageContext, service_context: ServiceContext = None):
35
+ def index_from_store(
36
+ self,
37
+ vector_store,
38
+ storage_context: StorageContext,
39
+ service_context: Optional[ServiceContext] = None
40
+ ):
35
41
  """
36
42
  Get index instance
37
43
 
@@ -74,7 +80,10 @@ class BaseStore:
74
80
  self.prefix + id,
75
81
  )
76
82
 
77
- def exists(self, id: str = None) -> bool:
83
+ def exists(
84
+ self,
85
+ id: Optional[str] = None
86
+ ) -> bool:
78
87
  """
79
88
  Check if index with id exists
80
89
 
@@ -94,7 +103,11 @@ class BaseStore:
94
103
  """
95
104
  pass
96
105
 
97
- def get(self, id: str, service_context: ServiceContext = None) -> BaseIndex:
106
+ def get(
107
+ self,
108
+ id: str,
109
+ service_context: Optional[ServiceContext] = None
110
+ ) -> BaseIndex:
98
111
  """
99
112
  Get index instance
100
113
 
@@ -104,7 +117,11 @@ class BaseStore:
104
117
  """
105
118
  pass
106
119
 
107
- def store(self, id: str, index: BaseIndex = None):
120
+ def store(
121
+ self,
122
+ id: str,
123
+ index: Optional[BaseIndex] = None
124
+ ):
108
125
  """
109
126
  Store/persist index
110
127
 
@@ -113,7 +130,10 @@ class BaseStore:
113
130
  """
114
131
  pass
115
132
 
116
- def remove(self, id: str) -> bool:
133
+ def remove(
134
+ self,
135
+ id: str
136
+ ) -> bool:
117
137
  """
118
138
  Clear index
119
139
 
@@ -127,7 +147,10 @@ class BaseStore:
127
147
  shutil.rmtree(path)
128
148
  return True
129
149
 
130
- def truncate(self, id: str) -> bool:
150
+ def truncate(
151
+ self,
152
+ id: str
153
+ ) -> bool:
131
154
  """
132
155
  Truncate index
133
156
 
@@ -136,7 +159,11 @@ class BaseStore:
136
159
  """
137
160
  return self.remove(id)
138
161
 
139
- def remove_document(self, id: str, doc_id: str) -> bool:
162
+ def remove_document(
163
+ self,
164
+ id: str,
165
+ doc_id: str
166
+ ) -> bool:
140
167
  """
141
168
  Remove document from index
142
169
 
@@ -6,10 +6,12 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.14 05:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os.path
13
+ from typing import Optional
14
+
13
15
  import chromadb
14
16
  from chromadb.config import Settings
15
17
 
@@ -64,7 +66,11 @@ class ChromaProvider(BaseStore):
64
66
  index=index,
65
67
  )
66
68
 
67
- def get(self, id: str, service_context: ServiceContext = None) -> BaseIndex:
69
+ def get(
70
+ self,
71
+ id: str,
72
+ service_context: Optional[ServiceContext] = None
73
+ ) -> BaseIndex:
68
74
  """
69
75
  Get index
70
76
 
@@ -86,7 +92,11 @@ class ChromaProvider(BaseStore):
86
92
  self.indexes[id] = self.index_from_store(vector_store, storage_context, service_context)
87
93
  return self.indexes[id]
88
94
 
89
- def store(self, id: str, index: BaseIndex = None):
95
+ def store(
96
+ self,
97
+ id: str,
98
+ index: Optional[BaseIndex] = None
99
+ ):
90
100
  """
91
101
  Store index
92
102