alita-sdk 0.3.351__py3-none-any.whl → 0.3.499__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.
- alita_sdk/cli/__init__.py +10 -0
- alita_sdk/cli/__main__.py +17 -0
- alita_sdk/cli/agent/__init__.py +5 -0
- alita_sdk/cli/agent/default.py +258 -0
- alita_sdk/cli/agent_executor.py +155 -0
- alita_sdk/cli/agent_loader.py +215 -0
- alita_sdk/cli/agent_ui.py +228 -0
- alita_sdk/cli/agents.py +3601 -0
- alita_sdk/cli/callbacks.py +647 -0
- alita_sdk/cli/cli.py +168 -0
- alita_sdk/cli/config.py +306 -0
- alita_sdk/cli/context/__init__.py +30 -0
- alita_sdk/cli/context/cleanup.py +198 -0
- alita_sdk/cli/context/manager.py +731 -0
- alita_sdk/cli/context/message.py +285 -0
- alita_sdk/cli/context/strategies.py +289 -0
- alita_sdk/cli/context/token_estimation.py +127 -0
- alita_sdk/cli/formatting.py +182 -0
- alita_sdk/cli/input_handler.py +419 -0
- alita_sdk/cli/inventory.py +1256 -0
- alita_sdk/cli/mcp_loader.py +315 -0
- alita_sdk/cli/toolkit.py +327 -0
- alita_sdk/cli/toolkit_loader.py +85 -0
- alita_sdk/cli/tools/__init__.py +43 -0
- alita_sdk/cli/tools/approval.py +224 -0
- alita_sdk/cli/tools/filesystem.py +1751 -0
- alita_sdk/cli/tools/planning.py +389 -0
- alita_sdk/cli/tools/terminal.py +414 -0
- alita_sdk/community/__init__.py +64 -8
- alita_sdk/community/inventory/__init__.py +224 -0
- alita_sdk/community/inventory/config.py +257 -0
- alita_sdk/community/inventory/enrichment.py +2137 -0
- alita_sdk/community/inventory/extractors.py +1469 -0
- alita_sdk/community/inventory/ingestion.py +3172 -0
- alita_sdk/community/inventory/knowledge_graph.py +1457 -0
- alita_sdk/community/inventory/parsers/__init__.py +218 -0
- alita_sdk/community/inventory/parsers/base.py +295 -0
- alita_sdk/community/inventory/parsers/csharp_parser.py +907 -0
- alita_sdk/community/inventory/parsers/go_parser.py +851 -0
- alita_sdk/community/inventory/parsers/html_parser.py +389 -0
- alita_sdk/community/inventory/parsers/java_parser.py +593 -0
- alita_sdk/community/inventory/parsers/javascript_parser.py +629 -0
- alita_sdk/community/inventory/parsers/kotlin_parser.py +768 -0
- alita_sdk/community/inventory/parsers/markdown_parser.py +362 -0
- alita_sdk/community/inventory/parsers/python_parser.py +604 -0
- alita_sdk/community/inventory/parsers/rust_parser.py +858 -0
- alita_sdk/community/inventory/parsers/swift_parser.py +832 -0
- alita_sdk/community/inventory/parsers/text_parser.py +322 -0
- alita_sdk/community/inventory/parsers/yaml_parser.py +370 -0
- alita_sdk/community/inventory/patterns/__init__.py +61 -0
- alita_sdk/community/inventory/patterns/ast_adapter.py +380 -0
- alita_sdk/community/inventory/patterns/loader.py +348 -0
- alita_sdk/community/inventory/patterns/registry.py +198 -0
- alita_sdk/community/inventory/presets.py +535 -0
- alita_sdk/community/inventory/retrieval.py +1403 -0
- alita_sdk/community/inventory/toolkit.py +173 -0
- alita_sdk/community/inventory/visualize.py +1370 -0
- alita_sdk/configurations/bitbucket.py +94 -2
- alita_sdk/configurations/confluence.py +96 -1
- alita_sdk/configurations/gitlab.py +79 -0
- alita_sdk/configurations/jira.py +103 -0
- alita_sdk/configurations/testrail.py +88 -0
- alita_sdk/configurations/xray.py +93 -0
- alita_sdk/configurations/zephyr_enterprise.py +93 -0
- alita_sdk/configurations/zephyr_essential.py +75 -0
- alita_sdk/runtime/clients/artifact.py +1 -1
- alita_sdk/runtime/clients/client.py +214 -42
- alita_sdk/runtime/clients/mcp_discovery.py +342 -0
- alita_sdk/runtime/clients/mcp_manager.py +262 -0
- alita_sdk/runtime/clients/sandbox_client.py +373 -0
- alita_sdk/runtime/langchain/assistant.py +118 -30
- alita_sdk/runtime/langchain/constants.py +8 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py +315 -3
- alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py +103 -60
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py +4 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +41 -12
- alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py +1 -1
- alita_sdk/runtime/langchain/document_loaders/constants.py +116 -99
- alita_sdk/runtime/langchain/interfaces/llm_processor.py +2 -2
- alita_sdk/runtime/langchain/langraph_agent.py +307 -71
- alita_sdk/runtime/langchain/utils.py +48 -8
- alita_sdk/runtime/llms/preloaded.py +2 -6
- alita_sdk/runtime/models/mcp_models.py +61 -0
- alita_sdk/runtime/toolkits/__init__.py +26 -0
- alita_sdk/runtime/toolkits/application.py +9 -2
- alita_sdk/runtime/toolkits/artifact.py +18 -6
- alita_sdk/runtime/toolkits/datasource.py +13 -6
- alita_sdk/runtime/toolkits/mcp.py +780 -0
- alita_sdk/runtime/toolkits/planning.py +178 -0
- alita_sdk/runtime/toolkits/tools.py +205 -55
- alita_sdk/runtime/toolkits/vectorstore.py +9 -4
- alita_sdk/runtime/tools/__init__.py +11 -3
- alita_sdk/runtime/tools/application.py +7 -0
- alita_sdk/runtime/tools/artifact.py +225 -12
- alita_sdk/runtime/tools/function.py +95 -5
- alita_sdk/runtime/tools/graph.py +10 -4
- alita_sdk/runtime/tools/image_generation.py +212 -0
- alita_sdk/runtime/tools/llm.py +494 -102
- alita_sdk/runtime/tools/mcp_inspect_tool.py +284 -0
- alita_sdk/runtime/tools/mcp_remote_tool.py +181 -0
- alita_sdk/runtime/tools/mcp_server_tool.py +4 -4
- alita_sdk/runtime/tools/planning/__init__.py +36 -0
- alita_sdk/runtime/tools/planning/models.py +246 -0
- alita_sdk/runtime/tools/planning/wrapper.py +607 -0
- alita_sdk/runtime/tools/router.py +2 -1
- alita_sdk/runtime/tools/sandbox.py +180 -79
- alita_sdk/runtime/tools/vectorstore.py +22 -21
- alita_sdk/runtime/tools/vectorstore_base.py +125 -52
- alita_sdk/runtime/utils/AlitaCallback.py +106 -20
- alita_sdk/runtime/utils/mcp_client.py +465 -0
- alita_sdk/runtime/utils/mcp_oauth.py +244 -0
- alita_sdk/runtime/utils/mcp_sse_client.py +405 -0
- alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
- alita_sdk/runtime/utils/streamlit.py +40 -13
- alita_sdk/runtime/utils/toolkit_utils.py +28 -9
- alita_sdk/runtime/utils/utils.py +12 -0
- alita_sdk/tools/__init__.py +77 -33
- alita_sdk/tools/ado/repos/__init__.py +7 -6
- alita_sdk/tools/ado/repos/repos_wrapper.py +11 -11
- alita_sdk/tools/ado/test_plan/__init__.py +7 -7
- alita_sdk/tools/ado/wiki/__init__.py +7 -11
- alita_sdk/tools/ado/wiki/ado_wrapper.py +89 -15
- alita_sdk/tools/ado/work_item/__init__.py +7 -11
- alita_sdk/tools/ado/work_item/ado_wrapper.py +17 -8
- alita_sdk/tools/advanced_jira_mining/__init__.py +8 -7
- alita_sdk/tools/aws/delta_lake/__init__.py +11 -9
- alita_sdk/tools/azure_ai/search/__init__.py +7 -6
- alita_sdk/tools/base_indexer_toolkit.py +345 -70
- alita_sdk/tools/bitbucket/__init__.py +9 -8
- alita_sdk/tools/bitbucket/api_wrapper.py +50 -6
- alita_sdk/tools/browser/__init__.py +4 -4
- alita_sdk/tools/carrier/__init__.py +4 -6
- alita_sdk/tools/chunkers/__init__.py +3 -1
- alita_sdk/tools/chunkers/sematic/json_chunker.py +1 -0
- alita_sdk/tools/chunkers/sematic/markdown_chunker.py +97 -6
- alita_sdk/tools/chunkers/sematic/proposal_chunker.py +1 -1
- alita_sdk/tools/chunkers/universal_chunker.py +270 -0
- alita_sdk/tools/cloud/aws/__init__.py +7 -6
- alita_sdk/tools/cloud/azure/__init__.py +7 -6
- alita_sdk/tools/cloud/gcp/__init__.py +7 -6
- alita_sdk/tools/cloud/k8s/__init__.py +7 -6
- alita_sdk/tools/code/linter/__init__.py +7 -7
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code/sonar/__init__.py +8 -7
- alita_sdk/tools/code_indexer_toolkit.py +199 -0
- alita_sdk/tools/confluence/__init__.py +9 -8
- alita_sdk/tools/confluence/api_wrapper.py +171 -75
- alita_sdk/tools/confluence/loader.py +10 -0
- alita_sdk/tools/custom_open_api/__init__.py +9 -4
- alita_sdk/tools/elastic/__init__.py +8 -7
- alita_sdk/tools/elitea_base.py +492 -52
- alita_sdk/tools/figma/__init__.py +7 -7
- alita_sdk/tools/figma/api_wrapper.py +2 -1
- alita_sdk/tools/github/__init__.py +9 -9
- alita_sdk/tools/github/api_wrapper.py +9 -26
- alita_sdk/tools/github/github_client.py +62 -2
- alita_sdk/tools/gitlab/__init__.py +8 -8
- alita_sdk/tools/gitlab/api_wrapper.py +135 -33
- alita_sdk/tools/gitlab_org/__init__.py +7 -8
- alita_sdk/tools/google/bigquery/__init__.py +11 -12
- alita_sdk/tools/google_places/__init__.py +8 -7
- alita_sdk/tools/jira/__init__.py +9 -7
- alita_sdk/tools/jira/api_wrapper.py +100 -52
- alita_sdk/tools/keycloak/__init__.py +8 -7
- alita_sdk/tools/localgit/local_git.py +56 -54
- alita_sdk/tools/memory/__init__.py +1 -1
- alita_sdk/tools/non_code_indexer_toolkit.py +3 -2
- alita_sdk/tools/ocr/__init__.py +8 -7
- alita_sdk/tools/openapi/__init__.py +10 -1
- alita_sdk/tools/pandas/__init__.py +8 -7
- alita_sdk/tools/postman/__init__.py +7 -8
- alita_sdk/tools/postman/api_wrapper.py +19 -8
- alita_sdk/tools/postman/postman_analysis.py +8 -1
- alita_sdk/tools/pptx/__init__.py +8 -9
- alita_sdk/tools/qtest/__init__.py +16 -11
- alita_sdk/tools/qtest/api_wrapper.py +1784 -88
- alita_sdk/tools/rally/__init__.py +7 -8
- alita_sdk/tools/report_portal/__init__.py +9 -7
- alita_sdk/tools/salesforce/__init__.py +7 -7
- alita_sdk/tools/servicenow/__init__.py +10 -10
- alita_sdk/tools/sharepoint/__init__.py +7 -6
- alita_sdk/tools/sharepoint/api_wrapper.py +127 -36
- alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
- alita_sdk/tools/sharepoint/utils.py +8 -2
- alita_sdk/tools/slack/__init__.py +7 -6
- alita_sdk/tools/sql/__init__.py +8 -7
- alita_sdk/tools/sql/api_wrapper.py +71 -23
- alita_sdk/tools/testio/__init__.py +7 -6
- alita_sdk/tools/testrail/__init__.py +8 -9
- alita_sdk/tools/utils/__init__.py +26 -4
- alita_sdk/tools/utils/content_parser.py +88 -60
- alita_sdk/tools/utils/text_operations.py +254 -0
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +76 -26
- alita_sdk/tools/xray/__init__.py +9 -7
- alita_sdk/tools/zephyr/__init__.py +7 -6
- alita_sdk/tools/zephyr_enterprise/__init__.py +8 -6
- alita_sdk/tools/zephyr_essential/__init__.py +7 -6
- alita_sdk/tools/zephyr_essential/api_wrapper.py +12 -13
- alita_sdk/tools/zephyr_scale/__init__.py +7 -6
- alita_sdk/tools/zephyr_squad/__init__.py +7 -6
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/METADATA +147 -2
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/RECORD +206 -130
- alita_sdk-0.3.499.dist-info/entry_points.txt +2 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/top_level.txt +0 -0
|
@@ -63,7 +63,7 @@ class AlitaTableLoader(BaseLoader):
|
|
|
63
63
|
"source": f'{self.file_path}:{idx+1}',
|
|
64
64
|
"table_source": self.file_path,
|
|
65
65
|
}
|
|
66
|
-
if len(docs) == 0:
|
|
66
|
+
if len(docs) == 0 and not self.raw_content:
|
|
67
67
|
header_metadata = metadata.copy()
|
|
68
68
|
header_metadata["header"] = "true"
|
|
69
69
|
header = "\t".join([str(value) for value in row.keys()])
|
|
@@ -27,81 +27,79 @@ from .AlitaTextLoader import AlitaTextLoader
|
|
|
27
27
|
from .AlitaMarkdownLoader import AlitaMarkdownLoader
|
|
28
28
|
from .AlitaPythonLoader import AlitaPythonLoader
|
|
29
29
|
from enum import Enum
|
|
30
|
+
from alita_sdk.runtime.langchain.constants import LOADER_MAX_TOKENS_DEFAULT
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class LoaderProperties(Enum):
|
|
33
|
-
LLM = '
|
|
34
|
+
LLM = 'use_llm'
|
|
35
|
+
PROMPT_DEFAULT = 'use_default_prompt'
|
|
34
36
|
PROMPT = 'prompt'
|
|
35
|
-
PROMPT_DEFAULT = 'prompt_default'
|
|
36
37
|
|
|
38
|
+
DEFAULT_ALLOWED_BASE = {'max_tokens': LOADER_MAX_TOKENS_DEFAULT}
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
DEFAULT_ALLOWED_WITH_LLM = {
|
|
41
|
+
**DEFAULT_ALLOWED_BASE,
|
|
42
|
+
LoaderProperties.LLM.value: False,
|
|
43
|
+
LoaderProperties.PROMPT_DEFAULT.value: False,
|
|
44
|
+
LoaderProperties.PROMPT.value: "",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
DEFAULT_ALLOWED_EXCEL = {**DEFAULT_ALLOWED_WITH_LLM, 'add_header_to_chunks': False, 'header_row_number': 1, 'max_tokens': -1, 'sheet_name': ''}
|
|
48
|
+
|
|
49
|
+
# Image file loaders mapping - directly supported by LLM with image_url
|
|
39
50
|
image_loaders_map = {
|
|
40
51
|
'.png': {
|
|
41
52
|
'class': AlitaImageLoader,
|
|
42
53
|
'mime_type': 'image/png',
|
|
43
54
|
'is_multimodal_processing': True,
|
|
44
55
|
'kwargs': {},
|
|
45
|
-
'allowed_to_override':
|
|
46
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
47
|
-
LoaderProperties.PROMPT.value,
|
|
48
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
49
|
-
],
|
|
56
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM,
|
|
50
57
|
},
|
|
51
58
|
'.jpg': {
|
|
52
59
|
'class': AlitaImageLoader,
|
|
53
60
|
'mime_type': 'image/jpeg',
|
|
54
61
|
'is_multimodal_processing': True,
|
|
55
62
|
'kwargs': {},
|
|
56
|
-
'allowed_to_override':
|
|
57
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
58
|
-
LoaderProperties.PROMPT.value,
|
|
59
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
60
|
-
]
|
|
63
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
61
64
|
},
|
|
62
65
|
'.jpeg': {
|
|
63
66
|
'class': AlitaImageLoader,
|
|
64
67
|
'mime_type': 'image/jpeg',
|
|
65
68
|
'is_multimodal_processing': True,
|
|
66
69
|
'kwargs': {},
|
|
67
|
-
'allowed_to_override':
|
|
68
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
69
|
-
LoaderProperties.PROMPT.value,
|
|
70
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
71
|
-
]
|
|
70
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
72
71
|
},
|
|
73
72
|
'.gif': {
|
|
74
73
|
'class': AlitaImageLoader,
|
|
75
74
|
'mime_type': 'image/gif',
|
|
76
75
|
'is_multimodal_processing': True,
|
|
77
76
|
'kwargs': {},
|
|
78
|
-
'allowed_to_override':
|
|
79
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
80
|
-
LoaderProperties.PROMPT.value,
|
|
81
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
82
|
-
]
|
|
77
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
83
78
|
},
|
|
79
|
+
'.webp': {
|
|
80
|
+
'class': AlitaImageLoader,
|
|
81
|
+
'mime_type': 'image/webp',
|
|
82
|
+
'is_multimodal_processing': True,
|
|
83
|
+
'kwargs': {},
|
|
84
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Image file loaders mapping - require conversion before sending to LLM
|
|
89
|
+
image_loaders_map_converted = {
|
|
84
90
|
'.bmp': {
|
|
85
91
|
'class': AlitaImageLoader,
|
|
86
92
|
'mime_type': 'image/bmp',
|
|
87
93
|
'is_multimodal_processing': True,
|
|
88
94
|
'kwargs': {},
|
|
89
|
-
'allowed_to_override':
|
|
90
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
91
|
-
LoaderProperties.PROMPT.value,
|
|
92
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
93
|
-
]
|
|
95
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
94
96
|
},
|
|
95
97
|
'.svg': {
|
|
96
98
|
'class': AlitaImageLoader,
|
|
97
99
|
'mime_type': 'image/svg+xml',
|
|
98
100
|
'is_multimodal_processing': True,
|
|
99
101
|
'kwargs': {},
|
|
100
|
-
'allowed_to_override':
|
|
101
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
102
|
-
LoaderProperties.PROMPT.value,
|
|
103
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
104
|
-
]
|
|
102
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
105
|
|
|
@@ -114,25 +112,25 @@ document_loaders_map = {
|
|
|
114
112
|
'kwargs': {
|
|
115
113
|
'autodetect_encoding': True
|
|
116
114
|
},
|
|
117
|
-
'allowed_to_override':
|
|
115
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
118
116
|
},
|
|
119
117
|
'.yml': {
|
|
120
118
|
'class': AlitaTextLoader,
|
|
121
|
-
'mime_type': 'application/
|
|
119
|
+
'mime_type': 'application/yaml',
|
|
122
120
|
'is_multimodal_processing': False,
|
|
123
121
|
'kwargs': {
|
|
124
122
|
'autodetect_encoding': True
|
|
125
123
|
},
|
|
126
|
-
'allowed_to_override':
|
|
124
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
127
125
|
},
|
|
128
126
|
'.yaml': {
|
|
129
127
|
'class': AlitaTextLoader,
|
|
130
|
-
'mime_type': 'application/
|
|
128
|
+
'mime_type': 'application/yaml',
|
|
131
129
|
'is_multimodal_processing': False,
|
|
132
130
|
'kwargs': {
|
|
133
131
|
'autodetect_encoding': True
|
|
134
132
|
},
|
|
135
|
-
'allowed_to_override':
|
|
133
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
136
134
|
},
|
|
137
135
|
'.groovy': {
|
|
138
136
|
'class': AlitaTextLoader,
|
|
@@ -141,14 +139,14 @@ document_loaders_map = {
|
|
|
141
139
|
'kwargs': {
|
|
142
140
|
'autodetect_encoding': True
|
|
143
141
|
},
|
|
144
|
-
'allowed_to_override':
|
|
142
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
145
143
|
},
|
|
146
144
|
'.md': {
|
|
147
145
|
'class': AlitaMarkdownLoader,
|
|
148
146
|
'mime_type': 'text/markdown',
|
|
149
147
|
'is_multimodal_processing': False,
|
|
150
148
|
'kwargs': {},
|
|
151
|
-
'allowed_to_override':
|
|
149
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
152
150
|
},
|
|
153
151
|
'.csv': {
|
|
154
152
|
'class': AlitaCSVLoader,
|
|
@@ -159,7 +157,7 @@ document_loaders_map = {
|
|
|
159
157
|
'raw_content': True,
|
|
160
158
|
'cleanse': False
|
|
161
159
|
},
|
|
162
|
-
'allowed_to_override':
|
|
160
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
163
161
|
},
|
|
164
162
|
'.xlsx': {
|
|
165
163
|
'class': AlitaExcelLoader,
|
|
@@ -167,15 +165,12 @@ document_loaders_map = {
|
|
|
167
165
|
'spreadsheetml.sheet'),
|
|
168
166
|
'is_multimodal_processing': False,
|
|
169
167
|
'kwargs': {
|
|
170
|
-
'
|
|
171
|
-
'
|
|
172
|
-
'
|
|
168
|
+
'add_header_to_chunks': False,
|
|
169
|
+
'header_row_number': 1,
|
|
170
|
+
'max_tokens': -1,
|
|
171
|
+
'sheet_name': ''
|
|
173
172
|
},
|
|
174
|
-
'allowed_to_override':
|
|
175
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
176
|
-
LoaderProperties.PROMPT.value,
|
|
177
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
178
|
-
]
|
|
173
|
+
'allowed_to_override': DEFAULT_ALLOWED_EXCEL
|
|
179
174
|
},
|
|
180
175
|
'.xls': {
|
|
181
176
|
'class': AlitaExcelLoader,
|
|
@@ -186,22 +181,14 @@ document_loaders_map = {
|
|
|
186
181
|
'raw_content': True,
|
|
187
182
|
'cleanse': False
|
|
188
183
|
},
|
|
189
|
-
'allowed_to_override':
|
|
190
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
191
|
-
LoaderProperties.PROMPT.value,
|
|
192
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
193
|
-
]
|
|
184
|
+
'allowed_to_override': DEFAULT_ALLOWED_EXCEL
|
|
194
185
|
},
|
|
195
186
|
'.pdf': {
|
|
196
187
|
'class': AlitaPDFLoader,
|
|
197
188
|
'mime_type': 'application/pdf',
|
|
198
189
|
'is_multimodal_processing': False,
|
|
199
190
|
'kwargs': {},
|
|
200
|
-
'allowed_to_override':
|
|
201
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
202
|
-
LoaderProperties.PROMPT.value,
|
|
203
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
204
|
-
]
|
|
191
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
205
192
|
},
|
|
206
193
|
'.docx': {
|
|
207
194
|
'class': AlitaDocxMammothLoader,
|
|
@@ -211,58 +198,42 @@ document_loaders_map = {
|
|
|
211
198
|
'kwargs': {
|
|
212
199
|
'extract_images': True
|
|
213
200
|
},
|
|
214
|
-
'allowed_to_override':
|
|
215
|
-
'max_tokens', 'mode', LoaderProperties.LLM.value,
|
|
216
|
-
LoaderProperties.PROMPT.value,
|
|
217
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
218
|
-
]
|
|
201
|
+
'allowed_to_override': {**DEFAULT_ALLOWED_WITH_LLM, 'mode': 'paged'}
|
|
219
202
|
},
|
|
220
203
|
'.json': {
|
|
221
204
|
'class': AlitaJSONLoader,
|
|
222
205
|
'mime_type': 'application/json',
|
|
223
206
|
'is_multimodal_processing': False,
|
|
224
207
|
'kwargs': {},
|
|
225
|
-
'allowed_to_override':
|
|
208
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
226
209
|
},
|
|
227
210
|
'.jsonl': {
|
|
228
211
|
'class': AirbyteJSONLoader,
|
|
229
212
|
'mime_type': 'application/jsonl',
|
|
230
213
|
'is_multimodal_processing': False,
|
|
231
214
|
'kwargs': {},
|
|
232
|
-
'allowed_to_override':
|
|
215
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
233
216
|
},
|
|
234
217
|
'.htm': {
|
|
235
218
|
'class': UnstructuredHTMLLoader,
|
|
236
219
|
'mime_type': 'text/html',
|
|
237
220
|
'is_multimodal_processing': False,
|
|
238
221
|
'kwargs': {},
|
|
239
|
-
'allowed_to_override':
|
|
240
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
241
|
-
LoaderProperties.PROMPT.value,
|
|
242
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
243
|
-
]
|
|
222
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
244
223
|
},
|
|
245
224
|
'.html': {
|
|
246
225
|
'class': UnstructuredHTMLLoader,
|
|
247
226
|
'mime_type': 'text/html',
|
|
248
227
|
'is_multimodal_processing': False,
|
|
249
228
|
'kwargs': {},
|
|
250
|
-
'allowed_to_override':
|
|
251
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
252
|
-
LoaderProperties.PROMPT.value,
|
|
253
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
254
|
-
]
|
|
229
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
255
230
|
},
|
|
256
231
|
'.xml': {
|
|
257
232
|
'class': UnstructuredXMLLoader,
|
|
258
233
|
'mime_type': 'text/xml',
|
|
259
234
|
'is_multimodal_processing': False,
|
|
260
235
|
'kwargs': {},
|
|
261
|
-
'allowed_to_override':
|
|
262
|
-
'max_tokens', LoaderProperties.LLM.value,
|
|
263
|
-
LoaderProperties.PROMPT.value,
|
|
264
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
265
|
-
]
|
|
236
|
+
'allowed_to_override': DEFAULT_ALLOWED_WITH_LLM
|
|
266
237
|
},
|
|
267
238
|
'.ppt': {
|
|
268
239
|
'class': AlitaPowerPointLoader,
|
|
@@ -271,11 +242,7 @@ document_loaders_map = {
|
|
|
271
242
|
'kwargs': {
|
|
272
243
|
'mode': 'paged'
|
|
273
244
|
},
|
|
274
|
-
'allowed_to_override':
|
|
275
|
-
'max_tokens', 'mode', LoaderProperties.LLM.value,
|
|
276
|
-
LoaderProperties.PROMPT.value,
|
|
277
|
-
LoaderProperties.PROMPT_DEFAULT.value
|
|
278
|
-
]
|
|
245
|
+
'allowed_to_override': {**DEFAULT_ALLOWED_WITH_LLM, 'mode': 'paged'}
|
|
279
246
|
},
|
|
280
247
|
'.pptx': {
|
|
281
248
|
'class': AlitaPowerPointLoader,
|
|
@@ -285,20 +252,70 @@ document_loaders_map = {
|
|
|
285
252
|
'kwargs': {
|
|
286
253
|
'mode': 'paged'
|
|
287
254
|
},
|
|
288
|
-
'allowed_to_override':
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
255
|
+
'allowed_to_override': {
|
|
256
|
+
**DEFAULT_ALLOWED_WITH_LLM,
|
|
257
|
+
'mode': 'paged',
|
|
258
|
+
'pages_per_chunk': 5,
|
|
259
|
+
'extract_images': False,
|
|
260
|
+
}
|
|
293
261
|
},
|
|
294
|
-
'.py': {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
262
|
+
# '.py': {
|
|
263
|
+
# 'class': AlitaPythonLoader,
|
|
264
|
+
# 'mime_type': 'text/x-python',
|
|
265
|
+
# 'is_multimodal_processing': False,
|
|
266
|
+
# 'kwargs': {},
|
|
267
|
+
# 'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
268
|
+
# }
|
|
301
269
|
}
|
|
302
270
|
|
|
271
|
+
code_extensions = [
|
|
272
|
+
'.py', # Python
|
|
273
|
+
'.js', # JavaScript
|
|
274
|
+
'.ts', # TypeScript
|
|
275
|
+
'.java', # Java
|
|
276
|
+
'.cpp', # C++
|
|
277
|
+
'.c', # C
|
|
278
|
+
'.cs', # C#
|
|
279
|
+
'.rb', # Ruby
|
|
280
|
+
'.go', # Go
|
|
281
|
+
'.php', # PHP
|
|
282
|
+
'.swift', # Swift
|
|
283
|
+
'.kt', # Kotlin
|
|
284
|
+
'.rs', # Rust
|
|
285
|
+
'.m', # Objective-C
|
|
286
|
+
'.scala', # Scala
|
|
287
|
+
'.pl', # Perl
|
|
288
|
+
'.sh', # Shell
|
|
289
|
+
'.bat', # Batch
|
|
290
|
+
'.lua', # Lua
|
|
291
|
+
'.r', # R
|
|
292
|
+
'.pas', # Pascal
|
|
293
|
+
'.asm', # Assembly
|
|
294
|
+
'.dart', # Dart
|
|
295
|
+
'.groovy', # Groovy
|
|
296
|
+
'.sql', # SQL
|
|
297
|
+
]
|
|
298
|
+
|
|
299
|
+
default_loader_config = {
|
|
300
|
+
'class': AlitaTextLoader,
|
|
301
|
+
'mime_type': 'text/plain',
|
|
302
|
+
'is_multimodal_processing': False,
|
|
303
|
+
'kwargs': {},
|
|
304
|
+
'allowed_to_override': DEFAULT_ALLOWED_BASE
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
code_loaders_map = {ext: default_loader_config for ext in code_extensions}
|
|
308
|
+
|
|
303
309
|
# Combined mapping for backward compatibility
|
|
304
|
-
loaders_map = {
|
|
310
|
+
loaders_map = {
|
|
311
|
+
**image_loaders_map,
|
|
312
|
+
**image_loaders_map_converted,
|
|
313
|
+
**document_loaders_map,
|
|
314
|
+
**code_loaders_map
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
loaders_allowed_to_override = {
|
|
318
|
+
extension: config.get('allowed_to_override')
|
|
319
|
+
for extension, config in loaders_map.items()
|
|
320
|
+
if 'allowed_to_override' in config
|
|
321
|
+
}
|
|
@@ -173,7 +173,7 @@ def get_vectorstore(vectorstore_type, vectorstore_params, embedding_func=None):
|
|
|
173
173
|
#
|
|
174
174
|
raise RuntimeError(f"Unknown VectorStore type: {vectorstore_type}")
|
|
175
175
|
|
|
176
|
-
def add_documents(vectorstore, documents):
|
|
176
|
+
def add_documents(vectorstore, documents, ids = None) -> list[str]:
|
|
177
177
|
""" Add documents to vectorstore """
|
|
178
178
|
if vectorstore is None:
|
|
179
179
|
return None
|
|
@@ -189,7 +189,7 @@ def add_documents(vectorstore, documents):
|
|
|
189
189
|
if isinstance(document.metadata[key], dict):
|
|
190
190
|
document.metadata[key] = dumps(document.metadata[key])
|
|
191
191
|
metadata.append(document.metadata)
|
|
192
|
-
vectorstore.add_texts(texts, metadatas=metadata)
|
|
192
|
+
return vectorstore.add_texts(texts, metadatas=metadata, ids=ids)
|
|
193
193
|
|
|
194
194
|
|
|
195
195
|
def generateResponse(
|