ziya 0.1.3__tar.gz → 0.1.5__tar.gz

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.

Potentially problematic release.


This version of ziya might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ziya
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary:
5
5
  Author: Vishnu Krishnaprasad
6
6
  Author-email: vishnukool@gmail.com
@@ -1,4 +1,6 @@
1
1
  import os
2
+ import botocore
3
+
2
4
  from typing import Generator, List, Tuple, Set, Union
3
5
 
4
6
  import tiktoken
@@ -38,6 +40,9 @@ model = ChatBedrock(
38
40
  model_id=model_id,
39
41
  model_kwargs={"max_tokens": 4096},
40
42
  credentials_profile_name=aws_profile if aws_profile else None,
43
+ config=botocore.config.Config(
44
+ read_timeout=900
45
+ )
41
46
  )
42
47
 
43
48
 
@@ -1,7 +1,25 @@
1
1
  import os
2
+ import subprocess
3
+ import sys
4
+ from typing import Optional
5
+
2
6
  from langchain_cli.cli import serve
3
7
  import argparse
4
8
 
9
+ from app.utils.logging_utils import logger
10
+ from app.utils.version_util import get_current_version, get_latest_version
11
+
12
+
13
+ def update_package(current_version: str, latest_version: Optional[str]) -> None:
14
+ try:
15
+ logger.info(f"Updating ziya from {current_version} to {latest_version}")
16
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'ziya'])
17
+ logger.info("Update completed. Next time you run ziya it will be with the latest version.")
18
+
19
+ except Exception as e:
20
+ logger.info(f"Unexpected error upgrading ziya: {e}")
21
+
22
+
5
23
  def main():
6
24
  os.environ["ZIYA_USER_CODEBASE_DIR"] = os.getcwd()
7
25
 
@@ -12,12 +30,26 @@ def main():
12
30
  help="List of directories to include (e.g., --include 'src,static'). Only directories for now")
13
31
  parser.add_argument("--profile", type=str, default=None,
14
32
  help="AWS profile to use (e.g., --profile ziya)")
15
- parser.add_argument("--model", type=str, choices=["sonnet", "haiku", "opus"], default="haiku",
33
+ parser.add_argument("--model", type=str, choices=["sonnet", "haiku", "opus"], default="sonnet",
16
34
  help="AWS Bedrock Model to use (e.g., --model sonnet)")
17
35
  parser.add_argument("--port", type=int, default=6969,
18
36
  help="Port number to run Ziya frontend on (e.g., --port 8080)")
37
+ parser.add_argument("--version", action="store_true",
38
+ help="Prints the version of Ziya")
19
39
  args = parser.parse_args()
20
40
 
41
+ current_version = get_current_version()
42
+ latest_version = get_latest_version()
43
+
44
+ if args.version:
45
+ print(f"Ziya version {current_version}")
46
+ return
47
+
48
+ if latest_version and current_version != latest_version:
49
+ update_package(current_version, latest_version)
50
+ else:
51
+ logger.info(f"Ziya version {current_version} is up to date.")
52
+
21
53
  additional_excluded_dirs = ','.join([item for item in args.exclude])
22
54
  os.environ["ZIYA_ADDITIONAL_EXCLUDE_DIRS"] = additional_excluded_dirs
23
55
 
@@ -35,4 +67,4 @@ def main():
35
67
 
36
68
 
37
69
  if __name__ == "__main__":
38
- main()
70
+ main()
@@ -51,7 +51,11 @@ def get_complete_file_list(user_codebase_dir: str, ignored_patterns: List[str],
51
51
 
52
52
  for file in files:
53
53
  file_path = os.path.join(root, file)
54
- if not should_ignore(file_path):
54
+ if not should_ignore(file_path) and not is_image_file(file_path):
55
55
  file_set.add(file_path)
56
56
 
57
57
  return list(file_set)
58
+
59
+ def is_image_file(file_path: str) -> bool:
60
+ image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.svg', '.ico']
61
+ return any(file_path.lower().endswith(ext) for ext in image_extensions)
@@ -0,0 +1,23 @@
1
+ import requests
2
+ from packaging import version
3
+ import subprocess
4
+ import sys
5
+ from typing import Optional
6
+
7
+
8
+ def get_latest_version() -> Optional[str]:
9
+ try:
10
+ response = requests.get('https://pypi.org/pypi/ziya/json')
11
+ response.raise_for_status()
12
+ return str(version.parse(response.json()['info']['version']))
13
+ except requests.exceptions.RequestException:
14
+ return None
15
+
16
+
17
+ def update_package(package_name: str) -> None:
18
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', package_name])
19
+
20
+
21
+ def get_current_version() -> str:
22
+ from importlib.metadata import version
23
+ return str(version('ziya'))
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ziya"
3
- version = "0.1.3"
3
+ version = "0.1.5"
4
4
  description = ""
5
5
  authors = ["Vishnu Krishnaprasad <vishnukool@gmail.com>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes