ziya 0.1.5__tar.gz → 0.1.7__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.5
3
+ Version: 0.1.7
4
4
  Summary:
5
5
  Author: Vishnu Krishnaprasad
6
6
  Author-email: vishnukool@gmail.com
@@ -38,7 +38,7 @@ logger.info(f"Using Claude Model: {model_id}")
38
38
 
39
39
  model = ChatBedrock(
40
40
  model_id=model_id,
41
- model_kwargs={"max_tokens": 4096},
41
+ model_kwargs={"max_tokens": 4096, "temperature": 0.3, "top_k": 15},
42
42
  credentials_profile_name=aws_profile if aws_profile else None,
43
43
  config=botocore.config.Config(
44
44
  read_timeout=900
@@ -1,28 +1,17 @@
1
+ import argparse
1
2
  import os
2
3
  import subprocess
3
4
  import sys
4
5
  from typing import Optional
5
6
 
6
7
  from langchain_cli.cli import serve
7
- import argparse
8
8
 
9
9
  from app.utils.logging_utils import logger
10
+ from app.utils.langchain_validation_util import validate_langchain_vars
10
11
  from app.utils.version_util import get_current_version, get_latest_version
11
12
 
12
13
 
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
-
23
- def main():
24
- os.environ["ZIYA_USER_CODEBASE_DIR"] = os.getcwd()
25
-
14
+ def parse_arguments():
26
15
  parser = argparse.ArgumentParser(description="Run with custom options")
27
16
  parser.add_argument("--exclude", default=[], type=lambda x: x.split(','),
28
17
  help="List of files or directories to exclude (e.g., --exclude 'tst,build,*.py')")
@@ -31,29 +20,21 @@ def main():
31
20
  parser.add_argument("--profile", type=str, default=None,
32
21
  help="AWS profile to use (e.g., --profile ziya)")
33
22
  parser.add_argument("--model", type=str, choices=["sonnet", "haiku", "opus"], default="sonnet",
34
- help="AWS Bedrock Model to use (e.g., --model sonnet)")
23
+ help="AWS Bedrock Model to use (e.g., --model sonnet)")
35
24
  parser.add_argument("--port", type=int, default=6969,
36
25
  help="Port number to run Ziya frontend on (e.g., --port 8080)")
37
26
  parser.add_argument("--version", action="store_true",
38
27
  help="Prints the version of Ziya")
39
- args = parser.parse_args()
28
+ return parser.parse_args()
40
29
 
41
- current_version = get_current_version()
42
- latest_version = get_latest_version()
43
30
 
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.")
31
+ def setup_environment(args):
32
+ os.environ["ZIYA_USER_CODEBASE_DIR"] = os.getcwd()
52
33
 
53
- additional_excluded_dirs = ','.join([item for item in args.exclude])
34
+ additional_excluded_dirs = ','.join(args.exclude)
54
35
  os.environ["ZIYA_ADDITIONAL_EXCLUDE_DIRS"] = additional_excluded_dirs
55
36
 
56
- additional_included_dirs = ','.join([item for item in args.include])
37
+ additional_included_dirs = ','.join(args.include)
57
38
  os.environ["ZIYA_ADDITIONAL_INCLUDE_DIRS"] = additional_included_dirs
58
39
 
59
40
  if args.profile:
@@ -61,10 +42,49 @@ def main():
61
42
  if args.model:
62
43
  os.environ["ZIYA_AWS_MODEL"] = args.model
63
44
 
64
- langchain_serve_directory = os.path.dirname(os.path.abspath(__file__))
65
- os.chdir(langchain_serve_directory)
45
+
46
+ def check_version_and_upgrade():
47
+ current_version = get_current_version()
48
+ latest_version = get_latest_version()
49
+
50
+ if latest_version and current_version != latest_version:
51
+ update_package(current_version, latest_version)
52
+ else:
53
+ logger.info(f"Ziya version {current_version} is up to date.")
54
+
55
+
56
+ def update_package(current_version: str, latest_version: Optional[str]) -> None:
57
+ try:
58
+ logger.info(f"Updating ziya from {current_version} to {latest_version}")
59
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'ziya'])
60
+ logger.info("Update completed. Next time you run ziya it will be with the latest version.")
61
+
62
+ except Exception as e:
63
+ logger.info(f"Unexpected error upgrading ziya: {e}")
64
+
65
+
66
+ def print_version():
67
+ current_version = get_current_version()
68
+ print(f"Ziya version {current_version}")
69
+
70
+
71
+ def start_server(args):
72
+ os.chdir(os.path.dirname(os.path.abspath(__file__)))
66
73
  serve(port=args.port)
67
74
 
68
75
 
76
+ def main():
77
+ args = parse_arguments()
78
+
79
+ if args.version:
80
+ print_version()
81
+ return
82
+
83
+ check_version_and_upgrade()
84
+ validate_langchain_vars()
85
+ setup_environment(args)
86
+ start_server(args)
87
+
88
+
69
89
  if __name__ == "__main__":
70
90
  main()
@@ -0,0 +1,16 @@
1
+ import os
2
+ import sys
3
+
4
+ from app.utils.logging_utils import logger
5
+
6
+
7
+ def validate_langchain_vars():
8
+ langchain_vars = [var for var in os.environ if var.startswith("LANGCHAIN_")]
9
+ if langchain_vars:
10
+ logger.error("Langchain environment variables are set:")
11
+ for var in langchain_vars:
12
+ logger.error(f"- {var}")
13
+ logger.error(
14
+ "To prevent accidentally sending confidential code to a 3rd party, please unset these variables before "
15
+ "running Ziya.")
16
+ sys.exit(1)
@@ -14,8 +14,8 @@ def get_latest_version() -> Optional[str]:
14
14
  return None
15
15
 
16
16
 
17
- def update_package(package_name: str) -> None:
18
- subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', package_name])
17
+ def update_package() -> None:
18
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'ziya'])
19
19
 
20
20
 
21
21
  def get_current_version() -> str:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ziya"
3
- version = "0.1.5"
3
+ version = "0.1.7"
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
File without changes