ziya 0.1.4__tar.gz → 0.1.6__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.
- {ziya-0.1.4 → ziya-0.1.6}/PKG-INFO +1 -1
- ziya-0.1.6/app/main.py +90 -0
- ziya-0.1.6/app/utils/langchain_validation_util.py +16 -0
- ziya-0.1.6/app/utils/version_util.py +23 -0
- {ziya-0.1.4 → ziya-0.1.6}/pyproject.toml +1 -1
- ziya-0.1.4/app/main.py +0 -38
- {ziya-0.1.4 → ziya-0.1.6}/LICENSE +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/README.md +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/__init__.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/agents/__init__.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/agents/agent.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/agents/prompts.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/server.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/utils/__init__.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/utils/directory_util.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/utils/gitignore_parser.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/utils/logging_utils.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/app/utils/print_tree_util.py +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/static/app.js +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/static/favicon.ico +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/static/sendPayload.js +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/static/ziya.css +0 -0
- {ziya-0.1.4 → ziya-0.1.6}/templates/index.html +0 -0
ziya-0.1.6/app/main.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import os
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
from langchain_cli.cli import serve
|
|
8
|
+
|
|
9
|
+
from app.utils.logging_utils import logger
|
|
10
|
+
from app.utils.langchain_validation_util import validate_langchain_vars
|
|
11
|
+
from app.utils.version_util import get_current_version, get_latest_version
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def parse_arguments():
|
|
15
|
+
parser = argparse.ArgumentParser(description="Run with custom options")
|
|
16
|
+
parser.add_argument("--exclude", default=[], type=lambda x: x.split(','),
|
|
17
|
+
help="List of files or directories to exclude (e.g., --exclude 'tst,build,*.py')")
|
|
18
|
+
parser.add_argument("--include", default=[], type=lambda x: x.split(','),
|
|
19
|
+
help="List of directories to include (e.g., --include 'src,static'). Only directories for now")
|
|
20
|
+
parser.add_argument("--profile", type=str, default=None,
|
|
21
|
+
help="AWS profile to use (e.g., --profile ziya)")
|
|
22
|
+
parser.add_argument("--model", type=str, choices=["sonnet", "haiku", "opus"], default="sonnet",
|
|
23
|
+
help="AWS Bedrock Model to use (e.g., --model sonnet)")
|
|
24
|
+
parser.add_argument("--port", type=int, default=6969,
|
|
25
|
+
help="Port number to run Ziya frontend on (e.g., --port 8080)")
|
|
26
|
+
parser.add_argument("--version", action="store_true",
|
|
27
|
+
help="Prints the version of Ziya")
|
|
28
|
+
return parser.parse_args()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def setup_environment(args):
|
|
32
|
+
os.environ["ZIYA_USER_CODEBASE_DIR"] = os.getcwd()
|
|
33
|
+
|
|
34
|
+
additional_excluded_dirs = ','.join(args.exclude)
|
|
35
|
+
os.environ["ZIYA_ADDITIONAL_EXCLUDE_DIRS"] = additional_excluded_dirs
|
|
36
|
+
|
|
37
|
+
additional_included_dirs = ','.join(args.include)
|
|
38
|
+
os.environ["ZIYA_ADDITIONAL_INCLUDE_DIRS"] = additional_included_dirs
|
|
39
|
+
|
|
40
|
+
if args.profile:
|
|
41
|
+
os.environ["ZIYA_AWS_PROFILE"] = args.profile
|
|
42
|
+
if args.model:
|
|
43
|
+
os.environ["ZIYA_AWS_MODEL"] = args.model
|
|
44
|
+
|
|
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__)))
|
|
73
|
+
serve(port=args.port)
|
|
74
|
+
|
|
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
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
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)
|
|
@@ -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() -> None:
|
|
18
|
+
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'ziya'])
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_current_version() -> str:
|
|
22
|
+
from importlib.metadata import version
|
|
23
|
+
return str(version('ziya'))
|
ziya-0.1.4/app/main.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from langchain_cli.cli import serve
|
|
3
|
-
import argparse
|
|
4
|
-
|
|
5
|
-
def main():
|
|
6
|
-
os.environ["ZIYA_USER_CODEBASE_DIR"] = os.getcwd()
|
|
7
|
-
|
|
8
|
-
parser = argparse.ArgumentParser(description="Run with custom options")
|
|
9
|
-
parser.add_argument("--exclude", default=[], type=lambda x: x.split(','),
|
|
10
|
-
help="List of files or directories to exclude (e.g., --exclude 'tst,build,*.py')")
|
|
11
|
-
parser.add_argument("--include", default=[], type=lambda x: x.split(','),
|
|
12
|
-
help="List of directories to include (e.g., --include 'src,static'). Only directories for now")
|
|
13
|
-
parser.add_argument("--profile", type=str, default=None,
|
|
14
|
-
help="AWS profile to use (e.g., --profile ziya)")
|
|
15
|
-
parser.add_argument("--model", type=str, choices=["sonnet", "haiku", "opus"], default="sonnet",
|
|
16
|
-
help="AWS Bedrock Model to use (e.g., --model sonnet)")
|
|
17
|
-
parser.add_argument("--port", type=int, default=6969,
|
|
18
|
-
help="Port number to run Ziya frontend on (e.g., --port 8080)")
|
|
19
|
-
args = parser.parse_args()
|
|
20
|
-
|
|
21
|
-
additional_excluded_dirs = ','.join([item for item in args.exclude])
|
|
22
|
-
os.environ["ZIYA_ADDITIONAL_EXCLUDE_DIRS"] = additional_excluded_dirs
|
|
23
|
-
|
|
24
|
-
additional_included_dirs = ','.join([item for item in args.include])
|
|
25
|
-
os.environ["ZIYA_ADDITIONAL_INCLUDE_DIRS"] = additional_included_dirs
|
|
26
|
-
|
|
27
|
-
if args.profile:
|
|
28
|
-
os.environ["ZIYA_AWS_PROFILE"] = args.profile
|
|
29
|
-
if args.model:
|
|
30
|
-
os.environ["ZIYA_AWS_MODEL"] = args.model
|
|
31
|
-
|
|
32
|
-
langchain_serve_directory = os.path.dirname(os.path.abspath(__file__))
|
|
33
|
-
os.chdir(langchain_serve_directory)
|
|
34
|
-
serve(port=args.port)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if __name__ == "__main__":
|
|
38
|
-
main()
|
|
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
|
|
File without changes
|