alita-sdk 0.3.379__py3-none-any.whl → 0.3.627__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 +156 -0
- alita_sdk/cli/agent_loader.py +245 -0
- alita_sdk/cli/agent_ui.py +228 -0
- alita_sdk/cli/agents.py +3113 -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 +1073 -0
- alita_sdk/cli/mcp_loader.py +315 -0
- alita_sdk/cli/testcases/__init__.py +94 -0
- alita_sdk/cli/testcases/data_generation.py +119 -0
- alita_sdk/cli/testcases/discovery.py +96 -0
- alita_sdk/cli/testcases/executor.py +84 -0
- alita_sdk/cli/testcases/logger.py +85 -0
- alita_sdk/cli/testcases/parser.py +172 -0
- alita_sdk/cli/testcases/prompts.py +91 -0
- alita_sdk/cli/testcases/reporting.py +125 -0
- alita_sdk/cli/testcases/setup.py +108 -0
- alita_sdk/cli/testcases/test_runner.py +282 -0
- alita_sdk/cli/testcases/utils.py +39 -0
- alita_sdk/cli/testcases/validation.py +90 -0
- alita_sdk/cli/testcases/workflow.py +196 -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 +72 -12
- alita_sdk/community/inventory/__init__.py +236 -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/toolkit_utils.py +176 -0
- alita_sdk/community/inventory/visualize.py +1370 -0
- alita_sdk/configurations/__init__.py +1 -1
- alita_sdk/configurations/ado.py +141 -20
- alita_sdk/configurations/bitbucket.py +94 -2
- alita_sdk/configurations/confluence.py +130 -1
- alita_sdk/configurations/figma.py +76 -0
- alita_sdk/configurations/gitlab.py +91 -0
- alita_sdk/configurations/jira.py +103 -0
- alita_sdk/configurations/openapi.py +329 -0
- alita_sdk/configurations/qtest.py +72 -1
- alita_sdk/configurations/report_portal.py +96 -0
- alita_sdk/configurations/sharepoint.py +148 -0
- alita_sdk/configurations/testio.py +83 -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 +3 -3
- alita_sdk/runtime/clients/client.py +388 -46
- 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 +8 -21
- alita_sdk/runtime/langchain/_constants_bkup.py +1318 -0
- alita_sdk/runtime/langchain/assistant.py +157 -39
- alita_sdk/runtime/langchain/constants.py +647 -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/AlitaJSONLinesLoader.py +77 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py +10 -4
- alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +226 -7
- alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py +5 -2
- alita_sdk/runtime/langchain/document_loaders/constants.py +40 -19
- alita_sdk/runtime/langchain/langraph_agent.py +405 -84
- alita_sdk/runtime/langchain/utils.py +106 -7
- alita_sdk/runtime/llms/preloaded.py +2 -6
- alita_sdk/runtime/models/mcp_models.py +61 -0
- alita_sdk/runtime/skills/__init__.py +91 -0
- alita_sdk/runtime/skills/callbacks.py +498 -0
- alita_sdk/runtime/skills/discovery.py +540 -0
- alita_sdk/runtime/skills/executor.py +610 -0
- alita_sdk/runtime/skills/input_builder.py +371 -0
- alita_sdk/runtime/skills/models.py +330 -0
- alita_sdk/runtime/skills/registry.py +355 -0
- alita_sdk/runtime/skills/skill_runner.py +330 -0
- alita_sdk/runtime/toolkits/__init__.py +31 -0
- alita_sdk/runtime/toolkits/application.py +29 -10
- alita_sdk/runtime/toolkits/artifact.py +20 -11
- alita_sdk/runtime/toolkits/datasource.py +13 -6
- alita_sdk/runtime/toolkits/mcp.py +783 -0
- alita_sdk/runtime/toolkits/mcp_config.py +1048 -0
- alita_sdk/runtime/toolkits/planning.py +178 -0
- alita_sdk/runtime/toolkits/skill_router.py +238 -0
- alita_sdk/runtime/toolkits/subgraph.py +251 -6
- alita_sdk/runtime/toolkits/tools.py +356 -69
- alita_sdk/runtime/toolkits/vectorstore.py +11 -5
- alita_sdk/runtime/tools/__init__.py +10 -3
- alita_sdk/runtime/tools/application.py +27 -6
- alita_sdk/runtime/tools/artifact.py +511 -28
- alita_sdk/runtime/tools/data_analysis.py +183 -0
- alita_sdk/runtime/tools/function.py +67 -35
- alita_sdk/runtime/tools/graph.py +10 -4
- alita_sdk/runtime/tools/image_generation.py +148 -46
- alita_sdk/runtime/tools/llm.py +1003 -128
- alita_sdk/runtime/tools/loop.py +3 -1
- alita_sdk/runtime/tools/loop_output.py +3 -1
- 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 +8 -5
- 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 -4
- alita_sdk/runtime/tools/sandbox.py +65 -48
- alita_sdk/runtime/tools/skill_router.py +776 -0
- alita_sdk/runtime/tools/tool.py +3 -1
- alita_sdk/runtime/tools/vectorstore.py +9 -3
- alita_sdk/runtime/tools/vectorstore_base.py +70 -14
- alita_sdk/runtime/utils/AlitaCallback.py +137 -21
- alita_sdk/runtime/utils/constants.py +5 -1
- alita_sdk/runtime/utils/mcp_client.py +492 -0
- alita_sdk/runtime/utils/mcp_oauth.py +361 -0
- alita_sdk/runtime/utils/mcp_sse_client.py +434 -0
- alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
- alita_sdk/runtime/utils/serialization.py +155 -0
- alita_sdk/runtime/utils/streamlit.py +40 -13
- alita_sdk/runtime/utils/toolkit_utils.py +30 -9
- alita_sdk/runtime/utils/utils.py +36 -0
- alita_sdk/tools/__init__.py +134 -35
- alita_sdk/tools/ado/repos/__init__.py +51 -32
- alita_sdk/tools/ado/repos/repos_wrapper.py +148 -89
- alita_sdk/tools/ado/test_plan/__init__.py +25 -9
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +23 -1
- alita_sdk/tools/ado/utils.py +1 -18
- alita_sdk/tools/ado/wiki/__init__.py +25 -12
- alita_sdk/tools/ado/wiki/ado_wrapper.py +291 -22
- alita_sdk/tools/ado/work_item/__init__.py +26 -13
- alita_sdk/tools/ado/work_item/ado_wrapper.py +73 -11
- alita_sdk/tools/advanced_jira_mining/__init__.py +11 -8
- alita_sdk/tools/aws/delta_lake/__init__.py +13 -9
- alita_sdk/tools/aws/delta_lake/tool.py +5 -1
- alita_sdk/tools/azure_ai/search/__init__.py +11 -8
- alita_sdk/tools/azure_ai/search/api_wrapper.py +1 -1
- alita_sdk/tools/base/tool.py +5 -1
- alita_sdk/tools/base_indexer_toolkit.py +271 -84
- alita_sdk/tools/bitbucket/__init__.py +17 -11
- alita_sdk/tools/bitbucket/api_wrapper.py +59 -11
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py +49 -35
- alita_sdk/tools/browser/__init__.py +5 -4
- alita_sdk/tools/carrier/__init__.py +5 -6
- alita_sdk/tools/carrier/backend_reports_tool.py +6 -6
- alita_sdk/tools/carrier/run_ui_test_tool.py +6 -6
- alita_sdk/tools/carrier/ui_reports_tool.py +5 -5
- alita_sdk/tools/chunkers/__init__.py +3 -1
- alita_sdk/tools/chunkers/code/treesitter/treesitter.py +37 -13
- 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 +10 -7
- alita_sdk/tools/cloud/azure/__init__.py +10 -7
- alita_sdk/tools/cloud/gcp/__init__.py +10 -7
- alita_sdk/tools/cloud/k8s/__init__.py +10 -7
- alita_sdk/tools/code/linter/__init__.py +10 -8
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code/sonar/__init__.py +11 -8
- alita_sdk/tools/code_indexer_toolkit.py +82 -22
- alita_sdk/tools/confluence/__init__.py +22 -16
- alita_sdk/tools/confluence/api_wrapper.py +107 -30
- alita_sdk/tools/confluence/loader.py +14 -2
- alita_sdk/tools/custom_open_api/__init__.py +12 -5
- alita_sdk/tools/elastic/__init__.py +11 -8
- alita_sdk/tools/elitea_base.py +493 -30
- alita_sdk/tools/figma/__init__.py +58 -11
- alita_sdk/tools/figma/api_wrapper.py +1235 -143
- alita_sdk/tools/figma/figma_client.py +73 -0
- alita_sdk/tools/figma/toon_tools.py +2748 -0
- alita_sdk/tools/github/__init__.py +14 -15
- alita_sdk/tools/github/github_client.py +224 -100
- alita_sdk/tools/github/graphql_client_wrapper.py +119 -33
- alita_sdk/tools/github/schemas.py +14 -5
- alita_sdk/tools/github/tool.py +5 -1
- alita_sdk/tools/github/tool_prompts.py +9 -22
- alita_sdk/tools/gitlab/__init__.py +16 -11
- alita_sdk/tools/gitlab/api_wrapper.py +218 -48
- alita_sdk/tools/gitlab_org/__init__.py +10 -9
- alita_sdk/tools/gitlab_org/api_wrapper.py +63 -64
- alita_sdk/tools/google/bigquery/__init__.py +13 -12
- alita_sdk/tools/google/bigquery/tool.py +5 -1
- alita_sdk/tools/google_places/__init__.py +11 -8
- alita_sdk/tools/google_places/api_wrapper.py +1 -1
- alita_sdk/tools/jira/__init__.py +17 -10
- alita_sdk/tools/jira/api_wrapper.py +92 -41
- alita_sdk/tools/keycloak/__init__.py +11 -8
- alita_sdk/tools/localgit/__init__.py +9 -3
- alita_sdk/tools/localgit/local_git.py +62 -54
- alita_sdk/tools/localgit/tool.py +5 -1
- alita_sdk/tools/memory/__init__.py +12 -4
- alita_sdk/tools/non_code_indexer_toolkit.py +1 -0
- alita_sdk/tools/ocr/__init__.py +11 -8
- alita_sdk/tools/openapi/__init__.py +491 -106
- alita_sdk/tools/openapi/api_wrapper.py +1368 -0
- alita_sdk/tools/openapi/tool.py +20 -0
- alita_sdk/tools/pandas/__init__.py +20 -12
- alita_sdk/tools/pandas/api_wrapper.py +38 -25
- alita_sdk/tools/pandas/dataframe/generator/base.py +3 -1
- alita_sdk/tools/postman/__init__.py +10 -9
- alita_sdk/tools/pptx/__init__.py +11 -10
- alita_sdk/tools/pptx/pptx_wrapper.py +1 -1
- alita_sdk/tools/qtest/__init__.py +31 -11
- alita_sdk/tools/qtest/api_wrapper.py +2135 -86
- alita_sdk/tools/rally/__init__.py +10 -9
- alita_sdk/tools/rally/api_wrapper.py +1 -1
- alita_sdk/tools/report_portal/__init__.py +12 -8
- alita_sdk/tools/salesforce/__init__.py +10 -8
- alita_sdk/tools/servicenow/__init__.py +17 -15
- alita_sdk/tools/servicenow/api_wrapper.py +1 -1
- alita_sdk/tools/sharepoint/__init__.py +10 -7
- alita_sdk/tools/sharepoint/api_wrapper.py +129 -38
- alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
- alita_sdk/tools/sharepoint/utils.py +8 -2
- alita_sdk/tools/slack/__init__.py +10 -7
- alita_sdk/tools/slack/api_wrapper.py +2 -2
- alita_sdk/tools/sql/__init__.py +12 -9
- alita_sdk/tools/testio/__init__.py +10 -7
- alita_sdk/tools/testrail/__init__.py +11 -10
- alita_sdk/tools/testrail/api_wrapper.py +1 -1
- alita_sdk/tools/utils/__init__.py +9 -4
- alita_sdk/tools/utils/content_parser.py +103 -18
- alita_sdk/tools/utils/text_operations.py +410 -0
- alita_sdk/tools/utils/tool_prompts.py +79 -0
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +30 -13
- alita_sdk/tools/xray/__init__.py +13 -9
- alita_sdk/tools/yagmail/__init__.py +9 -3
- alita_sdk/tools/zephyr/__init__.py +10 -7
- alita_sdk/tools/zephyr_enterprise/__init__.py +11 -7
- alita_sdk/tools/zephyr_essential/__init__.py +10 -7
- alita_sdk/tools/zephyr_essential/api_wrapper.py +30 -13
- alita_sdk/tools/zephyr_essential/client.py +2 -2
- alita_sdk/tools/zephyr_scale/__init__.py +11 -8
- alita_sdk/tools/zephyr_scale/api_wrapper.py +2 -2
- alita_sdk/tools/zephyr_squad/__init__.py +10 -7
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/METADATA +154 -8
- alita_sdk-0.3.627.dist-info/RECORD +468 -0
- alita_sdk-0.3.627.dist-info/entry_points.txt +2 -0
- alita_sdk-0.3.379.dist-info/RECORD +0 -360
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/top_level.txt +0 -0
|
@@ -127,7 +127,29 @@ class AzureDevOpsApiWrapper(NonCodeIndexerToolkit):
|
|
|
127
127
|
cls._core_client = connection.clients_v7_1.get_core_client()
|
|
128
128
|
|
|
129
129
|
except Exception as e:
|
|
130
|
-
|
|
130
|
+
error_msg = str(e).lower()
|
|
131
|
+
if "expired" in error_msg or "token" in error_msg and ("invalid" in error_msg or "unauthorized" in error_msg):
|
|
132
|
+
raise ValueError(
|
|
133
|
+
"Azure DevOps connection failed: Your access token has expired or is invalid. "
|
|
134
|
+
"Please refresh your token in the toolkit configuration."
|
|
135
|
+
)
|
|
136
|
+
elif "401" in error_msg or "unauthorized" in error_msg:
|
|
137
|
+
raise ValueError(
|
|
138
|
+
"Azure DevOps connection failed: Authentication failed. "
|
|
139
|
+
"Please check your credentials in the toolkit configuration."
|
|
140
|
+
)
|
|
141
|
+
elif "404" in error_msg or "not found" in error_msg:
|
|
142
|
+
raise ValueError(
|
|
143
|
+
"Azure DevOps connection failed: Organization or project not found. "
|
|
144
|
+
"Please verify your organization URL and project name."
|
|
145
|
+
)
|
|
146
|
+
elif "timeout" in error_msg or "timed out" in error_msg:
|
|
147
|
+
raise ValueError(
|
|
148
|
+
"Azure DevOps connection failed: Connection timed out. "
|
|
149
|
+
"Please check your network connection and try again."
|
|
150
|
+
)
|
|
151
|
+
else:
|
|
152
|
+
raise ValueError(f"Azure DevOps connection failed: {e}")
|
|
131
153
|
|
|
132
154
|
return super().validate_toolkit(values)
|
|
133
155
|
|
|
@@ -329,11 +351,14 @@ class AzureDevOpsApiWrapper(NonCodeIndexerToolkit):
|
|
|
329
351
|
parsed_item.update(fields_data)
|
|
330
352
|
|
|
331
353
|
# extract relations if any
|
|
332
|
-
relations_data =
|
|
354
|
+
relations_data = None
|
|
355
|
+
if expand and str(expand).lower() in ("relations", "all"):
|
|
356
|
+
try:
|
|
357
|
+
relations_data = getattr(work_item, 'relations', None)
|
|
358
|
+
except KeyError:
|
|
359
|
+
relations_data = None
|
|
333
360
|
if relations_data:
|
|
334
|
-
parsed_item['relations'] = []
|
|
335
|
-
for relation in relations_data:
|
|
336
|
-
parsed_item['relations'].append(relation.as_dict())
|
|
361
|
+
parsed_item['relations'] = [relation.as_dict() for relation in relations_data]
|
|
337
362
|
|
|
338
363
|
if parse_attachments:
|
|
339
364
|
# describe images in work item fields if present
|
|
@@ -344,13 +369,19 @@ class AzureDevOpsApiWrapper(NonCodeIndexerToolkit):
|
|
|
344
369
|
for img in images:
|
|
345
370
|
src = img.get('src')
|
|
346
371
|
if src:
|
|
347
|
-
description = self.parse_attachment_by_url(src, image_description_prompt)
|
|
372
|
+
description = self.parse_attachment_by_url(src, image_description_prompt=image_description_prompt)
|
|
348
373
|
img['image-description'] = description
|
|
349
374
|
parsed_item[field_name] = str(soup)
|
|
350
375
|
# parse attached documents if present
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
376
|
+
for relation in parsed_item.get('relations', []):
|
|
377
|
+
# Only process actual file attachments
|
|
378
|
+
if relation.get('rel') == 'AttachedFile':
|
|
379
|
+
file_name = relation.get('attributes', {}).get('name')
|
|
380
|
+
if file_name:
|
|
381
|
+
try:
|
|
382
|
+
relation['content'] = self.parse_attachment_by_url(relation['url'], file_name, image_description_prompt=image_description_prompt)
|
|
383
|
+
except Exception as att_e:
|
|
384
|
+
logger.warning(f"Failed to parse attachment {file_name}: {att_e}")
|
|
354
385
|
|
|
355
386
|
|
|
356
387
|
return parsed_item
|
|
@@ -567,9 +598,40 @@ class AzureDevOpsApiWrapper(NonCodeIndexerToolkit):
|
|
|
567
598
|
return b"".join(content_generator)
|
|
568
599
|
|
|
569
600
|
def _process_document(self, document: Document) -> Generator[Document, None, None]:
|
|
570
|
-
|
|
601
|
+
raw_attachment_ids = document.metadata.get('attachment_ids', {})
|
|
602
|
+
|
|
603
|
+
# Normalize attachment_ids: accept dict or JSON string, raise otherwise
|
|
604
|
+
if isinstance(raw_attachment_ids, str):
|
|
605
|
+
try:
|
|
606
|
+
loaded = json.loads(raw_attachment_ids)
|
|
607
|
+
except json.JSONDecodeError:
|
|
608
|
+
raise TypeError(
|
|
609
|
+
f"Expected dict or JSON string for 'attachment_ids', got non-JSON string for id="
|
|
610
|
+
f"{document.metadata.get('id')}: {raw_attachment_ids!r}"
|
|
611
|
+
)
|
|
612
|
+
if not isinstance(loaded, dict):
|
|
613
|
+
raise TypeError(
|
|
614
|
+
f"'attachment_ids' JSON did not decode to dict for id={document.metadata.get('id')}: {loaded!r}"
|
|
615
|
+
)
|
|
616
|
+
attachment_ids = loaded
|
|
617
|
+
elif isinstance(raw_attachment_ids, dict):
|
|
618
|
+
attachment_ids = raw_attachment_ids
|
|
619
|
+
else:
|
|
620
|
+
raise TypeError(
|
|
621
|
+
f"Expected 'attachment_ids' to be dict or JSON string, got {type(raw_attachment_ids)} "
|
|
622
|
+
f"for id={document.metadata.get('id')}: {raw_attachment_ids!r}"
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
for attachment_id, file_name in attachment_ids.items():
|
|
571
626
|
content = self.get_attachment_content(attachment_id=attachment_id)
|
|
572
|
-
yield Document(
|
|
627
|
+
yield Document(
|
|
628
|
+
page_content="",
|
|
629
|
+
metadata={
|
|
630
|
+
'id': attachment_id,
|
|
631
|
+
IndexerKeywords.CONTENT_FILE_NAME.value: file_name,
|
|
632
|
+
IndexerKeywords.CONTENT_IN_BYTES.value: content,
|
|
633
|
+
},
|
|
634
|
+
)
|
|
573
635
|
|
|
574
636
|
def _index_tool_params(self):
|
|
575
637
|
"""Return the parameters for indexing data."""
|
|
@@ -6,7 +6,8 @@ from pydantic import create_model, BaseModel, Field, SecretStr
|
|
|
6
6
|
from .data_mining_wrapper import AdvancedJiraMiningWrapper
|
|
7
7
|
from ..base.tool import BaseAction
|
|
8
8
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
9
|
-
from ..utils import clean_string,
|
|
9
|
+
from ..utils import clean_string, get_max_toolkit_length
|
|
10
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
10
11
|
|
|
11
12
|
name = "advanced_jira_mining"
|
|
12
13
|
|
|
@@ -28,15 +29,13 @@ def get_tools(tool):
|
|
|
28
29
|
|
|
29
30
|
class AdvancedJiraMiningToolkit(BaseToolkit):
|
|
30
31
|
tools: List[BaseTool] = []
|
|
31
|
-
toolkit_max_length: int = 0
|
|
32
32
|
|
|
33
33
|
@staticmethod
|
|
34
34
|
def toolkit_config_schema() -> BaseModel:
|
|
35
35
|
selected_tools = {x['name']: x['args_schema'].schema() for x in AdvancedJiraMiningWrapper.model_construct().get_available_tools()}
|
|
36
|
-
AdvancedJiraMiningToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
37
36
|
return create_model(
|
|
38
37
|
name,
|
|
39
|
-
jira_base_url=(str, Field(default="", title="Jira URL", description="Jira URL", json_schema_extra={'toolkit_name': True
|
|
38
|
+
jira_base_url=(str, Field(default="", title="Jira URL", description="Jira URL", json_schema_extra={'toolkit_name': True})),
|
|
40
39
|
confluence_base_url=(str, Field(default="", title="Confluence URL", description="Confluence URL")),
|
|
41
40
|
model_type=(str, Field(default="", title="Model type", description="Model type")),
|
|
42
41
|
summarization_prompt=(Optional[str], Field(default=None, title="Summarization prompt", description="Summarization prompt")),
|
|
@@ -66,17 +65,21 @@ class AdvancedJiraMiningToolkit(BaseToolkit):
|
|
|
66
65
|
selected_tools = []
|
|
67
66
|
jira_mining_wrapper = AdvancedJiraMiningWrapper(**kwargs)
|
|
68
67
|
available_tools = jira_mining_wrapper.get_available_tools()
|
|
69
|
-
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
|
70
68
|
tools = []
|
|
71
69
|
for tool in available_tools:
|
|
72
70
|
if selected_tools:
|
|
73
71
|
if tool["name"] not in selected_tools:
|
|
74
72
|
continue
|
|
73
|
+
description = tool["description"]
|
|
74
|
+
if toolkit_name:
|
|
75
|
+
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
76
|
+
description = description[:1000]
|
|
75
77
|
tools.append(BaseAction(
|
|
76
78
|
api_wrapper=jira_mining_wrapper,
|
|
77
|
-
name=
|
|
78
|
-
description=
|
|
79
|
-
args_schema=tool["args_schema"]
|
|
79
|
+
name=tool["name"],
|
|
80
|
+
description=description,
|
|
81
|
+
args_schema=tool["args_schema"],
|
|
82
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
80
83
|
))
|
|
81
84
|
return cls(tools=tools)
|
|
82
85
|
|
|
@@ -6,9 +6,10 @@ from langchain_core.tools import BaseTool, BaseToolkit
|
|
|
6
6
|
from pydantic import BaseModel, Field, computed_field, field_validator
|
|
7
7
|
|
|
8
8
|
from alita_sdk.configurations.delta_lake import DeltaLakeConfiguration
|
|
9
|
-
from ...utils import
|
|
9
|
+
from ...utils import clean_string, get_max_toolkit_length
|
|
10
10
|
from .api_wrapper import DeltaLakeApiWrapper
|
|
11
11
|
from .tool import DeltaLakeAction
|
|
12
|
+
from ....runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
name = "delta_lake"
|
|
14
15
|
|
|
@@ -21,10 +22,6 @@ def get_available_tools() -> dict[str, dict]:
|
|
|
21
22
|
}
|
|
22
23
|
return available_tools
|
|
23
24
|
|
|
24
|
-
toolkit_max_length = lru_cache(maxsize=1)(
|
|
25
|
-
lambda: get_max_toolkit_length(get_available_tools())
|
|
26
|
-
)
|
|
27
|
-
|
|
28
25
|
class DeltaLakeToolkitConfig(BaseModel):
|
|
29
26
|
class Config:
|
|
30
27
|
title = name
|
|
@@ -87,9 +84,10 @@ class DeltaLakeToolkit(BaseToolkit):
|
|
|
87
84
|
|
|
88
85
|
@computed_field
|
|
89
86
|
@property
|
|
90
|
-
def
|
|
87
|
+
def toolkit_context(self) -> str:
|
|
88
|
+
"""Returns toolkit context for descriptions (max 1000 chars)."""
|
|
91
89
|
return (
|
|
92
|
-
clean_string(self.toolkit_name,
|
|
90
|
+
f" [Toolkit: {clean_string(self.toolkit_name, 0)}]"
|
|
93
91
|
if self.toolkit_name
|
|
94
92
|
else ""
|
|
95
93
|
)
|
|
@@ -118,12 +116,18 @@ class DeltaLakeToolkit(BaseToolkit):
|
|
|
118
116
|
selected_tools = set(selected_tools)
|
|
119
117
|
for t in instance.available_tools:
|
|
120
118
|
if t["name"] in selected_tools:
|
|
119
|
+
description = t["description"]
|
|
120
|
+
if toolkit_name:
|
|
121
|
+
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
122
|
+
description = f"S3 Path: {getattr(instance.api_wrapper, 's3_path', '')} Table Path: {getattr(instance.api_wrapper, 'table_path', '')}\n{description}"
|
|
123
|
+
description = description[:1000]
|
|
121
124
|
instance.tools.append(
|
|
122
125
|
DeltaLakeAction(
|
|
123
126
|
api_wrapper=instance.api_wrapper,
|
|
124
|
-
name=
|
|
125
|
-
description=
|
|
127
|
+
name=t["name"],
|
|
128
|
+
description=description,
|
|
126
129
|
args_schema=t["args_schema"],
|
|
130
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: t["name"]} if toolkit_name else {TOOL_NAME_META: t["name"]}
|
|
127
131
|
)
|
|
128
132
|
)
|
|
129
133
|
return instance
|
|
@@ -29,7 +29,11 @@ class DeltaLakeAction(BaseTool):
|
|
|
29
29
|
) -> str:
|
|
30
30
|
"""Use the Delta Lake API to run an operation."""
|
|
31
31
|
try:
|
|
32
|
+
# Strip numeric suffix added for deduplication (_2, _3, etc.)
|
|
33
|
+
# to get the original tool name that exists in the wrapper
|
|
34
|
+
import re
|
|
35
|
+
tool_name = re.sub(r'_\d+$', '', self.name)
|
|
32
36
|
# Use the tool name to dispatch to the correct API wrapper method
|
|
33
|
-
return self.api_wrapper.run(
|
|
37
|
+
return self.api_wrapper.run(tool_name, *args, **kwargs)
|
|
34
38
|
except Exception as e:
|
|
35
39
|
return f"Error: {format_exc()}"
|
|
@@ -6,9 +6,10 @@ from langchain_core.tools import BaseToolkit, BaseTool
|
|
|
6
6
|
from pydantic import create_model, BaseModel, ConfigDict, Field
|
|
7
7
|
|
|
8
8
|
from ...elitea_base import filter_missconfigured_index_tools
|
|
9
|
-
from ...utils import clean_string,
|
|
9
|
+
from ...utils import clean_string, get_max_toolkit_length, check_connection_response
|
|
10
10
|
from ....configurations.azure_search import AzureSearchConfiguration
|
|
11
11
|
import requests
|
|
12
|
+
from ....runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
logger = getLogger(__name__)
|
|
14
15
|
|
|
@@ -31,12 +32,10 @@ def get_toolkit():
|
|
|
31
32
|
|
|
32
33
|
class AzureSearchToolkit(BaseToolkit):
|
|
33
34
|
tools: List[BaseTool] = []
|
|
34
|
-
toolkit_max_length: int = 0
|
|
35
35
|
|
|
36
36
|
@staticmethod
|
|
37
37
|
def toolkit_config_schema() -> BaseModel:
|
|
38
38
|
selected_tools = {x['name']: x['args_schema'].schema() for x in AzureSearchApiWrapper.model_construct().get_available_tools()}
|
|
39
|
-
AzureSearchToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
40
39
|
m = create_model(
|
|
41
40
|
name,
|
|
42
41
|
index_name=(str, Field(description="Azure Search index name")),
|
|
@@ -46,7 +45,7 @@ class AzureSearchToolkit(BaseToolkit):
|
|
|
46
45
|
),
|
|
47
46
|
api_version=(Optional[str], Field(description="API version", default=None)),
|
|
48
47
|
openai_api_key=(Optional[str], Field(description="Azure OpenAI API Key", default=None, json_schema_extra={'secret': True})),
|
|
49
|
-
model_name=(str, Field(description="Model name for Embeddings model", default=None)),
|
|
48
|
+
model_name=(Optional[str], Field(description="Model name for Embeddings model", default=None)),
|
|
50
49
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
|
51
50
|
__config__=ConfigDict(json_schema_extra={
|
|
52
51
|
'metadata': {
|
|
@@ -79,17 +78,21 @@ class AzureSearchToolkit(BaseToolkit):
|
|
|
79
78
|
}
|
|
80
79
|
azure_search_api_wrapper = AzureSearchApiWrapper(**wrapper_payload)
|
|
81
80
|
available_tools = azure_search_api_wrapper.get_available_tools()
|
|
82
|
-
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
|
83
81
|
tools = []
|
|
84
82
|
for tool in available_tools:
|
|
85
83
|
if selected_tools:
|
|
86
84
|
if tool["name"] not in selected_tools:
|
|
87
85
|
continue
|
|
86
|
+
description = tool["description"]
|
|
87
|
+
if toolkit_name:
|
|
88
|
+
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
89
|
+
description = description[:1000]
|
|
88
90
|
tools.append(BaseAction(
|
|
89
91
|
api_wrapper=azure_search_api_wrapper,
|
|
90
|
-
name=
|
|
91
|
-
description=
|
|
92
|
-
args_schema=tool["args_schema"]
|
|
92
|
+
name=tool["name"],
|
|
93
|
+
description=description,
|
|
94
|
+
args_schema=tool["args_schema"],
|
|
95
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
93
96
|
))
|
|
94
97
|
return cls(tools=tools)
|
|
95
98
|
|
|
@@ -11,7 +11,7 @@ logger = logging.getLogger(__name__)
|
|
|
11
11
|
|
|
12
12
|
class AzureSearchInput(BaseModel):
|
|
13
13
|
search_text: str = Field(..., description="The text to search for in the Azure Search index.")
|
|
14
|
-
limit: int = Field(10, description="The number of results to return.")
|
|
14
|
+
limit: int = Field(10, description="The number of results to return.", gt=0)
|
|
15
15
|
selected_fields: Optional[List[str]] = Field(None, description="The fields to retrieve from the document.")
|
|
16
16
|
|
|
17
17
|
class AzureDocumentInput(BaseModel):
|
alita_sdk/tools/base/tool.py
CHANGED
|
@@ -23,6 +23,10 @@ class BaseAction(BaseTool):
|
|
|
23
23
|
) -> ToolException | str:
|
|
24
24
|
"""Use the Confluence API to run an operation."""
|
|
25
25
|
try:
|
|
26
|
-
|
|
26
|
+
# Strip numeric suffix added for deduplication (_2, _3, etc.)
|
|
27
|
+
# to get the original tool name that exists in the wrapper
|
|
28
|
+
import re
|
|
29
|
+
tool_name = re.sub(r'_\d+$', '', self.name)
|
|
30
|
+
return self.api_wrapper.run(tool_name, *args, **kwargs)
|
|
27
31
|
except Exception as e:
|
|
28
32
|
return ToolException(f"An exception occurred: {e}")
|