alita-sdk 0.3.228__py3-none-any.whl → 0.3.230__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/configurations/__init__.py +66 -0
- alita_sdk/configurations/ado.py +41 -0
- alita_sdk/configurations/azure_search.py +21 -0
- alita_sdk/configurations/bigquery.py +23 -0
- alita_sdk/configurations/bitbucket.py +31 -0
- alita_sdk/configurations/confluence.py +36 -0
- alita_sdk/configurations/delta_lake.py +24 -0
- alita_sdk/configurations/github.py +45 -0
- alita_sdk/configurations/gitlab.py +31 -0
- alita_sdk/configurations/jira.py +36 -0
- alita_sdk/configurations/pgvector.py +18 -0
- alita_sdk/configurations/postman.py +30 -0
- alita_sdk/configurations/qtest.py +20 -0
- alita_sdk/configurations/service_now.py +31 -0
- alita_sdk/configurations/slack.py +35 -0
- alita_sdk/configurations/testrail.py +20 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaDocLoader.py +29 -0
- alita_sdk/runtime/langchain/document_loaders/constants.py +6 -0
- alita_sdk/runtime/langchain/document_loaders/utils.py +22 -1
- alita_sdk/runtime/toolkits/configurations.py +4 -0
- alita_sdk/tools/ado/__init__.py +2 -3
- alita_sdk/tools/ado/repos/__init__.py +26 -33
- alita_sdk/tools/ado/repos/repos_wrapper.py +1 -0
- alita_sdk/tools/ado/test_plan/__init__.py +17 -15
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +1 -0
- alita_sdk/tools/ado/wiki/__init__.py +18 -20
- alita_sdk/tools/ado/wiki/ado_wrapper.py +1 -0
- alita_sdk/tools/ado/work_item/__init__.py +18 -19
- alita_sdk/tools/ado/work_item/ado_wrapper.py +1 -0
- alita_sdk/tools/aws/delta_lake/__init__.py +9 -13
- alita_sdk/tools/azure_ai/search/__init__.py +13 -16
- alita_sdk/tools/bitbucket/__init__.py +14 -12
- alita_sdk/tools/confluence/__init__.py +25 -21
- alita_sdk/tools/figma/__init__.py +8 -5
- alita_sdk/tools/figma/api_wrapper.py +37 -12
- alita_sdk/tools/github/__init__.py +22 -46
- alita_sdk/tools/gitlab/__init__.py +14 -9
- alita_sdk/tools/google/bigquery/__init__.py +11 -27
- alita_sdk/tools/jira/__init__.py +23 -19
- alita_sdk/tools/postman/__init__.py +11 -6
- alita_sdk/tools/qtest/__init__.py +9 -3
- alita_sdk/tools/servicenow/__init__.py +12 -6
- alita_sdk/tools/sharepoint/__init__.py +8 -5
- alita_sdk/tools/slack/__init__.py +12 -9
- alita_sdk/tools/testrail/__init__.py +14 -12
- alita_sdk/tools/utils/content_parser.py +16 -26
- {alita_sdk-0.3.228.dist-info → alita_sdk-0.3.230.dist-info}/METADATA +2 -2
- {alita_sdk-0.3.228.dist-info → alita_sdk-0.3.230.dist-info}/RECORD +51 -33
- {alita_sdk-0.3.228.dist-info → alita_sdk-0.3.230.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.228.dist-info → alita_sdk-0.3.230.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.228.dist-info → alita_sdk-0.3.230.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,12 @@
|
|
1
1
|
from typing import List, Literal, Optional
|
2
2
|
|
3
3
|
from langchain_core.tools import BaseTool, BaseToolkit
|
4
|
-
from pydantic import BaseModel, Field, create_model
|
4
|
+
from pydantic import BaseModel, Field, create_model
|
5
5
|
|
6
6
|
import requests
|
7
|
+
|
8
|
+
from ....configurations.ado import AdoReposConfiguration
|
9
|
+
from ....configurations.pgvector import PgVectorConfiguration
|
7
10
|
from ...base.tool import BaseAction
|
8
11
|
from .repos_wrapper import ReposApiWrapper
|
9
12
|
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
@@ -14,15 +17,12 @@ name = "ado_repos"
|
|
14
17
|
def _get_toolkit(tool) -> BaseToolkit:
|
15
18
|
return AzureDevOpsReposToolkit().get_toolkit(
|
16
19
|
selected_tools=tool['settings'].get('selected_tools', []),
|
17
|
-
|
18
|
-
project=tool['settings'].get('project', ""),
|
19
|
-
token=tool['settings'].get('token', ""),
|
20
|
+
ado_repos_configuration=tool['settings']['ado_repos_configuration'],
|
20
21
|
limit=tool['settings'].get('limit', 5),
|
21
|
-
repository_id=tool['settings'].get('repository_id', ""),
|
22
22
|
base_branch=tool['settings'].get('base_branch', ""),
|
23
23
|
active_branch=tool['settings'].get('active_branch', ""),
|
24
24
|
toolkit_name=tool['settings'].get('toolkit_name', ""),
|
25
|
-
|
25
|
+
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
26
26
|
collection_name=tool['toolkit_name'],
|
27
27
|
doctype='code',
|
28
28
|
embedding_model="HuggingFaceEmbeddings",
|
@@ -46,33 +46,20 @@ class AzureDevOpsReposToolkit(BaseToolkit):
|
|
46
46
|
AzureDevOpsReposToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
47
47
|
m = create_model(
|
48
48
|
name,
|
49
|
-
|
50
|
-
|
51
|
-
json_schema_extra={
|
52
|
-
'configuration': True,
|
53
|
-
"configuration_title": True
|
54
|
-
})),
|
55
|
-
project=(str, Field(title="Project", description="ADO project", json_schema_extra={'configuration': True})),
|
56
|
-
repository_id=(str, Field(title="Repository ID", description="ADO repository ID",
|
57
|
-
json_schema_extra={
|
58
|
-
'max_toolkit_length': AzureDevOpsReposToolkit.toolkit_max_length,
|
59
|
-
'configuration': True})),
|
60
|
-
token=(SecretStr, Field(title="Token", description="ADO token", json_schema_extra={'secret': True, 'configuration': True})),
|
49
|
+
ado_repos_configuration=(AdoReposConfiguration, Field(description="Ado Repos configuration", default=None,
|
50
|
+
json_schema_extra={'configuration_types': ['ado_repos']})),
|
61
51
|
base_branch=(Optional[str], Field(default="", title="Base branch", description="ADO base branch (e.g., main)")),
|
62
52
|
active_branch=(Optional[str], Field(default="", title="Active branch", description="ADO active branch (e.g., main)")),
|
63
53
|
|
64
54
|
# indexer settings
|
65
|
-
|
66
|
-
default=None,
|
67
|
-
json_schema_extra={'secret': True})),
|
68
|
-
|
55
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(description="PgVector Configuration", json_schema_extra={'configuration_types': ['pgvector']})),
|
69
56
|
# embedder settings
|
70
57
|
embedding_model=(str, Field(description="Embedding model: i.e. 'HuggingFaceEmbeddings', etc.",
|
71
|
-
|
58
|
+
default="HuggingFaceEmbeddings")),
|
72
59
|
embedding_model_params=(dict, Field(
|
73
|
-
|
74
|
-
|
75
|
-
|
60
|
+
description="Embedding model parameters: i.e. `{'model_name': 'sentence-transformers/all-MiniLM-L6-v2'}",
|
61
|
+
default={"model_name": "sentence-transformers/all-MiniLM-L6-v2"})),
|
62
|
+
|
76
63
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
77
64
|
__config__={'json_schema_extra': {'metadata':
|
78
65
|
{
|
@@ -91,11 +78,11 @@ class AzureDevOpsReposToolkit(BaseToolkit):
|
|
91
78
|
},
|
92
79
|
"categories": ["code repositories"],
|
93
80
|
"extra_categories": ["code", "repository", "version control"],
|
94
|
-
"configuration_group": {
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
81
|
+
# "configuration_group": {
|
82
|
+
# "name": "ado_repos",
|
83
|
+
# "label": "Azure DevOps Repositories",
|
84
|
+
# "icon_url": "ado-repos-icon.svg",
|
85
|
+
# }
|
99
86
|
}}}
|
100
87
|
)
|
101
88
|
|
@@ -119,8 +106,14 @@ class AzureDevOpsReposToolkit(BaseToolkit):
|
|
119
106
|
environ["AZURE_DEVOPS_CACHE_DIR"] = "/tmp/.azure-devops"
|
120
107
|
if selected_tools is None:
|
121
108
|
selected_tools = []
|
122
|
-
|
123
|
-
|
109
|
+
|
110
|
+
wrapper_payload = {
|
111
|
+
**kwargs,
|
112
|
+
# TODO use ado_repos_configuration fields
|
113
|
+
**kwargs['ado_repos_configuration'],
|
114
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
115
|
+
}
|
116
|
+
azure_devops_repos_wrapper = ReposApiWrapper(**wrapper_payload)
|
124
117
|
available_tools = azure_devops_repos_wrapper.get_available_tools()
|
125
118
|
tools = []
|
126
119
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
@@ -1,9 +1,11 @@
|
|
1
1
|
from typing import List, Optional, Literal
|
2
2
|
|
3
3
|
from langchain_core.tools import BaseTool, BaseToolkit
|
4
|
-
from pydantic import create_model, BaseModel, Field
|
4
|
+
from pydantic import create_model, BaseModel, Field
|
5
5
|
|
6
6
|
import requests
|
7
|
+
from ....configurations.ado import AdoConfiguration
|
8
|
+
from ....configurations.pgvector import PgVectorConfiguration
|
7
9
|
from .test_plan_wrapper import TestPlanApiWrapper
|
8
10
|
from ...base.tool import BaseAction
|
9
11
|
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
@@ -24,19 +26,10 @@ class AzureDevOpsPlansToolkit(BaseToolkit):
|
|
24
26
|
m = create_model(
|
25
27
|
name_alias,
|
26
28
|
name=(str, Field(description="Toolkit name", json_schema_extra={'toolkit_name': True, 'max_toolkit_length': AzureDevOpsPlansToolkit.toolkit_max_length})),
|
27
|
-
|
28
|
-
description="ADO organization url",
|
29
|
-
json_schema_extra={
|
30
|
-
'configuration': True,
|
31
|
-
'configuration_title': True
|
32
|
-
})),
|
33
|
-
project=(str, Field(title="Project", description="ADO project", json_schema_extra={'configuration': True})),
|
29
|
+
ado_configuration=(AdoConfiguration, Field(description="Ado configuration", json_schema_extra={'configuration_types': ['ado']})),
|
34
30
|
limit=(Optional[int], Field(description="ADO plans limit used for limitation of the list with results", default=5)),
|
35
|
-
token=(SecretStr, Field(description="ADO token", json_schema_extra={'secret': True, 'configuration': True})),
|
36
31
|
# indexer settings
|
37
|
-
|
38
|
-
default=None,
|
39
|
-
json_schema_extra={'secret': True})),
|
32
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(description="PgVector Configuration", json_schema_extra={'configuration_types': ['pgvector']})),
|
40
33
|
# embedder settings
|
41
34
|
embedding_model=(str, Field(description="Embedding model: i.e. 'HuggingFaceEmbeddings', etc.",
|
42
35
|
default="HuggingFaceEmbeddings")),
|
@@ -75,9 +68,12 @@ class AzureDevOpsPlansToolkit(BaseToolkit):
|
|
75
68
|
|
76
69
|
@check_connection_response
|
77
70
|
def check_connection(self):
|
71
|
+
ado_config = self.ado_test_plan_configuration.ado_configuration if self.ado_test_plan_configuration else None
|
72
|
+
if not ado_config:
|
73
|
+
raise ValueError("ADO test plan configuration is required")
|
78
74
|
response = requests.get(
|
79
|
-
f'{
|
80
|
-
headers = {'Authorization': f'Bearer {
|
75
|
+
f'{ado_config.organization_url}/{ado_config.project}/_apis/testplan/plans?api-version=7.0',
|
76
|
+
headers = {'Authorization': f'Bearer {ado_config.token}'},
|
81
77
|
timeout=5
|
82
78
|
)
|
83
79
|
return response
|
@@ -92,7 +88,13 @@ class AzureDevOpsPlansToolkit(BaseToolkit):
|
|
92
88
|
environ['AZURE_DEVOPS_CACHE_DIR'] = '/tmp/.azure-devops'
|
93
89
|
if selected_tools is None:
|
94
90
|
selected_tools = []
|
95
|
-
|
91
|
+
wrapper_payload = {
|
92
|
+
**kwargs,
|
93
|
+
# TODO use ado_configuration fields in TestPlanApiWrapper
|
94
|
+
**kwargs['ado_configuration'],
|
95
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
96
|
+
}
|
97
|
+
azure_devops_api_wrapper = TestPlanApiWrapper(**wrapper_payload)
|
96
98
|
available_tools = azure_devops_api_wrapper.get_available_tools()
|
97
99
|
tools = []
|
98
100
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
@@ -1,9 +1,11 @@
|
|
1
1
|
from typing import List, Literal, Optional
|
2
2
|
from .ado_wrapper import AzureDevOpsApiWrapper # Import the API wrapper for Azure DevOps
|
3
3
|
from langchain_core.tools import BaseTool, BaseToolkit
|
4
|
-
from pydantic import create_model, BaseModel, Field
|
4
|
+
from pydantic import create_model, BaseModel, Field
|
5
5
|
|
6
6
|
import requests
|
7
|
+
from ....configurations.ado import AdoConfiguration
|
8
|
+
from ....configurations.pgvector import PgVectorConfiguration
|
7
9
|
from ...base.tool import BaseAction
|
8
10
|
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
9
11
|
|
@@ -25,22 +27,9 @@ class AzureDevOpsWikiToolkit(BaseToolkit):
|
|
25
27
|
'toolkit_name': True,
|
26
28
|
'max_toolkit_length': AzureDevOpsWikiToolkit.toolkit_max_length})
|
27
29
|
),
|
28
|
-
|
29
|
-
description="ADO organization url", json_schema_extra={
|
30
|
-
'configuration': True,
|
31
|
-
})),
|
32
|
-
project=(str, Field(description="ADO project",
|
33
|
-
json_schema_extra={
|
34
|
-
'configuration': True
|
35
|
-
})),
|
36
|
-
token=(SecretStr,
|
37
|
-
Field(description="ADO token",
|
38
|
-
json_schema_extra={'secret': True, 'configuration': True }
|
39
|
-
)),
|
30
|
+
ado_configuration=(AdoConfiguration, Field(description="Ado configuration", json_schema_extra={'configuration_types': ['ado']})),
|
40
31
|
# indexer settings
|
41
|
-
|
42
|
-
default=None,
|
43
|
-
json_schema_extra={'secret': True})),
|
32
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(description="PgVector Configuration", json_schema_extra={'configuration_types': ['pgvector']})),
|
44
33
|
# embedder settings
|
45
34
|
embedding_model=(str, Field(description="Embedding model: i.e. 'HuggingFaceEmbeddings', etc.",
|
46
35
|
default="HuggingFaceEmbeddings")),
|
@@ -53,7 +42,7 @@ class AzureDevOpsWikiToolkit(BaseToolkit):
|
|
53
42
|
'json_schema_extra': {
|
54
43
|
'metadata': {
|
55
44
|
"label": "ADO wiki",
|
56
|
-
"icon_url":
|
45
|
+
"icon_url": "ado-wiki-icon.svg",
|
57
46
|
"categories": ["documentation"],
|
58
47
|
"extra_categories": ["knowledge base", "documentation management", "wiki"],
|
59
48
|
"sections": {
|
@@ -77,9 +66,12 @@ class AzureDevOpsWikiToolkit(BaseToolkit):
|
|
77
66
|
|
78
67
|
@check_connection_response
|
79
68
|
def check_connection(self):
|
69
|
+
ado_config = self.ado_wiki_configuration.ado_configuration if self.ado_wiki_configuration else None
|
70
|
+
if not ado_config:
|
71
|
+
raise ValueError("ADO wiki configuration is required")
|
80
72
|
response = requests.get(
|
81
|
-
f'{
|
82
|
-
headers={'Authorization': f'Bearer {
|
73
|
+
f'{ado_config.organization_url}/{ado_config.project}/_apis/wiki/wikis?api-version=7.0',
|
74
|
+
headers={'Authorization': f'Bearer {ado_config.token}'},
|
83
75
|
timeout=5
|
84
76
|
)
|
85
77
|
return response
|
@@ -94,7 +86,13 @@ class AzureDevOpsWikiToolkit(BaseToolkit):
|
|
94
86
|
environ['AZURE_DEVOPS_CACHE_DIR'] = '/tmp/.azure-devops'
|
95
87
|
if selected_tools is None:
|
96
88
|
selected_tools = []
|
97
|
-
|
89
|
+
wrapper_payload = {
|
90
|
+
**kwargs,
|
91
|
+
# TODO use ado_configuration fields in AzureDevOpsApiWrapper
|
92
|
+
**kwargs['ado_configuration'],
|
93
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
94
|
+
}
|
95
|
+
azure_devops_api_wrapper = AzureDevOpsApiWrapper(**wrapper_payload)
|
98
96
|
available_tools = azure_devops_api_wrapper.get_available_tools()
|
99
97
|
tools = []
|
100
98
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
@@ -1,9 +1,11 @@
|
|
1
1
|
from typing import List, Optional, Literal
|
2
2
|
from .ado_wrapper import AzureDevOpsApiWrapper # Import the API wrapper for Azure DevOps
|
3
3
|
from langchain_core.tools import BaseTool, BaseToolkit
|
4
|
-
from pydantic import create_model, BaseModel, Field
|
4
|
+
from pydantic import create_model, BaseModel, Field
|
5
5
|
|
6
6
|
import requests
|
7
|
+
from ....configurations.ado import AdoConfiguration
|
8
|
+
from ....configurations.pgvector import PgVectorConfiguration
|
7
9
|
from ...base.tool import BaseAction
|
8
10
|
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
9
11
|
|
@@ -24,23 +26,11 @@ class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
|
24
26
|
'toolkit_name': True,
|
25
27
|
'max_toolkit_length': AzureDevOpsWorkItemsToolkit.toolkit_max_length})
|
26
28
|
),
|
27
|
-
|
28
|
-
description="ADO organization url",
|
29
|
-
json_schema_extra={
|
30
|
-
'configuration': True
|
31
|
-
})),
|
32
|
-
project=(str, Field(description="ADO project",
|
33
|
-
json_schema_extra={
|
34
|
-
'configuration': True
|
35
|
-
}
|
36
|
-
)),
|
37
|
-
token=(SecretStr, Field(description="ADO token", json_schema_extra={'secret': True, 'configuration': True})),
|
29
|
+
ado_configuration=(AdoConfiguration, Field(description="Ado Work Item configuration", json_schema_extra={'configuration_types': ['ado_work_item']})),
|
38
30
|
limit=(Optional[int], Field(description="ADO plans limit used for limitation of the list with results", default=5)),
|
39
31
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
40
32
|
# indexer settings
|
41
|
-
|
42
|
-
default=None,
|
43
|
-
json_schema_extra={'secret': True})),
|
33
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(description="PgVector Configuration", json_schema_extra={'configuration_types': ['pgvector']})),
|
44
34
|
# embedder settings
|
45
35
|
embedding_model=(str, Field(description="Embedding model: i.e. 'HuggingFaceEmbeddings', etc.",
|
46
36
|
default="HuggingFaceEmbeddings")),
|
@@ -51,7 +41,7 @@ class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
|
51
41
|
'json_schema_extra': {
|
52
42
|
'metadata': {
|
53
43
|
"label": "ADO boards",
|
54
|
-
"icon_url":
|
44
|
+
"icon_url": "ado-boards-icon.svg",
|
55
45
|
"categories": ["project management"],
|
56
46
|
"extra_categories": ["work item management", "issue tracking", "agile boards"],
|
57
47
|
"sections": {
|
@@ -75,9 +65,12 @@ class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
|
75
65
|
|
76
66
|
@check_connection_response
|
77
67
|
def check_connection(self):
|
68
|
+
ado_config = self.ado_work_item_configuration.ado_configuration if self.ado_work_item_configuration else None
|
69
|
+
if not ado_config:
|
70
|
+
raise ValueError("ADO work item configuration is required")
|
78
71
|
response = requests.get(
|
79
|
-
f'{
|
80
|
-
headers={'Authorization': f'Bearer {
|
72
|
+
f'{ado_config.organization_url}/{ado_config.project}/_apis/wit/workitemtypes?api-version=7.0',
|
73
|
+
headers={'Authorization': f'Bearer {ado_config.token}'},
|
81
74
|
timeout=5
|
82
75
|
)
|
83
76
|
return response
|
@@ -93,7 +86,13 @@ class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
|
93
86
|
if selected_tools is None:
|
94
87
|
selected_tools = []
|
95
88
|
|
96
|
-
|
89
|
+
wrapper_payload = {
|
90
|
+
**kwargs,
|
91
|
+
# TODO use ado_configuration fields in AzureDevOpsApiWrapper
|
92
|
+
**kwargs['ado_configuration'],
|
93
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
94
|
+
}
|
95
|
+
azure_devops_api_wrapper = AzureDevOpsApiWrapper(**wrapper_payload)
|
97
96
|
available_tools = azure_devops_api_wrapper.get_available_tools()
|
98
97
|
tools = []
|
99
98
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
@@ -5,6 +5,7 @@ from typing import List, Optional, Type
|
|
5
5
|
from langchain_core.tools import BaseTool, BaseToolkit
|
6
6
|
from pydantic import BaseModel, Field, SecretStr, computed_field, field_validator
|
7
7
|
|
8
|
+
from alita_sdk.configurations.delta_lake import DeltaLakeConfiguration
|
8
9
|
from ...utils import TOOLKIT_SPLITTER, clean_string, get_max_toolkit_length
|
9
10
|
from .api_wrapper import DeltaLakeApiWrapper
|
10
11
|
from .tool import DeltaLakeAction
|
@@ -53,12 +54,7 @@ class DeltaLakeToolkitConfig(BaseModel):
|
|
53
54
|
}
|
54
55
|
}
|
55
56
|
|
56
|
-
|
57
|
-
aws_secret_access_key: Optional[SecretStr] = Field(default=None, description="AWS secret access key", json_schema_extra={"secret": True, "configuration": True})
|
58
|
-
aws_session_token: Optional[SecretStr] = Field(default=None, description="AWS session token (optional)", json_schema_extra={"secret": True, "configuration": True})
|
59
|
-
aws_region: Optional[str] = Field(default=None, description="AWS region for Delta Lake storage", json_schema_extra={"configuration": True})
|
60
|
-
s3_path: Optional[str] = Field(default=None, description="S3 path to Delta Lake data (e.g., s3://bucket/path)", json_schema_extra={"configuration": True, "configuration_title": True})
|
61
|
-
table_path: Optional[str] = Field(default=None, description="Delta Lake table path (if not using s3_path)", json_schema_extra={"configuration": True})
|
57
|
+
delta_lake_configuration: Optional[DeltaLakeConfiguration] = Field(description="Delta Lake Configuration", json_schema_extra={"configuration_types": ["delta_lake"]})
|
62
58
|
selected_tools: List[str] = Field(default=[], description="Selected tools", json_schema_extra={"args_schemas": get_available_tools()})
|
63
59
|
|
64
60
|
@field_validator("selected_tools", mode="before", check_fields=False)
|
@@ -69,12 +65,12 @@ class DeltaLakeToolkitConfig(BaseModel):
|
|
69
65
|
def _get_toolkit(tool) -> BaseToolkit:
|
70
66
|
return DeltaLakeToolkit().get_toolkit(
|
71
67
|
selected_tools=tool["settings"].get("selected_tools", []),
|
72
|
-
aws_access_key_id=tool["settings"].get("aws_access_key_id", None),
|
73
|
-
aws_secret_access_key=tool["settings"].get("aws_secret_access_key", None),
|
74
|
-
aws_session_token=tool["settings"].get("aws_session_token", None),
|
75
|
-
aws_region=tool["settings"].get("aws_region", None),
|
76
|
-
s3_path=tool["settings"].get("s3_path", None),
|
77
|
-
table_path=tool["settings"].get("table_path", None),
|
68
|
+
aws_access_key_id=tool["settings"].get("delta_lake_configuration").get("aws_access_key_id", None),
|
69
|
+
aws_secret_access_key=tool["settings"].get("delta_lake_configuration").get("aws_secret_access_key", None),
|
70
|
+
aws_session_token=tool["settings"].get("delta_lake_configuration").get("aws_session_token", None),
|
71
|
+
aws_region=tool["settings"].get("delta_lake_configuration").get("aws_region", None),
|
72
|
+
s3_path=tool["settings"].get("delta_lake_configuration").get("s3_path", None),
|
73
|
+
table_path=tool["settings"].get("delta_lake_configuration").get("table_path", None),
|
78
74
|
toolkit_name=tool.get("toolkit_name"),
|
79
75
|
)
|
80
76
|
|
@@ -103,9 +99,9 @@ class DeltaLakeToolkit(BaseToolkit):
|
|
103
99
|
def available_tools(self) -> List[dict]:
|
104
100
|
return self.api_wrapper.get_available_tools()
|
105
101
|
|
106
|
-
@staticmethod
|
107
102
|
def toolkit_config_schema() -> Type[BaseModel]:
|
108
103
|
return DeltaLakeToolkitConfig
|
104
|
+
return m
|
109
105
|
|
110
106
|
@classmethod
|
111
107
|
def get_toolkit(
|
@@ -3,8 +3,9 @@ from typing import List, Optional, Literal
|
|
3
3
|
from .api_wrapper import AzureSearchApiWrapper
|
4
4
|
from ...base.tool import BaseAction
|
5
5
|
from langchain_core.tools import BaseToolkit, BaseTool
|
6
|
-
from pydantic import create_model, BaseModel, ConfigDict, Field
|
6
|
+
from pydantic import create_model, BaseModel, ConfigDict, Field
|
7
7
|
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
8
|
+
from ....configurations.azure_search import AzureSearchConfiguration
|
8
9
|
import requests
|
9
10
|
|
10
11
|
logger = getLogger(__name__)
|
@@ -14,10 +15,8 @@ name = "azure_search"
|
|
14
15
|
def get_tools(tool):
|
15
16
|
return AzureSearchToolkit().get_toolkit(
|
16
17
|
selected_tools=tool['settings'].get('selected_tools', []),
|
17
|
-
|
18
|
-
endpoint=tool['settings'].get('endpoint', None),
|
18
|
+
azure_search_configuration=tool['settings']['azure_search_configuration'],
|
19
19
|
index_name=tool['settings'].get('index_name', None),
|
20
|
-
api_base=tool['settings'].get('api_base', None),
|
21
20
|
api_version=tool['settings'].get('api_version', None),
|
22
21
|
openai_api_key=tool['settings'].get('access_token', None),
|
23
22
|
model_name=tool['settings'].get('model_name', None),
|
@@ -38,18 +37,11 @@ class AzureSearchToolkit(BaseToolkit):
|
|
38
37
|
AzureSearchToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
39
38
|
m = create_model(
|
40
39
|
name,
|
41
|
-
api_key=(SecretStr, Field(description="API key", json_schema_extra={'secret': True, 'configuration': True})),
|
42
|
-
endpoint=(str, Field(title="Azure Search endpoint",
|
43
|
-
description="Azure Search endpoint",
|
44
|
-
json_schema_extra={
|
45
|
-
'configuration': True,
|
46
|
-
"configuration_title": True
|
47
|
-
})),
|
48
40
|
index_name=(str, Field(description="Azure Search index name")),
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
41
|
+
azure_search_configuration=(
|
42
|
+
Optional[AzureSearchConfiguration],
|
43
|
+
Field(description="Azure Search Configuration", json_schema_extra={'configuration_types': ['azure_search']})
|
44
|
+
),
|
53
45
|
api_version=(Optional[str], Field(description="API version", default=None)),
|
54
46
|
openai_api_key=(Optional[str], Field(description="Azure OpenAI API Key", default=None, json_schema_extra={'secret': True})),
|
55
47
|
model_name=(str, Field(description="Model name for Embeddings model", default=None)),
|
@@ -77,7 +69,12 @@ class AzureSearchToolkit(BaseToolkit):
|
|
77
69
|
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
78
70
|
if selected_tools is None:
|
79
71
|
selected_tools = []
|
80
|
-
|
72
|
+
wrapper_payload = {
|
73
|
+
**kwargs,
|
74
|
+
# TODO use azure_search_configuration fields
|
75
|
+
**kwargs['azure_search_configuration'],
|
76
|
+
}
|
77
|
+
azure_search_api_wrapper = AzureSearchApiWrapper(**wrapper_payload)
|
81
78
|
available_tools = azure_search_api_wrapper.get_available_tools()
|
82
79
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
83
80
|
tools = []
|
@@ -6,8 +6,10 @@ from .api_wrapper import BitbucketAPIWrapper
|
|
6
6
|
from .tools import __all__
|
7
7
|
from langchain_core.tools import BaseToolkit
|
8
8
|
from langchain_core.tools import BaseTool
|
9
|
-
from pydantic import BaseModel, Field, ConfigDict, create_model
|
9
|
+
from pydantic import BaseModel, Field, ConfigDict, create_model
|
10
10
|
from ..utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
11
|
+
from ...configurations.bitbucket import BitbucketConfiguration
|
12
|
+
from ...configurations.pgvector import PgVectorConfiguration
|
11
13
|
import requests
|
12
14
|
|
13
15
|
|
@@ -20,13 +22,12 @@ def get_tools(tool):
|
|
20
22
|
url=tool['settings']['url'],
|
21
23
|
project=tool['settings']['project'],
|
22
24
|
repository=tool['settings']['repository'],
|
23
|
-
|
24
|
-
password=tool['settings']['password'],
|
25
|
+
bitbucket_configuration=tool['settings']['bitbucket_configuration'],
|
25
26
|
branch=tool['settings']['branch'],
|
26
27
|
cloud=tool['settings'].get('cloud'),
|
27
28
|
llm=tool['settings'].get('llm', None),
|
28
29
|
alita=tool['settings'].get('alita', None),
|
29
|
-
|
30
|
+
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
30
31
|
collection_name=str(tool['toolkit_name']),
|
31
32
|
doctype='code',
|
32
33
|
embedding_model="HuggingFaceEmbeddings",
|
@@ -53,14 +54,9 @@ class AlitaBitbucketToolkit(BaseToolkit):
|
|
53
54
|
project=(str, Field(description="Project/Workspace", json_schema_extra={'configuration': True})),
|
54
55
|
repository=(str, Field(description="Repository", json_schema_extra={'max_toolkit_length': AlitaBitbucketToolkit.toolkit_max_length, 'configuration': True})),
|
55
56
|
branch=(str, Field(description="Main branch", default="main")),
|
56
|
-
username=(str, Field(description="Username", json_schema_extra={'configuration': True})),
|
57
|
-
password=(SecretStr, Field(description="GitLab private token", json_schema_extra={'secret': True, 'configuration': True})),
|
58
57
|
cloud=(Optional[bool], Field(description="Hosting Option", default=None)),
|
59
|
-
|
60
|
-
|
61
|
-
default=None,
|
62
|
-
json_schema_extra={'secret': True})),
|
63
|
-
|
58
|
+
bitbucket_configuration=(Optional[BitbucketConfiguration], Field(description="Bitbucket Configuration", json_schema_extra={'configuration_types': ['bitbucket']})),
|
59
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(description="PgVector Configuration", default={'configuration_types': ['pgvector']})),
|
64
60
|
# embedder settings
|
65
61
|
embedding_model=(str, Field(description="Embedding model: i.e. 'HuggingFaceEmbeddings', etc.", default="HuggingFaceEmbeddings")),
|
66
62
|
embedding_model_params=(dict, Field(description="Embedding model parameters: i.e. `{'model_name': 'sentence-transformers/all-MiniLM-L6-v2'}", default={"model_name": "sentence-transformers/all-MiniLM-L6-v2"})),
|
@@ -94,7 +90,13 @@ class AlitaBitbucketToolkit(BaseToolkit):
|
|
94
90
|
selected_tools = []
|
95
91
|
if kwargs["cloud"] is None:
|
96
92
|
kwargs["cloud"] = True if "bitbucket.org" in kwargs.get('url') else False
|
97
|
-
|
93
|
+
wrapper_payload = {
|
94
|
+
**kwargs,
|
95
|
+
# TODO use bitbucket_configuration fields
|
96
|
+
**kwargs['bitbucket_configuration'],
|
97
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
98
|
+
}
|
99
|
+
bitbucket_api_wrapper = BitbucketAPIWrapper(**wrapper_payload)
|
98
100
|
available_tools: List[Dict] = __all__
|
99
101
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
100
102
|
tools = []
|
@@ -3,8 +3,10 @@ from langchain_community.agent_toolkits.base import BaseToolkit
|
|
3
3
|
from .api_wrapper import ConfluenceAPIWrapper
|
4
4
|
from langchain_core.tools import BaseTool
|
5
5
|
from ..base.tool import BaseAction
|
6
|
-
from pydantic import create_model, BaseModel, ConfigDict, Field
|
6
|
+
from pydantic import create_model, BaseModel, ConfigDict, Field
|
7
7
|
from ..utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, parse_list, check_connection_response
|
8
|
+
from ...configurations.confluence import ConfluenceConfiguration
|
9
|
+
from ...configurations.pgvector import PgVectorConfiguration
|
8
10
|
import requests
|
9
11
|
|
10
12
|
name = "confluence"
|
@@ -15,9 +17,7 @@ def get_tools(tool):
|
|
15
17
|
base_url=tool['settings']['base_url'],
|
16
18
|
space=tool['settings'].get('space', None),
|
17
19
|
cloud=tool['settings'].get('cloud', True),
|
18
|
-
|
19
|
-
username=tool['settings'].get('username', None),
|
20
|
-
token=tool['settings'].get('token', None),
|
20
|
+
confluence_configuration=tool['settings']['confluence_configuration'],
|
21
21
|
limit=tool['settings'].get('limit', 5),
|
22
22
|
labels=parse_list(tool['settings'].get('labels', None)),
|
23
23
|
additional_fields=tool['settings'].get('additional_fields', []),
|
@@ -26,7 +26,7 @@ def get_tools(tool):
|
|
26
26
|
llm=tool['settings'].get('llm', None),
|
27
27
|
toolkit_name=tool.get('toolkit_name'),
|
28
28
|
# indexer settings
|
29
|
-
|
29
|
+
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
30
30
|
collection_name=str(tool['toolkit_name']),
|
31
31
|
doctype='doc',
|
32
32
|
embedding_model="HuggingFaceEmbeddings",
|
@@ -50,10 +50,15 @@ class ConfluenceToolkit(BaseToolkit):
|
|
50
50
|
url = self.base_url.rstrip('/') + '/wiki/rest/api/space'
|
51
51
|
headers = {'Accept': 'application/json'}
|
52
52
|
auth = None
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
confluence_config = self.confluence_configuration or {}
|
54
|
+
token = confluence_config.get('token')
|
55
|
+
username = confluence_config.get('username')
|
56
|
+
api_key = confluence_config.get('api_key')
|
57
|
+
|
58
|
+
if token:
|
59
|
+
headers['Authorization'] = f'Bearer {token}'
|
60
|
+
elif username and api_key:
|
61
|
+
auth = (username, api_key)
|
57
62
|
else:
|
58
63
|
raise ValueError('Confluence connection requires either token or username+api_key')
|
59
64
|
response = requests.get(url, headers=headers, auth=auth, timeout=5, verify=getattr(self, 'verify_ssl', True))
|
@@ -62,9 +67,6 @@ class ConfluenceToolkit(BaseToolkit):
|
|
62
67
|
model = create_model(
|
63
68
|
name,
|
64
69
|
base_url=(str, Field(description="Confluence URL", json_schema_extra={'configuration': True, 'configuration_title': True})),
|
65
|
-
token=(SecretStr, Field(description="Token", default=None, json_schema_extra={'secret': True, 'configuration': True})),
|
66
|
-
api_key=(SecretStr, Field(description="API key", default=None, json_schema_extra={'secret': True, 'configuration': True})),
|
67
|
-
username=(str, Field(description="Username", default=None, json_schema_extra={'configuration': True})),
|
68
70
|
space=(str, Field(description="Space", json_schema_extra={'toolkit_name': True,
|
69
71
|
'max_toolkit_length': ConfluenceToolkit.toolkit_max_length})),
|
70
72
|
cloud=(bool, Field(description="Hosting Option", json_schema_extra={'configuration': True})),
|
@@ -78,17 +80,13 @@ class ConfluenceToolkit(BaseToolkit):
|
|
78
80
|
number_of_retries=(int, Field(description="Number of retries", default=2)),
|
79
81
|
min_retry_seconds=(int, Field(description="Min retry, sec", default=10)),
|
80
82
|
max_retry_seconds=(int, Field(description="Max retry, sec", default=60)),
|
81
|
-
|
82
|
-
|
83
|
-
# indexer settings
|
84
|
-
connection_string = (Optional[SecretStr], Field(description="Connection string for vectorstore",
|
85
|
-
default=None,
|
86
|
-
json_schema_extra={'secret': True})),
|
87
|
-
|
88
|
-
# embedder settings
|
83
|
+
confluence_configuration=(Optional[ConfluenceConfiguration], Field(description="Confluence Configuration", json_schema_extra={'configuration_types': ['confluence']})),
|
84
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(description="PgVector Configuration", json_schema_extra={'configuration_types': ['pgvector']})),
|
89
85
|
embedding_model=(str, Field(description="Embedding model: i.e. 'HuggingFaceEmbeddings', etc.", default="HuggingFaceEmbeddings")),
|
90
86
|
embedding_model_params=(dict, Field(description="Embedding model parameters: i.e. `{'model_name': 'sentence-transformers/all-MiniLM-L6-v2'}", default={"model_name": "sentence-transformers/all-MiniLM-L6-v2"})),
|
91
87
|
|
88
|
+
selected_tools=(List[Literal[tuple(selected_tools)]],
|
89
|
+
Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
92
90
|
__config__=ConfigDict(json_schema_extra={
|
93
91
|
'metadata': {
|
94
92
|
"label": "Confluence",
|
@@ -120,7 +118,13 @@ class ConfluenceToolkit(BaseToolkit):
|
|
120
118
|
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
121
119
|
if selected_tools is None:
|
122
120
|
selected_tools = []
|
123
|
-
|
121
|
+
wrapper_payload = {
|
122
|
+
**kwargs,
|
123
|
+
# TODO use confluence_configuration fields
|
124
|
+
**kwargs['confluence_configuration'],
|
125
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
126
|
+
}
|
127
|
+
confluence_api_wrapper = ConfluenceAPIWrapper(**wrapper_payload)
|
124
128
|
prefix = clean_string(toolkit_name, ConfluenceToolkit.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
125
129
|
available_tools = confluence_api_wrapper.get_available_tools()
|
126
130
|
tools = []
|