wizelit-sdk 0.1.24__py3-none-any.whl → 0.1.26__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.
@@ -1,9 +1,8 @@
1
1
  """Agent Wrapper - Internal utility package."""
2
2
 
3
3
  # Import main functions
4
- from .utils import greet, greet_many, greet_many3
5
4
  from .agent_wrapper import WizelitAgent
6
5
  from .job import Job
7
6
  from .streaming import LogStreamer
8
7
 
9
- __all__ = ["greet", "greet_many", "greet_many3", "WizelitAgent", "Job", "LogStreamer"]
8
+ __all__ = ["WizelitAgent", "Job", "LogStreamer"]
@@ -3,7 +3,7 @@ import asyncio
3
3
  import inspect
4
4
  import logging
5
5
  import os
6
- from typing import Callable, Any, Optional, Literal, Dict, TYPE_CHECKING
6
+ from typing import Callable, Any, Optional, Literal, Dict, TYPE_CHECKING, Union
7
7
  from contextvars import ContextVar
8
8
  from fastmcp import FastMCP, Context
9
9
  from fastmcp.dependencies import CurrentContext
@@ -362,9 +362,10 @@ class WizelitAgent:
362
362
  return result
363
363
 
364
364
  except Exception as e:
365
- # Mark job as failed (only if job exists)
366
- if job is not None:
367
- job.status = "failed"
365
+ # Mark job as failed when a job instance exists
366
+ active_job = job or _current_job.get()
367
+ if active_job is not None:
368
+ active_job.status = "failed"
368
369
 
369
370
  # Stream error information
370
371
  await ctx.report_progress(
@@ -483,7 +484,7 @@ class WizelitAgent:
483
484
  return None
484
485
 
485
486
  try:
486
- from models.job import JobModel
487
+ from wizelit_sdk.models.job import JobModel
487
488
  from sqlalchemy import select
488
489
 
489
490
  async with self._db_manager.get_session() as session:
@@ -532,7 +533,7 @@ class WizelitAgent:
532
533
  return None
533
534
 
534
535
  try:
535
- from models.job import JobLogModel
536
+ from wizelit_sdk.models.job import JobLogModel
536
537
  from sqlalchemy import select
537
538
 
538
539
  async with self._db_manager.get_session() as session:
@@ -579,7 +580,7 @@ class WizelitAgent:
579
580
  return True
580
581
 
581
582
  def set_job_result(
582
- self, job_id: str, result: Optional[str | dict[str, Any]]
583
+ self, job_id: str, result: Optional[Union[str, dict[str, Any]]]
583
584
  ) -> bool:
584
585
  """
585
586
  Set the result of a job by job_id.
@@ -10,8 +10,8 @@ from typing import List, Optional, Awaitable, Any, TYPE_CHECKING
10
10
  from fastmcp import Context
11
11
 
12
12
  if TYPE_CHECKING:
13
- from wizelit_sdk.database import DatabaseManager
14
- from wizelit_sdk.agent_wrapper.streaming import LogStreamer
13
+ from ..database import DatabaseManager
14
+ from .streaming import LogStreamer
15
15
 
16
16
 
17
17
  class MemoryLogHandler(logging.Handler):
@@ -60,7 +60,7 @@ class DatabaseLogHandler(logging.Handler):
60
60
  """
61
61
  try:
62
62
  # Import here to avoid circular dependency
63
- from models.job import JobLogModel
63
+ from ..models.job import JobLogModel
64
64
  from datetime import datetime
65
65
 
66
66
  async def write_log():
@@ -274,7 +274,7 @@ class Job:
274
274
  try:
275
275
  result = await coro
276
276
  # Store string results for convenience
277
- if isinstance(result, str|dict):
277
+ if isinstance(result, (str, dict)):
278
278
  self.result = result
279
279
  if self._status == "running":
280
280
  self.status = "completed"
@@ -351,7 +351,7 @@ class Job:
351
351
  return
352
352
 
353
353
  try:
354
- from models.job import JobModel
354
+ from ..models.job import JobModel
355
355
 
356
356
  async with self._db_manager.get_session() as session:
357
357
  # Check if job already exists
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizelit-sdk
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: Wizelit Agent Wrapper - Internal utility package
5
5
  Author-email: Your Name <your.email@company.com>
6
6
  Requires-Python: >=3.10
@@ -55,6 +55,18 @@ from wizelit_agent_wrapper import your_module
55
55
  result = your_module.function()
56
56
  ```
57
57
 
58
+ ## Configuration
59
+
60
+ The SDK reads database configuration from the hosting application's environment. Provide these variables in the consuming project (e.g., via your app's .env or deployment secrets):
61
+
62
+ - POSTGRES_USER
63
+ - POSTGRES_PASSWORD
64
+ - POSTGRES_HOST
65
+ - POSTGRES_PORT
66
+ - POSTGRES_DB
67
+
68
+ You can also supply a full connection string via `DATABASE_URL` (overrides the individual fields). If using streaming/logging with Redis, set `REDIS_HOST`, `REDIS_PORT`, and optionally `REDIS_PASSWORD`.
69
+
58
70
  ## Development
59
71
 
60
72
  ### Setup Development Environment
@@ -103,9 +115,9 @@ make versions # List all available versions
103
115
  ## Versioning
104
116
 
105
117
  We use [Semantic Versioning](https://semver.org/):
118
+
106
119
  - **MAJOR** version for incompatible API changes
107
120
  - **MINOR** version for new functionality (backward compatible)
108
121
  - **PATCH** version for bug fixes
109
122
 
110
123
  See [CHANGELOG.md](CHANGELOG.md) for version history.
111
-
@@ -0,0 +1,12 @@
1
+ wizelit_sdk/__init__.py,sha256=76Dt-WxNbEJwOCPqu2P9AooVSQoGmc8-CH1fxIWJ5Lo,471
2
+ wizelit_sdk/database.py,sha256=39Vu5A8CV7u7ItIwRgrkAugD9UqNbG5vQrCsMOgTamc,4631
3
+ wizelit_sdk/agent_wrapper/__init__.py,sha256=OAF36jAmI0A3ByppsYMzJDHeDG9X0Ac4LbFzNp0b7jw,219
4
+ wizelit_sdk/agent_wrapper/agent_wrapper.py,sha256=e9KCQSpC7hox3q6sqzhOLDIq37btw7IT4ejeuljc6Gk,22742
5
+ wizelit_sdk/agent_wrapper/job.py,sha256=Gk2CyLBQFzIosYuGrqUj6_rZ9kDIO6YLYQ7Pxk6ASuM,13776
6
+ wizelit_sdk/agent_wrapper/streaming.py,sha256=f0VV3IzGAlfQY_cw2OHgxWjvM16Hs42_b700EUX2QpY,6633
7
+ wizelit_sdk/models/__init__.py,sha256=UB7nfHoE6hGcjfzy7w8AmuKVmYrTg9wIgGjG8GWziJ0,143
8
+ wizelit_sdk/models/base.py,sha256=aEPGMZVczKnlWz4Ps99e_xI5TcuSV3DxCigRMU5BnhE,704
9
+ wizelit_sdk/models/job.py,sha256=P68Vb1k77Z_Tha4dE0GzrLPa0LJrnMCxyYMENZyD7Kc,2480
10
+ wizelit_sdk-0.1.26.dist-info/METADATA,sha256=0QpbkJ8Z5Vl-2s7xrYHoTrutSAMUgQol9JNr9fgXkgo,3265
11
+ wizelit_sdk-0.1.26.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
12
+ wizelit_sdk-0.1.26.dist-info/RECORD,,
@@ -1,45 +0,0 @@
1
- """Utility functions for Wizelit Agent Wrapper."""
2
-
3
-
4
- def greet(name: str = "World") -> str:
5
- """
6
- Generate a greeting message.
7
-
8
- Args:
9
- name: Name to greet. Defaults to "World".
10
-
11
- Returns:
12
- A greeting string.
13
-
14
- Example:
15
- >>> greet("Alice")
16
- 'Hello, Alice!'
17
- >>> greet()
18
- 'Hello, World!'
19
- """
20
- return f"Hello, {name}!"
21
-
22
- def greet_many(names: list[str]) -> list[str]:
23
- """
24
- Generate a greeting message for each name.
25
-
26
- Args:
27
- names: List of names to greet.
28
-
29
- Returns:
30
- A list of greeting strings.
31
- """
32
- return [f"Hello, {name}!" for name in names]
33
-
34
-
35
- def greet_many3(names: list[str]) -> str:
36
- """
37
- Generate a greeting message for each name.
38
-
39
- Args:
40
- names: List of names to greet.
41
-
42
- Returns:
43
- A list of greeting strings.
44
- """
45
- return ', '.join([f"Hello, {name}!" for name in names])
@@ -1,13 +0,0 @@
1
- wizelit_sdk/__init__.py,sha256=76Dt-WxNbEJwOCPqu2P9AooVSQoGmc8-CH1fxIWJ5Lo,471
2
- wizelit_sdk/database.py,sha256=39Vu5A8CV7u7ItIwRgrkAugD9UqNbG5vQrCsMOgTamc,4631
3
- wizelit_sdk/agent_wrapper/__init__.py,sha256=JuFeLxaANm1klxeQ14n6UjbpHNFQCzofa-FlcDVyo5Q,307
4
- wizelit_sdk/agent_wrapper/agent_wrapper.py,sha256=6UAJjNrdPIpDHU2ipF5M42umddM77CXU5imSn2tTv0Q,22630
5
- wizelit_sdk/agent_wrapper/job.py,sha256=Vvmm6eTX1cbXpFuwPMLaom6hEgdk3ovitnaj9d9p02o,13804
6
- wizelit_sdk/agent_wrapper/streaming.py,sha256=f0VV3IzGAlfQY_cw2OHgxWjvM16Hs42_b700EUX2QpY,6633
7
- wizelit_sdk/agent_wrapper/utils.py,sha256=OUihj3Kk6uI0y7bDr_L_YQs33vSK0GAJRl0c4km4DNs,951
8
- wizelit_sdk/models/__init__.py,sha256=UB7nfHoE6hGcjfzy7w8AmuKVmYrTg9wIgGjG8GWziJ0,143
9
- wizelit_sdk/models/base.py,sha256=aEPGMZVczKnlWz4Ps99e_xI5TcuSV3DxCigRMU5BnhE,704
10
- wizelit_sdk/models/job.py,sha256=P68Vb1k77Z_Tha4dE0GzrLPa0LJrnMCxyYMENZyD7Kc,2480
11
- wizelit_sdk-0.1.24.dist-info/METADATA,sha256=FnRm-NWPMsTIc6v-SbF8lo7zv8s24lPmCWUaYL6sbE4,2778
12
- wizelit_sdk-0.1.24.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
13
- wizelit_sdk-0.1.24.dist-info/RECORD,,