alita-sdk 0.3.257__py3-none-any.whl → 0.3.259__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/runtime/tools/vectorstore_base.py +1 -4
- alita_sdk/tools/ado/__init__.py +2 -1
- alita_sdk/tools/ado/repos/__init__.py +2 -8
- alita_sdk/tools/ado/repos/repos_wrapper.py +0 -9
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +0 -5
- alita_sdk/tools/ado/wiki/ado_wrapper.py +0 -12
- alita_sdk/tools/base_indexer_toolkit.py +16 -15
- alita_sdk/tools/chunkers/sematic/json_chunker.py +1 -1
- alita_sdk/tools/xray/__init__.py +3 -6
- alita_sdk/tools/zephyr_enterprise/api_wrapper.py +18 -13
- alita_sdk/tools/zephyr_essential/api_wrapper.py +14 -13
- alita_sdk/tools/zephyr_scale/api_wrapper.py +35 -31
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.259.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.259.dist-info}/RECORD +17 -17
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.259.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.259.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.259.dist-info}/top_level.txt +0 -0
@@ -133,7 +133,6 @@ How did you come up with the answer?
|
|
133
133
|
class VectorStoreWrapperBase(BaseToolApiWrapper):
|
134
134
|
llm: Any
|
135
135
|
embedding_model: str
|
136
|
-
embedding_model_params: dict
|
137
136
|
vectorstore_type: str
|
138
137
|
vectorstore_params: dict
|
139
138
|
max_docs_per_add: int = 100
|
@@ -158,13 +157,11 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
|
|
158
157
|
raise ValueError("Embedding model is required.")
|
159
158
|
if not values.get('vectorstore_params'):
|
160
159
|
raise ValueError("Vectorstore parameters are required.")
|
161
|
-
if not values.get('embedding_model_params'):
|
162
|
-
raise ValueError("Embedding model parameters are required.")
|
163
160
|
values["dataset"] = values.get('vectorstore_params').get('collection_name')
|
164
161
|
if not values["dataset"]:
|
165
162
|
raise ValueError("Collection name is required.")
|
166
163
|
if not values.get('embeddings'):
|
167
|
-
values['embeddings'] =
|
164
|
+
values['embeddings'] = values['alita'].get_embeddings(values['embedding_model'])
|
168
165
|
values['vectorstore'] = get_vectorstore(values['vectorstore_type'], values['vectorstore_params'], embedding_func=values['embeddings'])
|
169
166
|
values['vectoradapter'] = VectorAdapter(
|
170
167
|
vectorstore=values['vectorstore'],
|
alita_sdk/tools/ado/__init__.py
CHANGED
@@ -14,11 +14,12 @@ def get_tools(tool_type, tool):
|
|
14
14
|
"limit": tool['settings'].get('limit', 5),
|
15
15
|
"toolkit_name": tool.get('toolkit_name', ''),
|
16
16
|
# indexer settings
|
17
|
+
"alita": tool['settings'].get('alita', None),
|
17
18
|
"llm": tool['settings'].get('llm', None),
|
18
19
|
"pgvector_configuration": tool['settings'].get('pgvector_configuration', {}),
|
19
20
|
"collection_name": tool['toolkit_name'],
|
20
21
|
"doctype": 'doc',
|
21
|
-
"embedding_model": tool['settings'].get('
|
22
|
+
"embedding_model": tool['settings'].get('embedding_model'),
|
22
23
|
"vectorstore_type": "PGVector"
|
23
24
|
}
|
24
25
|
if tool_type == 'ado_plans':
|
@@ -23,10 +23,9 @@ def _get_toolkit(tool) -> BaseToolkit:
|
|
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
|
-
collection_name=tool['toolkit_name'],
|
27
|
-
doctype='code',
|
28
26
|
embedding_model=tool['settings'].get('embedding_model'),
|
29
|
-
|
27
|
+
collection_name=tool['toolkit_name'],
|
28
|
+
alita=tool['settings'].get('alita', None),
|
30
29
|
)
|
31
30
|
|
32
31
|
def get_toolkit():
|
@@ -62,11 +61,6 @@ class AzureDevOpsReposToolkit(BaseToolkit):
|
|
62
61
|
"icon_url": "ado-repos-icon.svg",
|
63
62
|
"categories": ["code repositories"],
|
64
63
|
"extra_categories": ["code", "repository", "version control"],
|
65
|
-
# "configuration_group": {
|
66
|
-
# "name": "ado_repos",
|
67
|
-
# "label": "Azure DevOps Repositories",
|
68
|
-
# "icon_url": "ado-repos-icon.svg",
|
69
|
-
# }
|
70
64
|
}}}
|
71
65
|
)
|
72
66
|
|
@@ -251,15 +251,6 @@ class ReposApiWrapper(BaseCodeToolApiWrapper):
|
|
251
251
|
token: Optional[SecretStr]
|
252
252
|
_client: Optional[GitClient] = PrivateAttr()
|
253
253
|
|
254
|
-
llm: Optional[Any] = None
|
255
|
-
# Vector store configuration
|
256
|
-
connection_string: Optional[SecretStr] = None
|
257
|
-
collection_name: Optional[str] = None
|
258
|
-
doctype: Optional[str] = 'code'
|
259
|
-
embedding_model: Optional[str] = "HuggingFaceEmbeddings"
|
260
|
-
embedding_model_params: Optional[dict] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
|
261
|
-
vectorstore_type: Optional[str] = "PGVector"
|
262
|
-
|
263
254
|
class Config:
|
264
255
|
arbitrary_types_allowed = True
|
265
256
|
|
@@ -16,11 +16,6 @@ from pydantic.fields import FieldInfo as Field
|
|
16
16
|
from ..work_item import AzureDevOpsApiWrapper
|
17
17
|
from ...elitea_base import BaseVectorStoreToolApiWrapper, extend_with_vector_tools
|
18
18
|
|
19
|
-
try:
|
20
|
-
from alita_sdk.runtime.langchain.interfaces.llm_processor import get_embeddings
|
21
|
-
except ImportError:
|
22
|
-
from alita_sdk.langchain.interfaces.llm_processor import get_embeddings
|
23
|
-
|
24
19
|
logger = logging.getLogger(__name__)
|
25
20
|
|
26
21
|
# Input models for Test Plan operations
|
@@ -17,11 +17,6 @@ from pydantic.fields import Field
|
|
17
17
|
|
18
18
|
from ...elitea_base import BaseVectorStoreToolApiWrapper, extend_with_vector_tools
|
19
19
|
|
20
|
-
try:
|
21
|
-
from alita_sdk.runtime.langchain.interfaces.llm_processor import get_embeddings
|
22
|
-
except ImportError:
|
23
|
-
from alita_sdk.langchain.interfaces.llm_processor import get_embeddings
|
24
|
-
|
25
20
|
logger = logging.getLogger(__name__)
|
26
21
|
|
27
22
|
GetWikiInput = create_model(
|
@@ -68,13 +63,6 @@ class AzureDevOpsApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
68
63
|
_client: Optional[WikiClient] = PrivateAttr() # Private attribute for the wiki client
|
69
64
|
_core_client: Optional[CoreClient] = PrivateAttr() # Private attribute for the CoreClient client
|
70
65
|
|
71
|
-
llm: Any = None
|
72
|
-
connection_string: Optional[SecretStr] = None
|
73
|
-
collection_name: Optional[str] = None
|
74
|
-
embedding_model: Optional[str] = "HuggingFaceEmbeddings"
|
75
|
-
embedding_model_params: Optional[Dict[str, Any]] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
|
76
|
-
vectorstore_type: Optional[str] = "PGVector"
|
77
|
-
|
78
66
|
class Config:
|
79
67
|
arbitrary_types_allowed = True # Allow arbitrary types (e.g., WorkItemTrackingClient)
|
80
68
|
|
@@ -5,7 +5,6 @@ from typing import Any, Optional, List, Literal, Dict, Generator
|
|
5
5
|
from langchain_core.documents import Document
|
6
6
|
from pydantic import create_model, Field, SecretStr
|
7
7
|
|
8
|
-
# from alita_sdk.runtime.langchain.interfaces.llm_processor import get_embeddings
|
9
8
|
from .utils.content_parser import process_content_by_type
|
10
9
|
from .vector_adapters.VectorStoreAdapter import VectorStoreAdapterFactory
|
11
10
|
from ..runtime.tools.vectorstore_base import VectorStoreWrapperBase
|
@@ -17,7 +16,6 @@ logger = logging.getLogger(__name__)
|
|
17
16
|
BaseIndexParams = create_model(
|
18
17
|
"BaseIndexParams",
|
19
18
|
collection_suffix=(str, Field(description="Suffix for collection name (max 7 characters) used to separate datasets", min_length=1, max_length=7)),
|
20
|
-
vectorstore_type=(Optional[str], Field(description="Vectorstore type (Chroma, PGVector, Elastic, etc.)", default="PGVector")),
|
21
19
|
)
|
22
20
|
|
23
21
|
RemoveIndexParams = create_model(
|
@@ -31,7 +29,6 @@ BaseSearchParams = create_model(
|
|
31
29
|
collection_suffix=(Optional[str], Field(
|
32
30
|
description="Optional suffix for collection name (max 7 characters). Leave empty to search across all datasets",
|
33
31
|
default="", max_length=7)),
|
34
|
-
vectorstore_type=(Optional[str], Field(description="Vectorstore type (Chroma, PGVector, Elastic, etc.)", default="PGVector")),
|
35
32
|
filter=(Optional[dict | str], Field(
|
36
33
|
description="Filter to apply to the search results. Can be a dictionary or a JSON string.",
|
37
34
|
default={},
|
@@ -61,7 +58,6 @@ BaseStepbackSearchParams = create_model(
|
|
61
58
|
"BaseStepbackSearchParams",
|
62
59
|
query=(str, Field(description="Query text to search in the index")),
|
63
60
|
collection_suffix=(Optional[str], Field(description="Optional suffix for collection name (max 7 characters)", default="", max_length=7)),
|
64
|
-
vectorstore_type=(Optional[str], Field(description="Vectorstore type (Chroma, PGVector, Elastic, etc.)", default="PGVector")),
|
65
61
|
messages=(Optional[List], Field(description="Chat messages for stepback search context", default=[])),
|
66
62
|
filter=(Optional[dict | str], Field(
|
67
63
|
description="Filter to apply to the search results. Can be a dictionary or a JSON string.",
|
@@ -108,7 +104,6 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
108
104
|
connection_string: Optional[SecretStr] = None
|
109
105
|
collection_name: Optional[str] = None
|
110
106
|
embedding_model: Optional[str] = "HuggingFaceEmbeddings"
|
111
|
-
embedding_model_params: Optional[Dict[str, Any]] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
|
112
107
|
vectorstore_type: Optional[str] = "PGVector"
|
113
108
|
_embedding: Optional[Any] = None
|
114
109
|
alita: Any = None # Elitea client, if available
|
@@ -118,10 +113,8 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
118
113
|
connection_string = conn.get_secret_value() if isinstance(conn, SecretStr) else conn
|
119
114
|
collection_name = kwargs.get('collection_name')
|
120
115
|
|
121
|
-
|
122
|
-
|
123
|
-
if 'embedding_model_params' not in kwargs:
|
124
|
-
kwargs['embedding_model_params'] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
|
116
|
+
if 'embedding_model' not in kwargs:
|
117
|
+
kwargs['embedding_model'] = 'HuggingFaceEmbeddings'
|
125
118
|
if 'vectorstore_type' not in kwargs:
|
126
119
|
kwargs['vectorstore_type'] = 'PGVector'
|
127
120
|
vectorstore_type = kwargs.get('vectorstore_type')
|
@@ -258,6 +251,16 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
258
251
|
return (f"Collection '{collection_suffix}' has been removed from the vector store.\n"
|
259
252
|
f"Available collections: {self.list_collections()}")
|
260
253
|
|
254
|
+
def _build_collection_filter(self, filter: dict | str, collection_suffix: str = "") -> dict:
|
255
|
+
"""Builds a filter for the collection based on the provided suffix."""
|
256
|
+
|
257
|
+
filter = filter if isinstance(filter, dict) else json.loads(filter)
|
258
|
+
if collection_suffix:
|
259
|
+
filter.update({"collection": {
|
260
|
+
"$eq": collection_suffix.strip()
|
261
|
+
}})
|
262
|
+
return filter
|
263
|
+
|
261
264
|
def search_index(self,
|
262
265
|
query: str,
|
263
266
|
collection_suffix: str = "",
|
@@ -269,12 +272,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
269
272
|
**kwargs):
|
270
273
|
""" Searches indexed documents in the vector store."""
|
271
274
|
# build filter on top of collection_suffix
|
272
|
-
filter =
|
273
|
-
if collection_suffix:
|
274
|
-
filter.update({"collection": {
|
275
|
-
"$eq": collection_suffix.strip()
|
276
|
-
}})
|
277
|
-
|
275
|
+
filter = self._build_collection_filter(filter, collection_suffix)
|
278
276
|
found_docs = super().search_documents(
|
279
277
|
query,
|
280
278
|
doctype=self.doctype,
|
@@ -299,6 +297,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
299
297
|
extended_search: Optional[List[str]] = None,
|
300
298
|
**kwargs):
|
301
299
|
""" Searches indexed documents in the vector store."""
|
300
|
+
filter = self._build_collection_filter(filter, collection_suffix)
|
302
301
|
found_docs = super().stepback_search(
|
303
302
|
query,
|
304
303
|
messages,
|
@@ -323,6 +322,8 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
323
322
|
extended_search: Optional[List[str]] = None,
|
324
323
|
**kwargs):
|
325
324
|
""" Generates a summary of indexed documents using stepback technique."""
|
325
|
+
|
326
|
+
filter = self._build_collection_filter(filter, collection_suffix)
|
326
327
|
return super().stepback_summary(
|
327
328
|
query,
|
328
329
|
messages,
|
@@ -9,7 +9,7 @@ def json_chunker(file_content_generator: Generator[Document, None, None], config
|
|
9
9
|
for doc in file_content_generator:
|
10
10
|
try:
|
11
11
|
data_dict = json.loads(doc.page_content)
|
12
|
-
chunks = RecursiveJsonSplitter(max_chunk_size=max_tokens).split_json(json_data=data_dict)
|
12
|
+
chunks = RecursiveJsonSplitter(max_chunk_size=max_tokens).split_json(json_data=data_dict, convert_lists=True)
|
13
13
|
if len(chunks) == 1:
|
14
14
|
yield doc
|
15
15
|
continue
|
alita_sdk/tools/xray/__init__.py
CHANGED
@@ -17,9 +17,7 @@ name = "xray_cloud"
|
|
17
17
|
def get_tools(tool):
|
18
18
|
return XrayToolkit().get_toolkit(
|
19
19
|
selected_tools=tool['settings'].get('selected_tools', []),
|
20
|
-
|
21
|
-
client_id=tool['settings'].get('client_id', None),
|
22
|
-
client_secret=tool['settings'].get('client_secret', None),
|
20
|
+
xray_configuration=tool['settings'].get('xray_configuration', {}),
|
23
21
|
limit=tool['settings'].get('limit', 20),
|
24
22
|
verify_ssl=tool['settings'].get('verify_ssl', True),
|
25
23
|
toolkit_name=tool.get('toolkit_name'),
|
@@ -29,7 +27,6 @@ def get_tools(tool):
|
|
29
27
|
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
30
28
|
embedding_model=tool['settings'].get('embedding_model'),
|
31
29
|
collection_name=str(tool['toolkit_name']),
|
32
|
-
vectorstore_type="PGVector"
|
33
30
|
).get_tools()
|
34
31
|
|
35
32
|
|
@@ -44,7 +41,7 @@ class XrayToolkit(BaseToolkit):
|
|
44
41
|
return create_model(
|
45
42
|
name,
|
46
43
|
limit=(Optional[int], Field(description="Limit", default=100)),
|
47
|
-
xray_configuration=(
|
44
|
+
xray_configuration=(XrayConfiguration, Field(description="Xray Configuration", json_schema_extra={'configuration_types': ['xray']})),
|
48
45
|
pgvector_configuration=(Optional[PgVectorConfiguration], Field(default=None,
|
49
46
|
description="PgVector Configuration",
|
50
47
|
json_schema_extra={
|
@@ -71,7 +68,7 @@ class XrayToolkit(BaseToolkit):
|
|
71
68
|
wrapper_payload = {
|
72
69
|
**kwargs,
|
73
70
|
# Use xray_configuration fields
|
74
|
-
**kwargs.get('xray_configuration'
|
71
|
+
**(kwargs.get('xray_configuration') or {}),
|
75
72
|
**(kwargs.get('pgvector_configuration') or {}),
|
76
73
|
}
|
77
74
|
xray_api_wrapper = XrayApiWrapper(**wrapper_payload)
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import logging
|
2
|
-
from
|
3
|
-
from operator import ifloordiv
|
4
|
-
from typing import Optional, List, Generator
|
2
|
+
from typing import Optional, List, Generator, Literal
|
5
3
|
|
6
4
|
from langchain_core.tools import ToolException
|
7
5
|
from pydantic import create_model, model_validator, PrivateAttr, Field, SecretStr
|
8
6
|
|
9
7
|
from langchain_core.documents import Document
|
10
8
|
from .zephyr_enterprise import ZephyrClient
|
11
|
-
from ..
|
9
|
+
from ..non_code_indexer_toolkit import NonCodeIndexerToolkit
|
10
|
+
from ..utils.available_tools_decorator import extend_with_parent_available_tools
|
12
11
|
|
13
12
|
logger = logging.getLogger(__name__)
|
14
13
|
|
@@ -23,7 +22,7 @@ zql_description = """
|
|
23
22
|
"folder=\"TestToolkit\"", "name~\"TestToolkit5\"
|
24
23
|
"""
|
25
24
|
|
26
|
-
class ZephyrApiWrapper(
|
25
|
+
class ZephyrApiWrapper(NonCodeIndexerToolkit):
|
27
26
|
base_url: str
|
28
27
|
token: SecretStr
|
29
28
|
_client: Optional[ZephyrClient] = PrivateAttr()
|
@@ -34,7 +33,7 @@ class ZephyrApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
34
33
|
base_url = values.get('base_url')
|
35
34
|
token = values.get('token')
|
36
35
|
cls._client = ZephyrClient(base_url=base_url, token=token)
|
37
|
-
return values
|
36
|
+
return super().validate_toolkit(values)
|
38
37
|
|
39
38
|
def get_test_case(self, testcase_id: str):
|
40
39
|
|
@@ -153,7 +152,8 @@ class ZephyrApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
153
152
|
Returns a list of fields for index_data args schema.
|
154
153
|
"""
|
155
154
|
return {
|
156
|
-
"zql": (str, Field(description=zql_description, examples=["folder=\"TestToolkit\"", "name~\"TestToolkit5\""]))
|
155
|
+
"zql": (str, Field(description=zql_description, examples=["folder=\"TestToolkit\"", "name~\"TestToolkit5\""])),
|
156
|
+
'chunking_tool': (Literal['json'], Field(description="Name of chunking tool", default='json'))
|
157
157
|
}
|
158
158
|
|
159
159
|
def _base_loader(self, zql: str, **kwargs) -> Generator[Document, None, None]:
|
@@ -166,12 +166,17 @@ class ZephyrApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
166
166
|
}
|
167
167
|
yield Document(page_content='', metadata=metadata)
|
168
168
|
|
169
|
-
def
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
169
|
+
def _extend_data(self, documents: Generator[Document, None, None]) -> Generator[Document, None, None]:
|
170
|
+
for document in documents:
|
171
|
+
try:
|
172
|
+
id = document.metadata['id']
|
173
|
+
test_case_content = self.get_test_case_steps(id)
|
174
|
+
document.page_content = test_case_content
|
175
|
+
except Exception as e:
|
176
|
+
logging.error(f"Failed to process document: {e}")
|
177
|
+
yield document
|
178
|
+
|
179
|
+
@extend_with_parent_available_tools
|
175
180
|
def get_available_tools(self):
|
176
181
|
return [
|
177
182
|
{
|
@@ -4,7 +4,6 @@ from typing import Optional, Generator, Literal
|
|
4
4
|
from pydantic import model_validator, create_model, Field, SecretStr, PrivateAttr
|
5
5
|
|
6
6
|
from .client import ZephyrEssentialAPI
|
7
|
-
from ..elitea_base import extend_with_vector_tools, BaseVectorStoreToolApiWrapper
|
8
7
|
from langchain_core.documents import Document
|
9
8
|
from langchain_core.tools import ToolException
|
10
9
|
|
@@ -236,8 +235,7 @@ class ZephyrEssentialApiWrapper(NonCodeIndexerToolkit):
|
|
236
235
|
|
237
236
|
def _index_tool_params(self):
|
238
237
|
return {
|
239
|
-
'chunking_tool':(Literal[
|
240
|
-
Field(description="Name of chunking tool", default='json'))
|
238
|
+
'chunking_tool':(Literal['json'], Field(description="Name of chunking tool", default='json'))
|
241
239
|
}
|
242
240
|
|
243
241
|
def _base_loader(self, **kwargs) -> Generator[Document, None, None]:
|
@@ -258,21 +256,24 @@ class ZephyrEssentialApiWrapper(NonCodeIndexerToolkit):
|
|
258
256
|
def _extend_data(self, documents: Generator[Document, None, None]) -> Generator[Document, None, None]:
|
259
257
|
for document in documents:
|
260
258
|
try:
|
261
|
-
if
|
259
|
+
if 'type' in document.metadata and document.metadata['type'] == "TEST_CASE":
|
262
260
|
additional_content = self._process_test_case(document.metadata['key'])
|
263
|
-
|
264
|
-
|
265
|
-
|
261
|
+
for steps_type, content in additional_content.items():
|
262
|
+
if content:
|
263
|
+
document.page_content = json.dumps(content)
|
264
|
+
document.metadata["steps_type"] = steps_type
|
265
|
+
except Exception as e:
|
266
|
+
logging.error(f"Failed to process document: {e}")
|
266
267
|
yield document
|
267
268
|
|
268
|
-
def _process_test_case(self, key):
|
269
|
+
def _process_test_case(self, key) -> dict:
|
269
270
|
steps = self.get_test_case_test_steps(key)
|
271
|
+
if steps and not isinstance(steps, ToolException):
|
272
|
+
return {"steps": steps}
|
270
273
|
script = self.get_test_case_test_script(key)
|
271
|
-
|
272
|
-
"
|
273
|
-
|
274
|
-
}
|
275
|
-
return additional_content
|
274
|
+
if script and not isinstance(script, ToolException):
|
275
|
+
return {"script": script}
|
276
|
+
return {"empty": ""}
|
276
277
|
|
277
278
|
@extend_with_parent_available_tools
|
278
279
|
def get_available_tools(self):
|
@@ -1,15 +1,18 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
3
|
import re
|
4
|
-
from typing import Any, Optional, List, Dict, Tuple, Union, Generator
|
4
|
+
from typing import Any, Optional, List, Dict, Tuple, Union, Generator, Literal
|
5
5
|
|
6
6
|
from pydantic import model_validator, BaseModel, SecretStr
|
7
7
|
from langchain_core.tools import ToolException
|
8
8
|
from pydantic import create_model, PrivateAttr
|
9
9
|
from pydantic.fields import Field
|
10
10
|
|
11
|
-
from ..elitea_base import BaseVectorStoreToolApiWrapper, BaseIndexParams, extend_with_vector_tools
|
12
11
|
from langchain_core.documents import Document
|
12
|
+
|
13
|
+
from ..non_code_indexer_toolkit import NonCodeIndexerToolkit
|
14
|
+
from ..utils.available_tools_decorator import extend_with_parent_available_tools
|
15
|
+
|
13
16
|
try:
|
14
17
|
from alita_sdk.runtime.langchain.interfaces.llm_processor import get_embeddings
|
15
18
|
except ImportError:
|
@@ -249,7 +252,7 @@ ZephyrUpdateTestSteps = create_model(
|
|
249
252
|
)
|
250
253
|
|
251
254
|
|
252
|
-
class ZephyrScaleApiWrapper(
|
255
|
+
class ZephyrScaleApiWrapper(NonCodeIndexerToolkit):
|
253
256
|
# url for a Zephyr server
|
254
257
|
base_url: Optional[str] = ""
|
255
258
|
# auth with Jira token (cloud & server)
|
@@ -296,7 +299,7 @@ class ZephyrScaleApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
296
299
|
# else:
|
297
300
|
# Cloud version is enabled for now
|
298
301
|
cls._api = ZephyrScale(token=values['token']).api
|
299
|
-
return values
|
302
|
+
return super().validate_toolkit(values)
|
300
303
|
|
301
304
|
def get_tests(self, project_key: str = None, folder_id: str = None, maxResults: Optional[int] = 10, startAt: Optional[int] = 0):
|
302
305
|
"""Retrieves all test cases. Query parameters can be used to filter the results.
|
@@ -1210,7 +1213,8 @@ class ZephyrScaleApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
1210
1213
|
|
1211
1214
|
Example:
|
1212
1215
|
'folder = "Authentication" AND label in ("Smoke", "Critical") AND text ~ "login" AND orderBy = "name" AND orderDirection = "ASC"'
|
1213
|
-
"""))
|
1216
|
+
""")),
|
1217
|
+
'chunking_tool': (Literal['json'], Field(description="Name of chunking tool", default='json'))
|
1214
1218
|
}
|
1215
1219
|
|
1216
1220
|
def _base_loader(self, project_key: str, jql: str, **kwargs) -> Generator[Document, None, None]:
|
@@ -1250,8 +1254,8 @@ class ZephyrScaleApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
1250
1254
|
for key, value in folder.items():
|
1251
1255
|
if value is not None:
|
1252
1256
|
metadata[key] = value
|
1253
|
-
|
1254
|
-
yield Document(page_content=
|
1257
|
+
metadata['type'] = "FOLDER"
|
1258
|
+
yield Document(page_content="", metadata=metadata)
|
1255
1259
|
|
1256
1260
|
def _get_test_cases_docs(self, project_key: str, jql: str) -> Generator[Document, None, None]:
|
1257
1261
|
try:
|
@@ -1269,31 +1273,31 @@ class ZephyrScaleApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
1269
1273
|
metadata['updated_on'] = last_version['createdOn']
|
1270
1274
|
else:
|
1271
1275
|
metadata['updated_on'] = case['createdOn']
|
1276
|
+
metadata['type'] = "TEST_CASE"
|
1272
1277
|
|
1273
|
-
|
1274
|
-
|
1275
|
-
yield Document(page_content=json.dumps(case), metadata=metadata)
|
1276
|
-
|
1277
|
-
def _process_document(self, document: Document) -> Generator[Document, None, None]:
|
1278
|
-
try:
|
1279
|
-
base_data = json.loads(document.page_content)
|
1280
|
-
|
1281
|
-
if base_data['type'] and base_data['type'] == "TEST_CASE":
|
1282
|
-
additional_content = self._process_test_case(base_data)
|
1283
|
-
base_data['test_case_content'] = additional_content
|
1278
|
+
yield Document(page_content="", metadata=metadata)
|
1284
1279
|
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1280
|
+
def _extend_data(self, documents: Generator[Document, None, None]) -> Generator[Document, None, None]:
|
1281
|
+
for document in documents:
|
1282
|
+
try:
|
1283
|
+
if 'type' in document.metadata and document.metadata['type'] == "TEST_CASE":
|
1284
|
+
additional_content = self._process_test_case(document.metadata['key'])
|
1285
|
+
for steps_type, content in additional_content.items():
|
1286
|
+
if content:
|
1287
|
+
document.page_content = json.dumps(content)
|
1288
|
+
document.metadata["steps_type"] = steps_type
|
1289
|
+
except Exception as e:
|
1290
|
+
logging.error(f"Failed to process document: {e}")
|
1291
|
+
yield document
|
1292
|
+
|
1293
|
+
def _process_test_case(self, key):
|
1294
|
+
steps = self.get_test_steps(key, return_list=True)
|
1295
|
+
if steps and not isinstance(steps, ToolException):
|
1296
|
+
return {"steps": steps}
|
1297
|
+
script = self.get_test_script(key, return_only_script=True)
|
1298
|
+
if script and not isinstance(script, ToolException):
|
1299
|
+
return {"script": script}
|
1300
|
+
return {"empty": ""}
|
1297
1301
|
|
1298
1302
|
def get_tests_recursive(self, project_key: str = None, folder_id: str = None, maxResults: Optional[int] = 100, startAt: Optional[int] = 0):
|
1299
1303
|
"""Retrieves all test cases recursively from a folder and all its subfolders.
|
@@ -1552,7 +1556,7 @@ class ZephyrScaleApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
1552
1556
|
except Exception as e:
|
1553
1557
|
return ToolException(f"Error updating test steps for test case {test_case_key}: {str(e)}")
|
1554
1558
|
|
1555
|
-
@
|
1559
|
+
@extend_with_parent_available_tools
|
1556
1560
|
def get_available_tools(self):
|
1557
1561
|
return [
|
1558
1562
|
{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.259
|
4
4
|
Summary: SDK for building langchain agents using resources from Alita
|
5
5
|
Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -107,7 +107,7 @@ alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9
|
|
107
107
|
alita_sdk/runtime/tools/router.py,sha256=wCvZjVkdXK9dMMeEerrgKf5M790RudH68pDortnHSz0,1517
|
108
108
|
alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
|
109
109
|
alita_sdk/runtime/tools/vectorstore.py,sha256=yl6FKJGVQDevftSkxWTkMbqjIskIFz69vXELdEGp9u4,34780
|
110
|
-
alita_sdk/runtime/tools/vectorstore_base.py,sha256=
|
110
|
+
alita_sdk/runtime/tools/vectorstore_base.py,sha256=Ko-82amS4mBoJqX-v6h-iUrQ5LNzMvM978q2i8TcfVw,27409
|
111
111
|
alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
|
112
112
|
alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
113
|
alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
|
@@ -119,17 +119,17 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
|
|
119
119
|
alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
|
120
120
|
alita_sdk/runtime/utils/utils.py,sha256=CpEl3LCeLbhzQySz08lkKPm7Auac6IiLF7WB8wmArMI,589
|
121
121
|
alita_sdk/tools/__init__.py,sha256=ko5TToGYZFmBrho26DRAVvrkHWxQ2sfs8gVAASinYp8,10611
|
122
|
-
alita_sdk/tools/base_indexer_toolkit.py,sha256=
|
122
|
+
alita_sdk/tools/base_indexer_toolkit.py,sha256=UVaTzYkWEvH9LLTaxOEOUtU98CAhcXko9uvFZjhRYd0,17957
|
123
123
|
alita_sdk/tools/elitea_base.py,sha256=PfelIUb5YFTjDN_1jNYT9tJbjfYr11PAUrPQHyW2d5I,32830
|
124
124
|
alita_sdk/tools/non_code_indexer_toolkit.py,sha256=v9uq1POE1fQKCd152mbqDtF-HSe0qoDj83k4E5LAkMI,1080
|
125
|
-
alita_sdk/tools/ado/__init__.py,sha256=
|
125
|
+
alita_sdk/tools/ado/__init__.py,sha256=u2tdDgufGuDb-7lIgKKQlqgStL9Wd1gzNmRNYems2c0,1267
|
126
126
|
alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
|
127
|
-
alita_sdk/tools/ado/repos/__init__.py,sha256=
|
128
|
-
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=
|
127
|
+
alita_sdk/tools/ado/repos/__init__.py,sha256=n-IhKED05RwQGWT4LfCaxJ85uDyG4S9zTjSjK6A8N4o,5192
|
128
|
+
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=e3bGsM03m0UggSQfoVh5Gg_M1MYt_BTKS-s9G2Unc1k,49739
|
129
129
|
alita_sdk/tools/ado/test_plan/__init__.py,sha256=4fEw_3cm4shuZ868HhAU-uMH3xNXPyb3uRjyNWoBKls,5243
|
130
|
-
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=
|
130
|
+
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=57nYl-F4OPDwZu-amg9ptG0Z4iAYMBobcKlrbGgSAg8,20079
|
131
131
|
alita_sdk/tools/ado/wiki/__init__.py,sha256=uBKo_Meu2ZxMxcxGsMmvCXyplRE2um1_PIRvdYd37rM,5171
|
132
|
-
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=
|
132
|
+
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=YfumbP0lI04hXWY01P9f-q9JBWuQRaeIJEvYDpcZnu0,14238
|
133
133
|
alita_sdk/tools/ado/work_item/__init__.py,sha256=HNcdIMwTSNe-25_Pg-KmVVXTFci3vNa84tkTFkls36c,5373
|
134
134
|
alita_sdk/tools/ado/work_item/ado_wrapper.py,sha256=uPhDp2zC8t42FQk7xc7gNyYs2o-hfOxsrw_rw31f7Sw,28223
|
135
135
|
alita_sdk/tools/advanced_jira_mining/__init__.py,sha256=pUTzECqGvYaR5qWY3JPUhrImrZgc7pCXuqSe5eWIE80,4604
|
@@ -194,7 +194,7 @@ alita_sdk/tools/chunkers/code/treesitter/treesitter_rs.py,sha256=LgKyNffBy30gIr8
|
|
194
194
|
alita_sdk/tools/chunkers/code/treesitter/treesitter_ts.py,sha256=Qs1a_BBN296iZc5hh8UNF9sc0G0-A_XZVhP3Na1ZNDg,387
|
195
195
|
alita_sdk/tools/chunkers/sematic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
196
196
|
alita_sdk/tools/chunkers/sematic/base.py,sha256=bRHpCFbOy-KPe4HBGpegrvIhvOsd7sDRfmb06T8tSuU,349
|
197
|
-
alita_sdk/tools/chunkers/sematic/json_chunker.py,sha256=
|
197
|
+
alita_sdk/tools/chunkers/sematic/json_chunker.py,sha256=wzlGeoS4qZOQA6Alcc0sn6zAxZSGVdwCLm0wHqmMODA,1038
|
198
198
|
alita_sdk/tools/chunkers/sematic/markdown_chunker.py,sha256=HmAGKuIodnMcHl-kBwAb1NY0GKKwAskRFvGaW3m4HAM,3859
|
199
199
|
alita_sdk/tools/chunkers/sematic/proposal_chunker.py,sha256=t8JjX9TH6yHXXaemiDK1E6000tlES2Kl8XfyezmlIoo,5116
|
200
200
|
alita_sdk/tools/chunkers/sematic/statistical_chunker.py,sha256=VDQcMC-ky72GqdWJiHMmcRmfJTTU5XglBF1IWg2Qews,13403
|
@@ -317,7 +317,7 @@ alita_sdk/tools/utils/available_tools_decorator.py,sha256=IbrdfeQkswxUFgvvN7-dyL
|
|
317
317
|
alita_sdk/tools/utils/content_parser.py,sha256=zqeyuxZqZqVFq5M5sZM-falMdlOw48FyZnp3Z0XUpCw,9868
|
318
318
|
alita_sdk/tools/vector_adapters/VectorStoreAdapter.py,sha256=a6FAsiix_EvATIKUf5YT6vHh5LDyJ5uSP3LJqoxFo04,17367
|
319
319
|
alita_sdk/tools/vector_adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
320
|
-
alita_sdk/tools/xray/__init__.py,sha256=
|
320
|
+
alita_sdk/tools/xray/__init__.py,sha256=BnG2StSfX44CUMtrjHTcSCDWxxse5tCZqwyaZSkBKIc,4230
|
321
321
|
alita_sdk/tools/xray/api_wrapper.py,sha256=A8PJmY2k7TowaD_vk6ZxkMnSUoZUt9A6g4TJrZfNTAw,32225
|
322
322
|
alita_sdk/tools/yagmail/__init__.py,sha256=c4Qn3em0tLxzRmFKpzbBgY9W2EnOoKf0azoDJHng5CY,2208
|
323
323
|
alita_sdk/tools/yagmail/yagmail_wrapper.py,sha256=SKoGVd1X4Ew3ad5tOdtPoY00M6jStNdT3q7GXEjQc5g,1952
|
@@ -326,18 +326,18 @@ alita_sdk/tools/zephyr/__init__.py,sha256=8B2Ibz5QTmB5WkV0q8Sq4kuj92FFaFWZLrT877
|
|
326
326
|
alita_sdk/tools/zephyr/api_wrapper.py,sha256=lJCYPG03ej0qgdpLflnS7LFB4HSAfGzIvTjAJt07CQs,6244
|
327
327
|
alita_sdk/tools/zephyr/rest_client.py,sha256=7vSD3oYIX-3KbAFed-mphSQif_VRuXrq5O07ryNQ7Pk,6208
|
328
328
|
alita_sdk/tools/zephyr_enterprise/__init__.py,sha256=1E0xuyYx7QSuqIRKclEapI7MvxXjJ3Lwf4YpDXPzehw,4087
|
329
|
-
alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=
|
329
|
+
alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=km2TYNu5ppRkspN1PyYetu6iBGj-xKVIwGHty1r_wAw,11552
|
330
330
|
alita_sdk/tools/zephyr_enterprise/zephyr_enterprise.py,sha256=hV9LIrYfJT6oYp-ZfQR0YHflqBFPsUw2Oc55HwK0H48,6809
|
331
331
|
alita_sdk/tools/zephyr_essential/__init__.py,sha256=BpRicA38JI9YEDuim1acZRGcDw-ZYTdP4Ewbiju37h8,3761
|
332
|
-
alita_sdk/tools/zephyr_essential/api_wrapper.py,sha256=
|
332
|
+
alita_sdk/tools/zephyr_essential/api_wrapper.py,sha256=WZvtC_CLVZxwsLWITOGZpFqPWp3JgzCVtYmmq__vU5c,37237
|
333
333
|
alita_sdk/tools/zephyr_essential/client.py,sha256=bfNcUKNqj9MFWTludGbbqD4qZlxrBaC2JtWsCfZMqSY,9722
|
334
334
|
alita_sdk/tools/zephyr_scale/__init__.py,sha256=imuHOqdyOqtxQObeBZfyFvKPXfKVNuYfwKn2c9jJyeo,4299
|
335
|
-
alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=
|
335
|
+
alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=HOt9ShtJI_1tVPcwd3Rwk-VS0SMLqcPNYbN1wqfeuhc,78330
|
336
336
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
|
337
337
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
338
338
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
339
|
-
alita_sdk-0.3.
|
340
|
-
alita_sdk-0.3.
|
341
|
-
alita_sdk-0.3.
|
342
|
-
alita_sdk-0.3.
|
343
|
-
alita_sdk-0.3.
|
339
|
+
alita_sdk-0.3.259.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
340
|
+
alita_sdk-0.3.259.dist-info/METADATA,sha256=lBTvY6hboPwAenhkT8gMg7Ju-inMo4_I8sF5IQTUTOM,18897
|
341
|
+
alita_sdk-0.3.259.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
342
|
+
alita_sdk-0.3.259.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
343
|
+
alita_sdk-0.3.259.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|