alita-sdk 0.3.270__py3-none-any.whl → 0.3.272__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 +10 -0
- alita_sdk/configurations/ado.py +4 -2
- alita_sdk/configurations/azure_search.py +1 -1
- alita_sdk/configurations/bigquery.py +1 -1
- alita_sdk/configurations/browser.py +18 -0
- alita_sdk/configurations/carrier.py +19 -0
- alita_sdk/configurations/delta_lake.py +1 -1
- alita_sdk/configurations/google_places.py +17 -0
- alita_sdk/configurations/postman.py +1 -1
- alita_sdk/configurations/qtest.py +1 -3
- alita_sdk/configurations/report_portal.py +19 -0
- alita_sdk/configurations/salesforce.py +19 -0
- alita_sdk/configurations/service_now.py +1 -12
- alita_sdk/configurations/sharepoint.py +19 -0
- alita_sdk/configurations/sonar.py +18 -0
- alita_sdk/configurations/sql.py +20 -0
- alita_sdk/configurations/testio.py +18 -0
- alita_sdk/configurations/zephyr_essential.py +18 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py +1 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaPDFLoader.py +19 -6
- alita_sdk/runtime/langchain/document_loaders/ImageParser.py +17 -0
- alita_sdk/runtime/tools/vectorstore.py +21 -5
- alita_sdk/runtime/tools/vectorstore_base.py +4 -1
- alita_sdk/tools/aws/delta_lake/__init__.py +2 -2
- alita_sdk/tools/azure_ai/search/__init__.py +1 -1
- alita_sdk/tools/bitbucket/__init__.py +9 -4
- alita_sdk/tools/bitbucket/api_wrapper.py +1 -1
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py +5 -5
- alita_sdk/tools/browser/__init__.py +14 -10
- alita_sdk/tools/carrier/__init__.py +11 -11
- alita_sdk/tools/code/sonar/__init__.py +10 -7
- alita_sdk/tools/confluence/__init__.py +1 -1
- alita_sdk/tools/figma/__init__.py +1 -1
- alita_sdk/tools/github/__init__.py +2 -2
- alita_sdk/tools/gitlab_org/__init__.py +1 -1
- alita_sdk/tools/google/bigquery/__init__.py +1 -1
- alita_sdk/tools/google_places/__init__.py +10 -5
- alita_sdk/tools/jira/__init__.py +1 -1
- alita_sdk/tools/jira/api_wrapper.py +140 -99
- alita_sdk/tools/qtest/__init__.py +1 -1
- alita_sdk/tools/rally/__init__.py +1 -1
- alita_sdk/tools/report_portal/__init__.py +9 -8
- alita_sdk/tools/salesforce/__init__.py +9 -8
- alita_sdk/tools/servicenow/__init__.py +1 -1
- alita_sdk/tools/sharepoint/__init__.py +5 -7
- alita_sdk/tools/slack/__init__.py +1 -1
- alita_sdk/tools/sql/__init__.py +9 -11
- alita_sdk/tools/testio/__init__.py +9 -6
- alita_sdk/tools/utils/content_parser.py +59 -24
- alita_sdk/tools/zephyr_enterprise/__init__.py +1 -1
- alita_sdk/tools/zephyr_essential/__init__.py +4 -3
- alita_sdk/tools/zephyr_essential/api_wrapper.py +42 -10
- alita_sdk/tools/zephyr_scale/__init__.py +1 -1
- {alita_sdk-0.3.270.dist-info → alita_sdk-0.3.272.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.270.dist-info → alita_sdk-0.3.272.dist-info}/RECORD +58 -47
- {alita_sdk-0.3.270.dist-info → alita_sdk-0.3.272.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.270.dist-info → alita_sdk-0.3.272.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.270.dist-info → alita_sdk-0.3.272.dist-info}/top_level.txt +0 -0
@@ -41,8 +41,18 @@ _safe_import_configuration('bigquery', 'bigquery', 'BigQueryConfiguration')
|
|
41
41
|
_safe_import_configuration('xray', 'xray', 'XrayConfiguration')
|
42
42
|
_safe_import_configuration('zephyr', 'zephyr', 'ZephyrConfiguration')
|
43
43
|
_safe_import_configuration('zephyr_enterprise', 'zephyr_enterprise', 'ZephyrEnterpriseConfiguration')
|
44
|
+
_safe_import_configuration('zephyr_essential', 'zephyr_essential', 'ZephyrEssentialConfiguration')
|
44
45
|
_safe_import_configuration('figma', 'figma', 'FigmaConfiguration')
|
45
46
|
_safe_import_configuration('rally', 'rally', 'RallyConfiguration')
|
47
|
+
_safe_import_configuration('sonar', 'sonar', 'SonarConfiguration')
|
48
|
+
_safe_import_configuration('sql', 'sql', 'SqlConfiguration')
|
49
|
+
_safe_import_configuration('google_places', 'google_places', 'GooglePlacesConfiguration')
|
50
|
+
_safe_import_configuration('salesforce', 'salesforce', 'SalesforceConfiguration')
|
51
|
+
_safe_import_configuration('browser', 'browser', 'BrowserConfiguration')
|
52
|
+
_safe_import_configuration('sharepoint', 'sharepoint', 'SharepointConfiguration')
|
53
|
+
_safe_import_configuration('carrier', 'carrier', 'CarrierConfiguration')
|
54
|
+
_safe_import_configuration('report_portal', 'report_portal', 'ReportPortalConfiguration')
|
55
|
+
_safe_import_configuration('testio', 'testio', 'TestIOConfiguration')
|
46
56
|
|
47
57
|
# Log import summary
|
48
58
|
available_count = len(AVAILABLE_CONFIGURATIONS)
|
alita_sdk/configurations/ado.py
CHANGED
@@ -10,7 +10,8 @@ class AdoConfiguration(BaseModel):
|
|
10
10
|
"label": "Ado",
|
11
11
|
"icon_url": None,
|
12
12
|
"section": "credentials",
|
13
|
-
"type": "ado"
|
13
|
+
"type": "ado",
|
14
|
+
"categories": ["project management"],
|
14
15
|
}
|
15
16
|
}
|
16
17
|
)
|
@@ -26,7 +27,8 @@ class AdoReposConfiguration(BaseModel):
|
|
26
27
|
"label": "ADO repos",
|
27
28
|
"icon_url": "ado-repos-icon.svg",
|
28
29
|
"section": "credentials",
|
29
|
-
"type": "ado_repos"
|
30
|
+
"type": "ado_repos",
|
31
|
+
"categories": ["code repositories"],
|
30
32
|
}
|
31
33
|
}
|
32
34
|
)
|
@@ -12,7 +12,7 @@ class AzureSearchConfiguration(BaseModel):
|
|
12
12
|
"hidden": True,
|
13
13
|
"section": "credentials",
|
14
14
|
"type": "azure_search",
|
15
|
-
"categories": ["
|
15
|
+
"categories": ["other"],
|
16
16
|
"extra_categories": ["azure", "cognitive search", "vector database", "knowledge base"],
|
17
17
|
}
|
18
18
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class BrowserConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Browser",
|
9
|
+
"icon_url": "browser.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "browser",
|
12
|
+
"categories": ["testing"],
|
13
|
+
"extra_categories": ["browser", "google", "search", "web"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
google_cse_id: str = Field(description="Google CSE id", default=None)
|
18
|
+
google_api_key: SecretStr = Field(description="Google API key", default=None, json_schema_extra={'secret': True})
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class CarrierConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Carrier",
|
9
|
+
"icon_url": "carrier.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "carrier",
|
12
|
+
"categories": ["testing"],
|
13
|
+
"extra_categories": ["carrier", "security", "testing", "vulnerability"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
organization: str = Field(description="Carrier Organization")
|
18
|
+
url: str = Field(description="Carrier URL")
|
19
|
+
private_token: SecretStr = Field(description="Carrier Private Token")
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class GooglePlacesConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Google Places",
|
9
|
+
"icon_url": "google.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "google_places",
|
12
|
+
"categories": ["other"],
|
13
|
+
"extra_categories": ["google", "places", "maps", "location", "geocoding"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
api_key: SecretStr = Field(description="Google Places API Key")
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import Optional
|
2
|
-
|
3
1
|
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
4
2
|
|
5
3
|
|
@@ -17,5 +15,5 @@ class QtestConfiguration(BaseModel):
|
|
17
15
|
}
|
18
16
|
)
|
19
17
|
base_url: str = Field(description="QTest base url")
|
20
|
-
qtest_api_token:
|
18
|
+
qtest_api_token: SecretStr = Field(description="QTest API token", default=None)
|
21
19
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class ReportPortalConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Report Portal",
|
9
|
+
"icon_url": "report_portal.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "report_portal",
|
12
|
+
"categories": ["testing"],
|
13
|
+
"extra_categories": ["report portal", "testing", "automation", "reports"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
project: str = Field(description="Report Portal Project Name")
|
18
|
+
endpoint: str = Field(description="Report Portal Endpoint URL")
|
19
|
+
api_key: SecretStr = Field(description="Report Portal API Key")
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class SalesforceConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Salesforce",
|
9
|
+
"icon_url": "salesforce.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "salesforce",
|
12
|
+
"categories": ["other"],
|
13
|
+
"extra_categories": ["salesforce", "crm", "sales", "customer"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
client_id: str = Field(description="Salesforce Client ID")
|
18
|
+
client_secret: SecretStr = Field(description="Salesforce Client Secret")
|
19
|
+
base_url: str = Field(description="Salesforce Base URL")
|
@@ -9,20 +9,9 @@ class ServiceNowConfiguration(BaseModel):
|
|
9
9
|
"metadata": {
|
10
10
|
"label": "ServiceNow",
|
11
11
|
"icon_url": "servicenow.svg",
|
12
|
-
"sections": {
|
13
|
-
"auth": {
|
14
|
-
"required": True,
|
15
|
-
"subsections": [
|
16
|
-
{
|
17
|
-
"name": "Username & Password",
|
18
|
-
"fields": ["username", "password"]
|
19
|
-
}
|
20
|
-
]
|
21
|
-
},
|
22
|
-
},
|
23
12
|
"section": "credentials",
|
24
13
|
"type": "service_now",
|
25
|
-
"categories": ["
|
14
|
+
"categories": ["other"],
|
26
15
|
"extra_categories": ["servicenow", "itsm", "service management", "incident"],
|
27
16
|
}
|
28
17
|
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class SharepointConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "SharePoint",
|
9
|
+
"icon_url": "sharepoint.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "sharepoint",
|
12
|
+
"categories": ["office"],
|
13
|
+
"extra_categories": ["sharepoint", "microsoft", "documents", "collaboration"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
client_id: str = Field(description="SharePoint Client ID")
|
18
|
+
client_secret: SecretStr = Field(description="SharePoint Client Secret")
|
19
|
+
site_url: str = Field(description="SharePoint Site URL")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class SonarConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Sonar",
|
9
|
+
"icon_url": "sonar-icon.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "sonar",
|
12
|
+
"categories": ["development"],
|
13
|
+
"extra_categories": ["code quality", "code security", "code coverage", "quality", "sonarqube"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
url: str = Field(description="SonarQube Server URL")
|
18
|
+
sonar_token: SecretStr = Field(description="SonarQube user token for authentication")
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class SqlConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "SQL Database",
|
9
|
+
"icon_url": "sql.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "sql",
|
12
|
+
"categories": ["development"],
|
13
|
+
"extra_categories": ["sql", "database", "data", "query"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
host: str = Field(description="Database host")
|
18
|
+
port: int = Field(description="Database port")
|
19
|
+
username: str = Field(description="Database username")
|
20
|
+
password: SecretStr = Field(description="Database password", json_schema_extra={'secret': True})
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class TestIOConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "TestIO",
|
9
|
+
"icon_url": "testio.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "testio",
|
12
|
+
"categories": ["testing"],
|
13
|
+
"extra_categories": ["testio", "testing", "crowd testing", "qa"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
endpoint: str = Field(description="TestIO endpoint")
|
18
|
+
api_key: SecretStr = Field(description="TestIO API Key")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
2
|
+
|
3
|
+
|
4
|
+
class ZephyrEssentialConfiguration(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
json_schema_extra={
|
7
|
+
"metadata": {
|
8
|
+
"label": "Zephyr Essential",
|
9
|
+
"icon_url": "zephyr.svg",
|
10
|
+
"section": "credentials",
|
11
|
+
"type": "zephyr-essential",
|
12
|
+
"categories": ["test management"],
|
13
|
+
"extra_categories": ["zephyr", "test automation", "test case management", "test planning"],
|
14
|
+
}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
base_url: str = Field(description="Zephyr Essential Base URL", default=None)
|
18
|
+
token: SecretStr = Field(description="Zephyr Essential API Token")
|
@@ -151,5 +151,5 @@ class AlitaImageLoader(BaseLoader):
|
|
151
151
|
"""Load text from image using OCR or LLM if llm is provided, supports SVG."""
|
152
152
|
text_content = self.get_content()
|
153
153
|
|
154
|
-
metadata = {"source": str(self.file_path)} # Ensure source is always a string for metadata
|
154
|
+
metadata = {"source": str(self.file_path if hasattr(self, 'file_path') else self.file_name)} # Ensure source is always a string for metadata
|
155
155
|
return [Document(page_content=text_content, metadata=metadata)]
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import pymupdf
|
2
2
|
from langchain_community.document_loaders import PyPDFLoader
|
3
|
+
|
4
|
+
from .ImageParser import ImageParser
|
3
5
|
from .utils import perform_llm_prediction_for_image_bytes, create_temp_file
|
4
6
|
from langchain_core.tools import ToolException
|
5
7
|
|
@@ -54,10 +56,21 @@ class AlitaPDFLoader:
|
|
54
56
|
|
55
57
|
def load(self):
|
56
58
|
if not hasattr(self, 'file_path'):
|
57
|
-
|
59
|
+
import tempfile
|
60
|
+
|
61
|
+
with tempfile.NamedTemporaryFile(mode='w+b', delete=True, suffix=".pdf") as temp_file:
|
62
|
+
temp_file.write(self.file_content)
|
63
|
+
temp_file.flush()
|
64
|
+
self.file_path = temp_file.name
|
65
|
+
return self._load_docs()
|
66
|
+
else:
|
67
|
+
return self._load_docs()
|
68
|
+
|
69
|
+
def _load_docs(self):
|
58
70
|
return PyPDFLoader(file_path=self.file_path,
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
71
|
+
password=self.password,
|
72
|
+
headers=self.headers,
|
73
|
+
extract_images=self.extract_images,
|
74
|
+
extraction_mode=self.extraction_mode,
|
75
|
+
images_parser=ImageParser(llm=self.llm, prompt=self.prompt),
|
76
|
+
extraction_kwargs=self.extraction_kwargs).load()
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from langchain_community.document_loaders.parsers.images import BaseImageBlobParser
|
2
|
+
|
3
|
+
from alita_sdk.runtime.langchain.document_loaders.AlitaImageLoader import AlitaImageLoader
|
4
|
+
|
5
|
+
class ImageParser(BaseImageBlobParser):
|
6
|
+
|
7
|
+
def __init__(self, **kwargs):
|
8
|
+
self.llm = kwargs.get('llm')
|
9
|
+
self.prompt = kwargs.get('prompt')
|
10
|
+
|
11
|
+
def _analyze_image(self, img) -> str:
|
12
|
+
from io import BytesIO
|
13
|
+
|
14
|
+
byte_stream = BytesIO()
|
15
|
+
img.save(byte_stream, format='PNG')
|
16
|
+
image_bytes = byte_stream.getvalue()
|
17
|
+
return AlitaImageLoader(file_content=image_bytes, file_name="image.png", prompt=self.prompt, llm=self.llm).get_content()
|
@@ -212,10 +212,27 @@ class VectorStoreWrapper(BaseToolApiWrapper):
|
|
212
212
|
"""Get all indexed document IDs from vectorstore"""
|
213
213
|
return self.vector_adapter.get_indexed_ids(self, collection_suffix)
|
214
214
|
|
215
|
-
def list_collections(self) ->
|
216
|
-
"""List all collections in the vectorstore.
|
217
|
-
|
218
|
-
|
215
|
+
def list_collections(self) -> Any:
|
216
|
+
"""List all collections in the vectorstore.
|
217
|
+
Returns a list of collection names, or if no collections exist,
|
218
|
+
returns a dict with an empty list and a message."""
|
219
|
+
raw = self.vector_adapter.list_collections(self)
|
220
|
+
# Normalize raw result to a list of names
|
221
|
+
if not raw:
|
222
|
+
# No collections found
|
223
|
+
return {"collections": [], "message": "No indexed collections"}
|
224
|
+
if isinstance(raw, str):
|
225
|
+
# e.g., Chroma adapter returns comma-separated string
|
226
|
+
cols = [c for c in raw.split(',') if c]
|
227
|
+
else:
|
228
|
+
try:
|
229
|
+
cols = list(raw)
|
230
|
+
except Exception:
|
231
|
+
# Unexpected type, return raw directly
|
232
|
+
return raw
|
233
|
+
if not cols:
|
234
|
+
return {"collections": [], "message": "No indexed collections"}
|
235
|
+
return cols
|
219
236
|
|
220
237
|
def _clean_collection(self, collection_suffix: str = ''):
|
221
238
|
"""
|
@@ -765,4 +782,3 @@ class VectorStoreWrapper(BaseToolApiWrapper):
|
|
765
782
|
"args_schema": StepBackSearchDocumentsModel
|
766
783
|
}
|
767
784
|
]
|
768
|
-
|
@@ -192,7 +192,10 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
|
|
192
192
|
def list_collections(self) -> List[str]:
|
193
193
|
"""List all collections in the vectorstore."""
|
194
194
|
|
195
|
-
|
195
|
+
collections = self.vector_adapter.list_collections(self)
|
196
|
+
if not collections:
|
197
|
+
return "No indexed collections"
|
198
|
+
return collections
|
196
199
|
|
197
200
|
def _clean_collection(self, collection_suffix: str = ''):
|
198
201
|
"""
|
@@ -3,7 +3,7 @@ from functools import lru_cache
|
|
3
3
|
from typing import List, Optional, Type
|
4
4
|
|
5
5
|
from langchain_core.tools import BaseTool, BaseToolkit
|
6
|
-
from pydantic import BaseModel, Field,
|
6
|
+
from pydantic import BaseModel, Field, computed_field, field_validator
|
7
7
|
|
8
8
|
from alita_sdk.configurations.delta_lake import DeltaLakeConfiguration
|
9
9
|
from ...utils import TOOLKIT_SPLITTER, clean_string, get_max_toolkit_length
|
@@ -54,7 +54,7 @@ class DeltaLakeToolkitConfig(BaseModel):
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
|
57
|
-
delta_lake_configuration:
|
57
|
+
delta_lake_configuration: DeltaLakeConfiguration = Field(description="Delta Lake Configuration", json_schema_extra={"configuration_types": ["delta_lake"]})
|
58
58
|
selected_tools: List[str] = Field(default=[], description="Selected tools", json_schema_extra={"args_schemas": get_available_tools()})
|
59
59
|
|
60
60
|
@field_validator("selected_tools", mode="before", check_fields=False)
|
@@ -39,7 +39,7 @@ class AzureSearchToolkit(BaseToolkit):
|
|
39
39
|
name,
|
40
40
|
index_name=(str, Field(description="Azure Search index name")),
|
41
41
|
azure_search_configuration=(
|
42
|
-
|
42
|
+
AzureSearchConfiguration,
|
43
43
|
Field(description="Azure Search Configuration", json_schema_extra={'configuration_types': ['azure_search']})
|
44
44
|
),
|
45
45
|
api_version=(Optional[str], Field(description="API version", default=None)),
|
@@ -6,6 +6,8 @@ from .api_wrapper import BitbucketAPIWrapper
|
|
6
6
|
from langchain_core.tools import BaseToolkit
|
7
7
|
from langchain_core.tools import BaseTool
|
8
8
|
from pydantic import BaseModel, Field, ConfigDict, create_model
|
9
|
+
|
10
|
+
from ..base.tool import BaseAction
|
9
11
|
from ..utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
10
12
|
from ...configurations.bitbucket import BitbucketConfiguration
|
11
13
|
from ...configurations.pgvector import PgVectorConfiguration
|
@@ -49,7 +51,7 @@ class AlitaBitbucketToolkit(BaseToolkit):
|
|
49
51
|
repository=(str, Field(description="Repository", json_schema_extra={'max_toolkit_length': AlitaBitbucketToolkit.toolkit_max_length, 'configuration': True})),
|
50
52
|
branch=(str, Field(description="Main branch", default="main")),
|
51
53
|
cloud=(Optional[bool], Field(description="Hosting Option", default=None)),
|
52
|
-
bitbucket_configuration=(
|
54
|
+
bitbucket_configuration=(BitbucketConfiguration, Field(description="Bitbucket Configuration", json_schema_extra={'configuration_types': ['bitbucket']})),
|
53
55
|
pgvector_configuration=(Optional[PgVectorConfiguration], Field(default=None, description="PgVector Configuration", json_schema_extra={'configuration_types': ['pgvector']})),
|
54
56
|
# embedder settings
|
55
57
|
embedding_model=(Optional[str], Field(default=None, description="Embedding configuration.", json_schema_extra={'configuration_model': 'embedding'})),
|
@@ -102,9 +104,12 @@ class AlitaBitbucketToolkit(BaseToolkit):
|
|
102
104
|
if selected_tools:
|
103
105
|
if tool['name'] not in selected_tools:
|
104
106
|
continue
|
105
|
-
|
106
|
-
|
107
|
-
|
107
|
+
tools.append(BaseAction(
|
108
|
+
api_wrapper=bitbucket_api_wrapper,
|
109
|
+
name=prefix + tool["name"],
|
110
|
+
description=tool["description"] + f"\nrepo: {bitbucket_api_wrapper.repository}",
|
111
|
+
args_schema=tool["args_schema"]
|
112
|
+
))
|
108
113
|
return cls(tools=tools)
|
109
114
|
|
110
115
|
def get_tools(self):
|
@@ -194,7 +194,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
|
|
194
194
|
if limit is not None:
|
195
195
|
branches = branches[:limit]
|
196
196
|
|
197
|
-
return branches
|
197
|
+
return "Found branches: " + ", ".join(branches)
|
198
198
|
except Exception as e:
|
199
199
|
return f"Failed to list branches: {str(e)}"
|
200
200
|
|
@@ -35,7 +35,7 @@ def normalize_response(response) -> Dict[str, Any]:
|
|
35
35
|
class BitbucketApiAbstract(ABC):
|
36
36
|
|
37
37
|
@abstractmethod
|
38
|
-
def list_branches(self) -> str:
|
38
|
+
def list_branches(self) -> List[str]:
|
39
39
|
pass
|
40
40
|
|
41
41
|
@abstractmethod
|
@@ -86,9 +86,9 @@ class BitbucketServerApi(BitbucketApiAbstract):
|
|
86
86
|
self.password = password
|
87
87
|
self.api_client = Bitbucket(url=url, username=username, password=password)
|
88
88
|
|
89
|
-
def list_branches(self) -> str:
|
89
|
+
def list_branches(self) -> List[str]:
|
90
90
|
branches = self.api_client.get_branches(project_key=self.project, repository_slug=self.repository)
|
91
|
-
return
|
91
|
+
return [branch['displayId'] for branch in branches]
|
92
92
|
|
93
93
|
def create_branch(self, branch_name: str, branch_from: str) -> Response:
|
94
94
|
return self.api_client.create_branch(
|
@@ -257,10 +257,10 @@ class BitbucketCloudApi(BitbucketApiAbstract):
|
|
257
257
|
except Exception as e:
|
258
258
|
raise ToolException(f"Unable to connect to the repository '{self.repository_name}' due to error:\n{str(e)}")
|
259
259
|
|
260
|
-
def list_branches(self) -> str:
|
260
|
+
def list_branches(self) -> List[str]:
|
261
261
|
branches = self.repository.branches.each()
|
262
262
|
branch_names = [branch.name for branch in branches]
|
263
|
-
return
|
263
|
+
return branch_names
|
264
264
|
|
265
265
|
def _get_branch(self, branch_name: str) -> Response:
|
266
266
|
return self.repository.branches.get(branch_name)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import List, Optional, Literal
|
2
2
|
from langchain_core.tools import BaseTool, BaseToolkit
|
3
3
|
|
4
|
-
from pydantic import create_model, BaseModel, ConfigDict, Field,
|
4
|
+
from pydantic import create_model, BaseModel, ConfigDict, Field, model_validator
|
5
5
|
|
6
6
|
from langchain_community.utilities.google_search import GoogleSearchAPIWrapper
|
7
7
|
from langchain_community.utilities.wikipedia import WikipediaAPIWrapper
|
@@ -9,6 +9,7 @@ from .google_search_rag import GoogleSearchResults
|
|
9
9
|
from .crawler import SingleURLCrawler, MultiURLCrawler, GetHTMLContent, GetPDFContent
|
10
10
|
from .wiki import WikipediaQueryRun
|
11
11
|
from ..utils import get_max_toolkit_length, clean_string, TOOLKIT_SPLITTER
|
12
|
+
from ...configurations.browser import BrowserConfiguration
|
12
13
|
from logging import getLogger
|
13
14
|
|
14
15
|
logger = getLogger(__name__)
|
@@ -19,8 +20,7 @@ name = "browser"
|
|
19
20
|
def get_tools(tool):
|
20
21
|
return BrowserToolkit().get_toolkit(
|
21
22
|
selected_tools=tool['settings'].get('selected_tools', []),
|
22
|
-
|
23
|
-
google_cse_id=tool['settings'].get("google_cse_id"),
|
23
|
+
browser_configuration=tool['settings']['browser_configuration'],
|
24
24
|
toolkit_name=tool.get('toolkit_name', '')
|
25
25
|
).get_tools()
|
26
26
|
|
@@ -42,8 +42,9 @@ class BrowserToolkit(BaseToolkit):
|
|
42
42
|
|
43
43
|
def validate_google_fields(cls, values):
|
44
44
|
if 'google' in values.get('selected_tools', []):
|
45
|
-
|
46
|
-
|
45
|
+
browser_config = values.get('browser_configuration', {})
|
46
|
+
google_cse_id = browser_config.get('google_cse_id') is not None if browser_config else False
|
47
|
+
google_api_key = browser_config.get('google_api_key') is not None if browser_config else False
|
47
48
|
if not (google_cse_id and google_api_key):
|
48
49
|
raise ValueError("google_cse_id and google_api_key are required when 'google' is in selected_tools")
|
49
50
|
return values
|
@@ -51,9 +52,7 @@ class BrowserToolkit(BaseToolkit):
|
|
51
52
|
return create_model(
|
52
53
|
name,
|
53
54
|
__config__=ConfigDict(json_schema_extra={'metadata': {"label": "Browser", "icon_url": None, "categories": ["testing"], "extra_categories": ["web scraping", "search", "crawler"]}}),
|
54
|
-
|
55
|
-
google_api_key=(Optional[SecretStr],
|
56
|
-
Field(description="Google API key", default=None, json_schema_extra={'secret': True})),
|
55
|
+
browser_configuration=(BrowserConfiguration, Field(description="Browser Configuration", json_schema_extra={'configuration_types': ['browser']})),
|
57
56
|
selected_tools=(List[Literal[tuple(selected_tools)]],
|
58
57
|
Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
59
58
|
__validators__={
|
@@ -65,6 +64,12 @@ class BrowserToolkit(BaseToolkit):
|
|
65
64
|
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
66
65
|
if selected_tools is None:
|
67
66
|
selected_tools = []
|
67
|
+
|
68
|
+
wrapper_payload = {
|
69
|
+
**kwargs,
|
70
|
+
**kwargs.get('browser_configuration', {}),
|
71
|
+
}
|
72
|
+
|
68
73
|
tools = []
|
69
74
|
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
70
75
|
if not selected_tools:
|
@@ -88,8 +93,7 @@ class BrowserToolkit(BaseToolkit):
|
|
88
93
|
elif tool == 'google':
|
89
94
|
try:
|
90
95
|
google_api_wrapper = GoogleSearchAPIWrapper(
|
91
|
-
|
92
|
-
google_cse_id=kwargs.get("google_cse_id"),
|
96
|
+
**wrapper_payload
|
93
97
|
)
|
94
98
|
tool_entry = GoogleSearchResults(api_wrapper=google_api_wrapper)
|
95
99
|
# rename the tool to avoid conflicts
|