wizelit-sdk 0.1.30__tar.gz → 0.1.31__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.
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/PKG-INFO +1 -1
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/pyproject.toml +1 -1
- wizelit_sdk-0.1.31/src/wizelit_sdk/__init__.py +47 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/agent_wrapper/agent_wrapper.py +7 -1
- wizelit_sdk-0.1.31/src/wizelit_sdk/exceptions.py +206 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/uv.lock +1 -1
- wizelit_sdk-0.1.30/src/wizelit_sdk/__init__.py +0 -11
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/.editorconfig +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/.env.template +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/.gitignore +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/CHANGELOG.md +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/INITIALIZATION_INSTRUCTION.MD +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/Makefile +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/README.md +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/activate.sh +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/pyrightconfig.json +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/__init__.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/agent_wrapper/__init__.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/agent_wrapper/job.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/agent_wrapper/signature_validation.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/agent_wrapper/streaming.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/database.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/models/__init__.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/models/base.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/models/job.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/tests/test_agent_wrapper_import.py +0 -0
- {wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/tests/test_utils.py +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Wizelit SDK package."""
|
|
2
|
+
|
|
3
|
+
from wizelit_sdk.agent_wrapper import WizelitAgent
|
|
4
|
+
from wizelit_sdk.database import DatabaseManager
|
|
5
|
+
from wizelit_sdk.agent_wrapper.job import Job
|
|
6
|
+
from wizelit_sdk.agent_wrapper.streaming import LogStreamer
|
|
7
|
+
from wizelit_sdk.models.base import BaseModel
|
|
8
|
+
from wizelit_sdk.models.job import JobModel, JobLogModel, JobStatus
|
|
9
|
+
from wizelit_sdk.exceptions import (
|
|
10
|
+
WizelitSDKException,
|
|
11
|
+
AgentInitializationError,
|
|
12
|
+
SignatureValidationError,
|
|
13
|
+
JobExecutionError,
|
|
14
|
+
JobNotFoundError,
|
|
15
|
+
ToolRegistrationError,
|
|
16
|
+
DatabaseManagerError,
|
|
17
|
+
StreamingError,
|
|
18
|
+
ContextVariableError,
|
|
19
|
+
InvalidConfigError,
|
|
20
|
+
TransportError,
|
|
21
|
+
TimeoutError,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"WizelitAgent",
|
|
26
|
+
"DatabaseManager",
|
|
27
|
+
"Job",
|
|
28
|
+
"LogStreamer",
|
|
29
|
+
"BaseModel",
|
|
30
|
+
"JobModel",
|
|
31
|
+
"JobLogModel",
|
|
32
|
+
"JobStatus",
|
|
33
|
+
# Exceptions
|
|
34
|
+
"WizelitSDKException",
|
|
35
|
+
"AgentInitializationError",
|
|
36
|
+
"SignatureValidationError",
|
|
37
|
+
"JobExecutionError",
|
|
38
|
+
"JobNotFoundError",
|
|
39
|
+
"ToolRegistrationError",
|
|
40
|
+
"DatabaseManagerError",
|
|
41
|
+
"StreamingError",
|
|
42
|
+
"ContextVariableError",
|
|
43
|
+
"InvalidConfigError",
|
|
44
|
+
"TransportError",
|
|
45
|
+
"TimeoutError",
|
|
46
|
+
]
|
|
47
|
+
|
|
@@ -13,6 +13,9 @@ from wizelit_sdk.agent_wrapper.signature_validation import (
|
|
|
13
13
|
bind_and_validate_arguments,
|
|
14
14
|
ensure_type_hints,
|
|
15
15
|
)
|
|
16
|
+
from wizelit_sdk.exceptions import (
|
|
17
|
+
StreamingError,
|
|
18
|
+
)
|
|
16
19
|
|
|
17
20
|
# Local Transport literal to avoid import issues when fastmcp.types is unavailable
|
|
18
21
|
Transport = Literal["stdio", "http", "sse", "streamable-http"]
|
|
@@ -92,7 +95,10 @@ class WizelitAgent:
|
|
|
92
95
|
except ImportError:
|
|
93
96
|
print("Warning: redis package not installed. Log streaming disabled.")
|
|
94
97
|
except Exception as e:
|
|
95
|
-
|
|
98
|
+
raise StreamingError(
|
|
99
|
+
"Failed to initialize log streaming",
|
|
100
|
+
f"Could not connect to Redis at {redis_url}: {str(e)}"
|
|
101
|
+
)
|
|
96
102
|
|
|
97
103
|
print(
|
|
98
104
|
f"WizelitAgent initialized with name: {name}, transport: {transport}, host: {host}, port: {port}"
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Custom exceptions for Wizelit SDK with helpful error messages and suggestions.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WizelitSDKException(Exception):
|
|
7
|
+
"""Base exception class for all Wizelit SDK errors."""
|
|
8
|
+
|
|
9
|
+
def __init__(self, message: str, suggestion: str = ""):
|
|
10
|
+
self.message = message
|
|
11
|
+
self.suggestion = suggestion
|
|
12
|
+
full_message = message
|
|
13
|
+
if suggestion:
|
|
14
|
+
full_message = f"{message}\n💡 Suggestion: {suggestion}"
|
|
15
|
+
super().__init__(full_message)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AgentInitializationError(WizelitSDKException):
|
|
19
|
+
"""Raised when WizelitAgent cannot be initialized."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, reason: str = "", original_error: str = ""):
|
|
22
|
+
message = "Failed to initialize WizelitAgent"
|
|
23
|
+
if reason:
|
|
24
|
+
message += f": {reason}"
|
|
25
|
+
if original_error:
|
|
26
|
+
message += f" ({original_error})"
|
|
27
|
+
suggestion = (
|
|
28
|
+
"1. Verify all required dependencies are installed\n"
|
|
29
|
+
"2. Check that the name parameter is provided\n"
|
|
30
|
+
"3. Verify the transport mode is valid (sse, http, streamable-http, stdio)\n"
|
|
31
|
+
"4. Check that host and port are available and not in use\n"
|
|
32
|
+
"5. Review the initialization code for configuration errors"
|
|
33
|
+
)
|
|
34
|
+
super().__init__(message, suggestion)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SignatureValidationError(WizelitSDKException):
|
|
38
|
+
"""Raised when a function signature doesn't meet requirements."""
|
|
39
|
+
|
|
40
|
+
def __init__(self, function_name: str, reason: str = ""):
|
|
41
|
+
message = f"Signature validation failed for function '{function_name}'"
|
|
42
|
+
if reason:
|
|
43
|
+
message += f": {reason}"
|
|
44
|
+
suggestion = (
|
|
45
|
+
f"1. Ensure all parameters of '{function_name}' have type hints\n"
|
|
46
|
+
f"2. Verify parameter names match between definition and usage\n"
|
|
47
|
+
f"3. Check that the function signature is compatible with the ingest decorator\n"
|
|
48
|
+
f"4. Ensure complex types are properly imported and defined\n"
|
|
49
|
+
f"5. Review the decorator parameters for compatibility"
|
|
50
|
+
)
|
|
51
|
+
super().__init__(message, suggestion)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class JobExecutionError(WizelitSDKException):
|
|
55
|
+
"""Raised when a job fails during execution."""
|
|
56
|
+
|
|
57
|
+
def __init__(self, job_id: str, reason: str = "", original_error: str = ""):
|
|
58
|
+
message = f"Job execution failed for job_id '{job_id}'"
|
|
59
|
+
if reason:
|
|
60
|
+
message += f": {reason}"
|
|
61
|
+
if original_error:
|
|
62
|
+
message += f" ({original_error})"
|
|
63
|
+
suggestion = (
|
|
64
|
+
"1. Check the job logs for detailed error information\n"
|
|
65
|
+
"2. Verify job inputs are valid and complete\n"
|
|
66
|
+
"3. Check if the underlying tool/function has dependencies\n"
|
|
67
|
+
"4. Try running the job again with the same inputs\n"
|
|
68
|
+
"5. Check application logs and database logs for more context"
|
|
69
|
+
)
|
|
70
|
+
super().__init__(message, suggestion)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class JobNotFoundError(WizelitSDKException):
|
|
74
|
+
"""Raised when a job cannot be found."""
|
|
75
|
+
|
|
76
|
+
def __init__(self, job_id: str):
|
|
77
|
+
message = f"Job not found: {job_id}"
|
|
78
|
+
suggestion = (
|
|
79
|
+
"1. Verify the job_id is correct and complete\n"
|
|
80
|
+
"2. Check if the job has expired or been deleted\n"
|
|
81
|
+
"3. Verify the job was created in the current session\n"
|
|
82
|
+
"4. Check the database for job records\n"
|
|
83
|
+
"5. Review job retention policies"
|
|
84
|
+
)
|
|
85
|
+
super().__init__(message, suggestion)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ToolRegistrationError(WizelitSDKException):
|
|
89
|
+
"""Raised when a tool cannot be registered with the MCP server."""
|
|
90
|
+
|
|
91
|
+
def __init__(self, tool_name: str, reason: str = ""):
|
|
92
|
+
message = f"Failed to register tool '{tool_name}' with MCP server"
|
|
93
|
+
if reason:
|
|
94
|
+
message += f": {reason}"
|
|
95
|
+
suggestion = (
|
|
96
|
+
f"1. Verify '{tool_name}' function is properly decorated with @ingest\n"
|
|
97
|
+
f"2. Check that function name is unique across all registered tools\n"
|
|
98
|
+
f"3. Verify function signature is valid with type hints\n"
|
|
99
|
+
f"4. Check for duplicate tool registrations\n"
|
|
100
|
+
f"5. Ensure the FastMCP server is properly initialized"
|
|
101
|
+
)
|
|
102
|
+
super().__init__(message, suggestion)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class DatabaseManagerError(WizelitSDKException):
|
|
106
|
+
"""Raised when database operations fail."""
|
|
107
|
+
|
|
108
|
+
def __init__(self, operation: str, reason: str = ""):
|
|
109
|
+
message = f"Database operation failed: {operation}"
|
|
110
|
+
if reason:
|
|
111
|
+
message += f" ({reason})"
|
|
112
|
+
suggestion = (
|
|
113
|
+
"1. Verify the database is running and accessible\n"
|
|
114
|
+
"2. Check database connection parameters (host, port, credentials)\n"
|
|
115
|
+
"3. Verify the database has sufficient disk space\n"
|
|
116
|
+
"4. Check if the database tables are properly initialized\n"
|
|
117
|
+
"5. Review database logs for detailed error information"
|
|
118
|
+
)
|
|
119
|
+
super().__init__(message, suggestion)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class StreamingError(WizelitSDKException):
|
|
123
|
+
"""Raised when log streaming fails."""
|
|
124
|
+
|
|
125
|
+
def __init__(self, reason: str = "", original_error: str = ""):
|
|
126
|
+
message = "Error in log streaming"
|
|
127
|
+
if reason:
|
|
128
|
+
message += f": {reason}"
|
|
129
|
+
if original_error:
|
|
130
|
+
message += f" ({original_error})"
|
|
131
|
+
suggestion = (
|
|
132
|
+
"1. Verify Redis is running and accessible\n"
|
|
133
|
+
"2. Check REDIS_URL environment variable is set correctly\n"
|
|
134
|
+
"3. Verify network connectivity to Redis\n"
|
|
135
|
+
"4. Check Redis logs for connection errors\n"
|
|
136
|
+
"5. Log streaming is optional - the SDK will continue without it"
|
|
137
|
+
)
|
|
138
|
+
super().__init__(message, suggestion)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class ContextVariableError(WizelitSDKException):
|
|
142
|
+
"""Raised when context variable operations fail."""
|
|
143
|
+
|
|
144
|
+
def __init__(self, variable_name: str, reason: str = ""):
|
|
145
|
+
message = f"Error accessing context variable '{variable_name}'"
|
|
146
|
+
if reason:
|
|
147
|
+
message += f": {reason}"
|
|
148
|
+
suggestion = (
|
|
149
|
+
f"1. Ensure '{variable_name}' is set before accessing\n"
|
|
150
|
+
f"2. Verify the context is active in the current async task\n"
|
|
151
|
+
f"3. Check if using the decorator or dependency injection correctly\n"
|
|
152
|
+
f"4. Ensure context propagation across async calls\n"
|
|
153
|
+
f"5. Review context variable usage documentation"
|
|
154
|
+
)
|
|
155
|
+
super().__init__(message, suggestion)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class InvalidConfigError(WizelitSDKException):
|
|
159
|
+
"""Raised when configuration is invalid or missing."""
|
|
160
|
+
|
|
161
|
+
def __init__(self, config_key: str, expected_type: str = "", reason: str = ""):
|
|
162
|
+
message = f"Invalid configuration for '{config_key}'"
|
|
163
|
+
if expected_type:
|
|
164
|
+
message += f" (expected: {expected_type})"
|
|
165
|
+
if reason:
|
|
166
|
+
message += f": {reason}"
|
|
167
|
+
suggestion = (
|
|
168
|
+
f"1. Verify {config_key} is set in environment variables\n"
|
|
169
|
+
f"2. Check the value format and type\n"
|
|
170
|
+
f"3. Review configuration documentation for valid values\n"
|
|
171
|
+
f"4. Check .env file or deployment configuration\n"
|
|
172
|
+
f"5. Restart the application after fixing configuration"
|
|
173
|
+
)
|
|
174
|
+
super().__init__(message, suggestion)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class TransportError(WizelitSDKException):
|
|
178
|
+
"""Raised when transport/communication errors occur."""
|
|
179
|
+
|
|
180
|
+
def __init__(self, transport_type: str, reason: str = ""):
|
|
181
|
+
message = f"Transport error with '{transport_type}'"
|
|
182
|
+
if reason:
|
|
183
|
+
message += f": {reason}"
|
|
184
|
+
suggestion = (
|
|
185
|
+
f"1. Verify the {transport_type} transport is properly configured\n"
|
|
186
|
+
f"2. Check network connectivity and firewall rules\n"
|
|
187
|
+
f"3. Verify server ports are open and accessible\n"
|
|
188
|
+
f"4. Check if there are proxy or routing issues\n"
|
|
189
|
+
f"5. Review transport-specific logs for detailed information"
|
|
190
|
+
)
|
|
191
|
+
super().__init__(message, suggestion)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class TimeoutError(WizelitSDKException):
|
|
195
|
+
"""Raised when an operation exceeds the timeout limit."""
|
|
196
|
+
|
|
197
|
+
def __init__(self, operation: str, timeout_seconds: float):
|
|
198
|
+
message = f"Operation '{operation}' exceeded timeout of {timeout_seconds} seconds"
|
|
199
|
+
suggestion = (
|
|
200
|
+
f"1. The {operation} took too long to complete\n"
|
|
201
|
+
f"2. Check if there are resource constraints (CPU, memory)\n"
|
|
202
|
+
f"3. Simplify the job inputs or query\n"
|
|
203
|
+
f"4. Check application and system logs for bottlenecks\n"
|
|
204
|
+
f"5. Consider increasing timeout if the operation is expected to be slow"
|
|
205
|
+
)
|
|
206
|
+
super().__init__(message, suggestion)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"""Wizelit SDK package."""
|
|
2
|
-
|
|
3
|
-
from wizelit_sdk.agent_wrapper import WizelitAgent
|
|
4
|
-
from wizelit_sdk.database import DatabaseManager
|
|
5
|
-
from wizelit_sdk.agent_wrapper.job import Job
|
|
6
|
-
from wizelit_sdk.agent_wrapper.streaming import LogStreamer
|
|
7
|
-
from wizelit_sdk.models.base import BaseModel
|
|
8
|
-
from wizelit_sdk.models.job import JobModel, JobLogModel, JobStatus
|
|
9
|
-
|
|
10
|
-
__all__ = ["WizelitAgent", "DatabaseManager", "Job", "LogStreamer", "BaseModel", "JobModel", "JobLogModel", "JobStatus"]
|
|
11
|
-
|
|
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
|
{wizelit_sdk-0.1.30 → wizelit_sdk-0.1.31}/src/wizelit_sdk/agent_wrapper/signature_validation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|