versionhq 1.2.1.1__py3-none-any.whl → 1.2.1.2__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.
versionhq/__init__.py CHANGED
@@ -30,7 +30,7 @@ from versionhq.memory.model import ShortTermMemory,LongTermMemory, UserMemory, M
30
30
  from versionhq.task.formation import form_agent_network
31
31
 
32
32
 
33
- __version__ = "1.2.1.1"
33
+ __version__ = "1.2.1.2"
34
34
  __all__ = [
35
35
  "Agent",
36
36
 
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from datetime import datetime
2
3
  from typing import Optional
3
4
 
@@ -42,9 +43,55 @@ class Logger(BaseModel):
42
43
  """
43
44
 
44
45
  verbose: bool = Field(default=True)
46
+ info_file_save: bool = Field(default=False, description="whether to save INFO logs")
45
47
  _printer: Printer = PrivateAttr(default_factory=Printer)
46
48
 
47
- def log(self, level, message, color="yellow"):
49
+
50
+ def log(self, level: str, message: str, color="yellow"):
48
51
  if self.verbose:
49
52
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
50
53
  self._printer.print(f"\n{timestamp} - versionHQ [{level.upper()}]: {message}", color=color)
54
+
55
+ self._save(level=level, message=message)
56
+
57
+
58
+ def _save(self, level: str, message: str, filename: str = None):
59
+ import os
60
+ from pathlib import Path
61
+
62
+ if level.lower() == "info" and self.info_file_save == False:
63
+ return
64
+
65
+ logging_level = logging.INFO
66
+ match level:
67
+ case "warning":
68
+ logging_level = logging.WARNING
69
+ case "error":
70
+ logging_level = logging.ERROR
71
+ case _:
72
+ pass
73
+
74
+ cwd = Path.cwd()
75
+ log_file_dir = f"{cwd}/_logs"
76
+ os.makedirs(log_file_dir, exist_ok=True)
77
+ filename = filename if filename else datetime.now().strftime('%H_%M_%S_%d_%m_%Y')
78
+ abs_dir = f"{log_file_dir}/{filename}.log"
79
+
80
+ logging.basicConfig(filename=abs_dir, filemode='w', level=logging_level)
81
+ logger = logging.getLogger(__name__)
82
+ file_handler = logging.FileHandler(filename=abs_dir)
83
+ formatter = logging.Formatter('%(asctime)s : %(levelname)s : %(name)s : %(message)s')
84
+ file_handler.setFormatter(formatter)
85
+
86
+ for handler in logging.root.handlers[:]:
87
+ logging.root.removeHandler(handler)
88
+
89
+ logger.addHandler(file_handler)
90
+
91
+ match logging_level:
92
+ case logging.WARNING:
93
+ logger.warning(message)
94
+ case logging.ERROR:
95
+ logger.error(message)
96
+ case _:
97
+ logger.info(message)
versionhq/task/model.py CHANGED
@@ -617,6 +617,7 @@ Ref. Output image: {output_formats_to_follow}
617
617
 
618
618
  self.prompt_context = context
619
619
  task_output: InstanceOf[TaskOutput] = None
620
+ raw_output: str = None
620
621
  tool_output: str | list = None
621
622
  task_tools: List[List[InstanceOf[Tool]| InstanceOf[ToolSet] | Type[Tool]]] = []
622
623
  started_at, ended_at = datetime.datetime.now(), datetime.datetime.now()
@@ -673,7 +674,7 @@ Ref. Output image: {output_formats_to_follow}
673
674
  self.output = task_output
674
675
  self.processed_agents.add(agent.role)
675
676
 
676
- if self.should_evaluate:
677
+ if self.should_evaluate and raw_output: # eval only when raw output exsits
677
678
  task_output.evaluate(task=self)
678
679
 
679
680
  self._create_short_and_long_term_memories(agent=agent, task_output=task_output)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: versionhq
3
- Version: 1.2.1.1
3
+ Version: 1.2.1.2
4
4
  Summary: An agentic orchestration framework for building agent networks that handle task automation.
5
5
  Author-email: Kuriko Iwai <kuriko@versi0n.io>
6
6
  License: MIT License
@@ -115,13 +115,12 @@ A Python framework for agentic orchestration that handles complex task automatio
115
115
  - [Forming a agent network](#forming-a-agent-network)
116
116
  - [Executing tasks](#executing-tasks)
117
117
  - [Supervising](#supervising)
118
- - [Supervising](#supervising-1)
119
118
  - [Technologies Used](#technologies-used)
120
119
  - [Project Structure](#project-structure)
121
- - [Setting Up a Project](#setting-up-a-project)
122
- - [1. Installing package manager](#1-installing-package-manager)
123
- - [2. Installing dependencies](#2-installing-dependencies)
124
- - [3. Adding env secrets to .env file](#3-adding-env-secrets-to-env-file)
120
+ - [Setting Up Your Project](#setting-up-your-project)
121
+ - [Installing package manager](#installing-package-manager)
122
+ - [Installing dependencies](#installing-dependencies)
123
+ - [Adding env secrets to .env file](#adding-env-secrets-to-env-file)
125
124
  - [Contributing](#contributing)
126
125
  - [Steps](#steps)
127
126
  - [Package Management with uv](#package-management-with-uv)
@@ -257,7 +256,7 @@ agent.update(
257
256
  res = network.launch()
258
257
  ```
259
258
 
260
- This will form a network with multiple agents on `Formation` and return `TaskOutput` object with output in JSON, plane text, Pydantic model format with evaluation.
259
+ This will form a network with multiple agents on `Formation` and return `TaskOutput` object with output in JSON, plane text, Pydantic model format with evaluation.
261
260
 
262
261
 
263
262
  ### Executing tasks
@@ -267,47 +266,45 @@ You can simply build an agent using `Agent` model and execute the task using `Ta
267
266
  By default, agents prioritize JSON over plane text outputs.
268
267
 
269
268
 
270
- ```python
271
- import versionhq as vhq
272
- from pydantic import BaseModel
269
+ ```python
270
+ import versionhq as vhq
271
+ from pydantic import BaseModel
273
272
 
274
- class CustomOutput(BaseModel):
275
- test1: str
276
- test2: list[str]
273
+ class CustomOutput(BaseModel):
274
+ test1: str
275
+ test2: list[str]
277
276
 
278
- def dummy_func(message: str, test1: str, test2: list[str]) -> str:
279
- return f"""{message}: {test1}, {", ".join(test2)}"""
277
+ def dummy_func(message: str, test1: str, test2: list[str]) -> str:
278
+ return f"""{message}: {test1}, {", ".join(test2)}"""
280
279
 
281
- task = vhq.Task(
282
- description="Amazing task",
283
- pydantic_output=CustomOutput,
284
- callback=dummy_func,
285
- callback_kwargs=dict(message="Hi! Here is the result: ")
286
- )
280
+ task = vhq.Task(
281
+ description="Amazing task",
282
+ pydantic_output=CustomOutput,
283
+ callback=dummy_func,
284
+ callback_kwargs=dict(message="Hi! Here is the result: ")
285
+ )
287
286
 
288
- res = task.execute(context="amazing context to consider.")
289
- print(res)
290
- ```
287
+ res = task.execute(context="amazing context to consider.")
288
+ print(res)
289
+ ```
291
290
 
292
291
 
293
292
  This will return a `TaskOutput` object that stores response in plane text, JSON, and Pydantic model: `CustomOutput` formats with a callback result, tool output (if given), and evaluation results (if given).
294
293
 
295
- ```python
296
- res == TaskOutput(
297
- task_id=UUID('<TASK UUID>'),
298
- raw='{\"test1\":\"random str\", \"test2\":[\"str item 1\", \"str item 2\", \"str item 3\"]}',
299
- json_dict={'test1': 'random str', 'test2': ['str item 1', 'str item 2', 'str item 3']},
300
- pydantic=<class '__main__.CustomOutput'>,
301
- tool_output=None,
302
- callback_output='Hi! Here is the result: random str, str item 1, str item 2, str item 3', # returned a plain text summary
303
- evaluation=None
304
- )
305
- ```
294
+ ```python
295
+ res == TaskOutput(
296
+ task_id=UUID('<TASK UUID>'),
297
+ raw='{\"test1\":\"random str\", \"test2\":[\"str item 1\", \"str item 2\", \"str item 3\"]}',
298
+ json_dict={'test1': 'random str', 'test2': ['str item 1', 'str item 2', 'str item 3']},
299
+ pydantic=<class '__main__.CustomOutput'>,
300
+ tool_output=None,
301
+ callback_output='Hi! Here is the result: random str, str item 1, str item 2, str item 3', # returned a plain text summary
302
+ evaluation=None
303
+ )
304
+ ```
306
305
 
307
306
  ### Supervising
308
307
 
309
- ## Supervising
310
-
311
308
  To create an agent network with one or more manager agents, designate members using the `is_manager` tag.
312
309
 
313
310
  ```python
@@ -410,16 +407,19 @@ src/
410
407
  │ └── ...
411
408
 
412
409
  └── uploads/ [.gitignore] # Local directory to store uploaded files such as graphviz diagrams generatd by `Network` class
413
- |
410
+
411
+ └── _logs/ [.gitignore] # Local directory to store error/warning logs for debugging
412
+
413
+
414
414
  pyproject.toml # Project config
415
415
 
416
416
  ```
417
417
 
418
418
  <hr />
419
419
 
420
- ## Setting Up a Project
420
+ ## Setting Up Your Project
421
421
 
422
- ### 1. Installing package manager
422
+ ### Installing package manager
423
423
 
424
424
  For MacOS:
425
425
 
@@ -433,7 +433,7 @@ pyproject.toml # Project config
433
433
  ```
434
434
 
435
435
 
436
- ### 2. Installing dependencies
436
+ ### Installing dependencies
437
437
 
438
438
  ```
439
439
  uv venv
@@ -466,7 +466,7 @@ pyproject.toml # Project config
466
466
 
467
467
  - `torch`/`Docling` related errors: Set up default Python version either `3.11.x` or `3.12.x` (same as AssertionError)
468
468
 
469
- ### 3. Adding env secrets to .env file
469
+ ### Adding env secrets to .env file
470
470
 
471
471
  Create `.env` file in the project root and add following:
472
472
 
@@ -479,6 +479,7 @@ Create `.env` file in the project root and add following:
479
479
  [OTHER_LLM_INTERFACE_PROVIDER_OF_YOUR_CHOICE]_API_KEY=your-api-key
480
480
  ```
481
481
 
482
+
482
483
  <hr />
483
484
 
484
485
  ## Contributing
@@ -583,7 +584,7 @@ Common issues and solutions:
583
584
 
584
585
  * Issues related to dependencies: `rm -rf uv.lock`, `uv cache clean`, `uv venv`, and run `uv pip install -r requirements.txt -v`.
585
586
 
586
- * Issues related to the AI agents or RAG system: Check the `output.log` file for detailed error messages and stack traces.
587
+ * Issues related to agents and other systems: Check `_logs` directory for detailed error messages and stack traces.
587
588
 
588
589
  * Issues related to `Python quit unexpectedly`: Check [this stackoverflow article](https://stackoverflow.com/questions/59888499/macos-catalina-python-quit-unexpectedly-error).
589
590
 
@@ -1,7 +1,7 @@
1
- versionhq/__init__.py,sha256=Ct-oSIm8Mw2K2UH9CNTtuKaLgwUTIcUa3ogDAFQYHZo,2817
1
+ versionhq/__init__.py,sha256=nv3StURywg_U4o7_lKbqPuby1xjSphOkY9B6Ra5ORHA,2817
2
2
  versionhq/_utils/__init__.py,sha256=dzoZr4cBlh-2QZuPzTdehPUCe9lP1dmRtauD7qTjUaA,158
3
3
  versionhq/_utils/i18n.py,sha256=TwA_PnYfDLA6VqlUDPuybdV9lgi3Frh_ASsb_X8jJo8,1483
4
- versionhq/_utils/logger.py,sha256=2qkODR6y8ApOoMjQZVecTboXvCLrMy2v_mTSOnNMKFY,1581
4
+ versionhq/_utils/logger.py,sha256=IxSlr2Vi7AXaxj5Fuy8LRzEovaIFVwcbWTgJnASsHN8,3155
5
5
  versionhq/_utils/process_config.py,sha256=jbPGXK2Kb4iyCugJ3FwRJuU0wL5Trq2x4xFQz2uOyFY,746
6
6
  versionhq/_utils/usage_metrics.py,sha256=NXF18dn5NNvGK7EsQ4AAghpR8ppYOjMx6ABenLLHnmM,1066
7
7
  versionhq/_utils/vars.py,sha256=bZ5Dx_bFKlt3hi4-NNGXqdk7B23If_WaTIju2fiTyPQ,57
@@ -47,7 +47,7 @@ versionhq/task/evaluate.py,sha256=WdUgjbZL62XrxyWe5MTz29scfzwmuAHGxJ7GvAB8Fmk,39
47
47
  versionhq/task/formation.py,sha256=gBrFmMHvoyqdK9wEa9aBkZImEQV3GMDDX6-RDpw0pEo,6421
48
48
  versionhq/task/formatter.py,sha256=N8Kmk9vtrMtBdgJ8J7RmlKNMdZWSmV8O1bDexmCWgU0,643
49
49
  versionhq/task/log_handler.py,sha256=LT7YnO7gcPR9IZS7eRvMjnHh8crMBFtqduxd8dxIbkk,1680
50
- versionhq/task/model.py,sha256=oPnShLU6huN2cfuEiHVO8Zl9_w44G9ZsWEWMBjpHfK4,30675
50
+ versionhq/task/model.py,sha256=H7ZYZpp_1mrw_MlKjLr6gMJztqyhPkdeoolIzZSF68Y,30756
51
51
  versionhq/task/structured_response.py,sha256=4q-hQPu7oMMHHXEzh9YW4SJ7N5eCZ7OfZ65juyl_jCI,5000
52
52
  versionhq/task/TEMPLATES/Description.py,sha256=V-4kh8xpQTKOcDMi2xnuP-fcNk6kuoz1_5tYBlDLQWQ,420
53
53
  versionhq/task_graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -59,8 +59,8 @@ versionhq/tool/composio_tool_vars.py,sha256=FvBuEXsOQUYnN7RTFxT20kAkiEYkxWKkiVtg
59
59
  versionhq/tool/decorator.py,sha256=C4ZM7Xi2gwtEMaSeRo-geo_g_MAkY77WkSLkAuY0AyI,1205
60
60
  versionhq/tool/model.py,sha256=PO4zNWBZcJhYVur381YL1dy6zqurio2jWjtbxOxZMGI,12194
61
61
  versionhq/tool/tool_handler.py,sha256=2m41K8qo5bGCCbwMFferEjT-XZ-mE9F0mDUOBkgivOI,1416
62
- versionhq-1.2.1.1.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
63
- versionhq-1.2.1.1.dist-info/METADATA,sha256=cjE8Ov1BpANLgfAZAbHO0XmorFk9nAR-rVyJg1AczVc,22166
64
- versionhq-1.2.1.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
65
- versionhq-1.2.1.1.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
66
- versionhq-1.2.1.1.dist-info/RECORD,,
62
+ versionhq-1.2.1.2.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
63
+ versionhq-1.2.1.2.dist-info/METADATA,sha256=SjmFRj8FztRldIYEtsObQlY5XTk6mWL-zmr6sCaSWAY,22116
64
+ versionhq-1.2.1.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
65
+ versionhq-1.2.1.2.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
66
+ versionhq-1.2.1.2.dist-info/RECORD,,