alita-sdk 0.3.194__py3-none-any.whl → 0.3.196__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.
@@ -286,10 +286,7 @@ class BitbucketCloudApi(BitbucketApiAbstract):
286
286
  Returns:
287
287
  List[Dict[str, Any]]: List of commits in the pull request
288
288
  """
289
- commits = self.repository.pullrequests.get(pr_id).get('commits', [])
290
- if not isinstance(commits, list):
291
- commits = list(commits)
292
- return commits
289
+ return self.repository.pullrequests.get(pr_id).get('commits', {}).get('values', [])
293
290
 
294
291
  def get_pull_request(self, pr_id: str) -> Any:
295
292
  """ Get details of a pull request
@@ -335,5 +332,5 @@ class BitbucketCloudApi(BitbucketApiAbstract):
335
332
  if inline:
336
333
  data["inline"] = inline
337
334
 
338
- response = self.repository.pullrequests.comments.post(pr_id, data=data)
339
- return response['links']['self']['href']
335
+ response = self.repository.pullrequests.get(pr_id).post("comments", data)
336
+ return response['links']['html']['href']
@@ -201,6 +201,8 @@ GetPageAttachmentsInput = create_model(
201
201
  page_id=(str, Field(description="Confluence page ID from which attachments will be retrieved")),
202
202
  max_content_length=(int, Field(default=10000, description="Maximum number of characters to return for attachment content. Content will be truncated if longer. Default is 10000.")),
203
203
  custom_prompt=(Optional[str], Field(default=None, description="Custom prompt to use for LLM-based analysis of attachments (images, pdfs, etc). If not provided, a default prompt will be used.")),
204
+ allowed_extensions=(Optional[List[str]], Field(default=None, description="List of file extensions to include (e.g. ['pdf', 'docx']). If None, all extensions are included.", examples=[["pdf", "docx"]])),
205
+ name_pattern=(Optional[str], Field(default=None, description="Regex pattern to filter attachment names (e.g. '^report_.*\\.pdf$'). If None, all names are included.", examples=["^report_.*\\.pdf$"])),
204
206
  )
205
207
 
206
208
 
@@ -1427,8 +1429,8 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
1427
1429
  stacktrace = traceback.format_exc()
1428
1430
  logger.error(f"Error processing page with images: {stacktrace}")
1429
1431
  return f"Error processing page with images: {str(e)}"
1430
-
1431
- def get_page_attachments(self, page_id: str, max_content_length: int = 10000, custom_prompt: str = None):
1432
+
1433
+ def get_page_attachments(self, page_id: str, max_content_length: int = 10000, custom_prompt: str = None, allowed_extensions: Optional[List[str]] = None, name_pattern: Optional[str] = None):
1432
1434
  """
1433
1435
  Retrieve all attachments for a Confluence page, including core metadata (with creator, created, updated), comments,
1434
1436
  file content, and LLM-based analysis for supported types.
@@ -1449,8 +1451,19 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
1449
1451
  logger.warning(f"Failed to fetch history for attachment {attachment.get('title', '')}: {str(e)}")
1450
1452
  history_map[attachment['id']] = None
1451
1453
 
1454
+ import re
1452
1455
  results = []
1453
1456
  for attachment in attachments['results']:
1457
+ title = attachment.get('title', '')
1458
+ file_ext = title.lower().split('.')[-1] if '.' in title else ''
1459
+
1460
+ # Filter by allowed_extensions
1461
+ if allowed_extensions and file_ext not in allowed_extensions:
1462
+ continue
1463
+ # Filter by name_pattern
1464
+ if name_pattern and not re.match(name_pattern, title):
1465
+ continue
1466
+
1454
1467
  media_type = attachment.get('metadata', {}).get('mediaType', '')
1455
1468
  # Core metadata extraction with history
1456
1469
  hist = history_map.get(attachment['id']) or {}
@@ -1458,7 +1471,7 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
1458
1471
  created_date = hist.get('createdDate', '') if hist else attachment.get('created', '')
1459
1472
  last_updated = hist.get('lastUpdated', {}).get('when', '') if hist else ''
1460
1473
  metadata = {
1461
- 'name': attachment.get('title', ''),
1474
+ 'name': title,
1462
1475
  'size': attachment.get('extensions', {}).get('fileSize', None),
1463
1476
  'creator': created_by,
1464
1477
  'created': created_date,
@@ -1467,6 +1480,7 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
1467
1480
  'labels': [label['name'] for label in attachment.get('metadata', {}).get('labels', {}).get('results', [])],
1468
1481
  'download_url': self.base_url.rstrip('/') + attachment['_links']['download'] if attachment.get('_links', {}).get('download') else None
1469
1482
  }
1483
+
1470
1484
  # Fetch comments for the attachment
1471
1485
  comments = []
1472
1486
  try:
@@ -1480,16 +1494,13 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
1480
1494
  'body': comment.get('body', {}).get('storage', {}).get('value', '')
1481
1495
  })
1482
1496
  except Exception as e:
1483
- logger.warning(f"Failed to fetch comments for attachment {attachment.get('title', '')}: {str(e)}")
1497
+ logger.warning(f"Failed to fetch comments for attachment {title}: {str(e)}")
1484
1498
 
1485
1499
  content = None
1486
1500
  llm_analysis = None
1487
- title = attachment.get('title', '')
1488
1501
  download_url = self.base_url.rstrip('/') + attachment['_links']['download']
1489
1502
 
1490
1503
  # --- Begin: Raw content for xml, json, markdown, txt ---
1491
- # Check by media type or file extension
1492
- file_ext = title.lower().split('.')[-1] if '.' in title else ''
1493
1504
  is_text_type = (
1494
1505
  media_type in [
1495
1506
  'application/xml', 'text/xml',
@@ -1661,7 +1672,7 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
1661
1672
  llm_analysis = self._process_image_with_llm(image_data, title, context_text, custom_prompt)
1662
1673
 
1663
1674
  if llm_analysis and isinstance(llm_analysis, str) and len(llm_analysis) > max_content_length:
1664
- llm_analysis = llm_analysis[:max_content_length] + f"\n...[truncated, showing first {max_content_length} characters]"
1675
+ llm_analysis = llm_analysis[:max_content_length] + f"\n...[truncated, showing first {max_content_length} characters]"
1665
1676
 
1666
1677
  results.append({
1667
1678
  'metadata': metadata,
@@ -44,14 +44,20 @@ class SlackToolkit(BaseToolkit):
44
44
  except SlackApiError as e:
45
45
  logger.error(f"Slack connection failed: {e.response['error']}")
46
46
  return {"success": False, "error": e.response['error']}
47
-
47
+
48
48
  model = create_model(
49
- name,
50
- slack_token=(SecretStr, Field(description="Slack Token like XOXB-*****-*****-*****-*****", json_schema_extra={'secret': True, 'configuration': True})),
51
- channel_id=(str, Field( description="Channel ID", json_schema_extra={'configuration': True})),
52
- selected_tools=(list[str], Field( description="List of tools to enable", default=[],json_schema_extra={'args_schemas': selected_tools})),
53
- __config__={'json_schema_extra': {'metadata': {"label": "Slack", "icon_url": None}}}
54
- )
49
+ name,
50
+ name=(str, Field(description="Toolkit name", json_schema_extra={'toolkit_name': True,
51
+ 'max_toolkit_length': SlackToolkit.toolkit_max_length,
52
+ 'configuration': True,
53
+ 'configuration_title': True})),
54
+ slack_token=(SecretStr, Field(description="Slack Token like XOXB-*****-*****-*****-*****",
55
+ json_schema_extra={'secret': True, 'configuration': True})),
56
+ channel_id=(str, Field(description="Channel ID", json_schema_extra={'configuration': True})),
57
+ selected_tools=(List[Literal[tuple(selected_tools)]],
58
+ Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
59
+ __config__={'json_schema_extra': {'metadata': {"label": "Slack", "icon_url": "slack-icon.svg"}}}
60
+ )
55
61
  model.check_connection = check_connection
56
62
  return model
57
63
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.194
3
+ Version: 0.3.196
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
@@ -120,7 +120,7 @@ alita_sdk/tools/base/tool.py,sha256=-N27AodZS49vdPCgFkU-bFS9bxoPopZBnNrmwInx3d0,
120
120
  alita_sdk/tools/bitbucket/__init__.py,sha256=mPdq25Ib4yP1SV4g1dgK3WD3y-lKyuaNCmcIZTo893w,4355
121
121
  alita_sdk/tools/bitbucket/api_wrapper.py,sha256=iyBaNotbjzhoAOR8WZ9Ue-8vs1J17R5BjnwR2zEbkvM,9721
122
122
  alita_sdk/tools/bitbucket/bitbucket_constants.py,sha256=UsbhQ1iEvrKoxceTFPWTYhaXS1zSxbmjs1TwY0-P4gw,462
123
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=KUAt6CB4941nJwvdJqExWedHd8kLWncu3PcAmnS960w,13279
123
+ alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=NrmLVDktqKqvb7dv8SRI-WggdEqCf2lGPxkT-B9pgms,13195
124
124
  alita_sdk/tools/bitbucket/tools.py,sha256=zKBUq7t9zLa1EvhlVZzyVcZSvwvdcbtz0oslgPFZeeo,15307
125
125
  alita_sdk/tools/browser/__init__.py,sha256=iByi9uMGjd6v44SagIPTm5fu1vWnxIkjn3xsx86uRwI,5249
126
126
  alita_sdk/tools/browser/crawler.py,sha256=jhE35dU94eQLURSM-D50tspOqEMsiGzMDbYNqNSR2mU,2279
@@ -186,7 +186,7 @@ alita_sdk/tools/code/loaders/codesearcher.py,sha256=XoXXZtIQZhvjIwZlnl_4wVGHC-3s
186
186
  alita_sdk/tools/code/sonar/__init__.py,sha256=u8wpgXJ_shToLl3G9-XEtGDor5dhmsnurIImh1-e-U0,3165
187
187
  alita_sdk/tools/code/sonar/api_wrapper.py,sha256=nNqxcWN_6W8c0ckj-Er9HkNuAdgQLoWBXh5UyzNutis,2653
188
188
  alita_sdk/tools/confluence/__init__.py,sha256=1wGSP4CjPbfpdZLsjC1SVftTV7XSvW3QCAMHuh9tIxA,6885
189
- alita_sdk/tools/confluence/api_wrapper.py,sha256=zP8S85oVulhqrom1wlgelN-TSuKtPuYxwwGAlOSn_I0,88776
189
+ alita_sdk/tools/confluence/api_wrapper.py,sha256=WgqiNanj9B5ebmaAWmUT_U_excGUWEguUEFR96K7oYg,89491
190
190
  alita_sdk/tools/confluence/loader.py,sha256=aHqgdIQMqkyRry8feHAhyd-a_ASEyW3JrV6epTRG6-c,9162
191
191
  alita_sdk/tools/confluence/utils.py,sha256=Lxo6dBD0OlvM4o0JuK6qeB_4LV9BptiwJA9e1vqNcDw,435
192
192
  alita_sdk/tools/custom_open_api/__init__.py,sha256=9aT5SPNPWcJC6jMZEM-3rUCXVULj_3-qJLQKmnreKNo,2537
@@ -270,7 +270,7 @@ alita_sdk/tools/sharepoint/__init__.py,sha256=HqKQDFboab1AYh20uJvHxs9HFLJSqVfVTj
270
270
  alita_sdk/tools/sharepoint/api_wrapper.py,sha256=qCHCIH4FRDtgdpIK22ewFhZJeOaTv9hT9BVivslxxlE,7119
271
271
  alita_sdk/tools/sharepoint/authorization_helper.py,sha256=n-nL5dlBoLMK70nHu7P2RYCb8C6c9HMA_gEaw8LxuhE,2007
272
272
  alita_sdk/tools/sharepoint/utils.py,sha256=fZ1YzAu5CTjKSZeslowpOPH974902S8vCp1Wu7L44LM,446
273
- alita_sdk/tools/slack/__init__.py,sha256=Y2sXN1__1923icF8bZbAtKVg3G_EZbCAjnj93yHUwtY,3415
273
+ alita_sdk/tools/slack/__init__.py,sha256=RfOgQqo1ImecVL3LQln2gC9dA9QowJVlAetL15vL5qo,3920
274
274
  alita_sdk/tools/slack/api_wrapper.py,sha256=dkMcS3xozEhoJ-A1ycEn6OqbIftxmVHjyYttTy3D2JI,7343
275
275
  alita_sdk/tools/sql/__init__.py,sha256=9Lh8YHKO8zD5eeolpR4O9swTUsjpXj9LVDn8fM-T5IM,3506
276
276
  alita_sdk/tools/sql/api_wrapper.py,sha256=Rky0_CX9HWDQ2mClHGAgP3LHjYVX4iymPuilZMtaDlQ,3687
@@ -297,8 +297,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw
297
297
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
298
298
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
299
299
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
300
- alita_sdk-0.3.194.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
301
- alita_sdk-0.3.194.dist-info/METADATA,sha256=OJ_VfIlIR53zBYnpZL7P5LbBiZPoD9hkBozgBPwQXGw,18804
302
- alita_sdk-0.3.194.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
303
- alita_sdk-0.3.194.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
304
- alita_sdk-0.3.194.dist-info/RECORD,,
300
+ alita_sdk-0.3.196.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
301
+ alita_sdk-0.3.196.dist-info/METADATA,sha256=kvBX1AA66R-JWkU8bVwwq_8Jt91ycYhxiXrUCXFVINQ,18804
302
+ alita_sdk-0.3.196.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
303
+ alita_sdk-0.3.196.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
304
+ alita_sdk-0.3.196.dist-info/RECORD,,