versionhq 1.2.3.4__py3-none-any.whl → 1.2.3.6__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
@@ -32,7 +32,7 @@ from versionhq.agent_network.formation import form_agent_network
32
32
  from versionhq.task_graph.draft import workflow
33
33
 
34
34
 
35
- __version__ = "1.2.3.4"
35
+ __version__ = "1.2.3.6"
36
36
  __all__ = [
37
37
  "Agent",
38
38
 
@@ -1,4 +1,4 @@
1
1
  BACKSTORY_FULL="""You are an expert {role} highly skilled in {skills}. You have abilities to query relevant information from the given knowledge sources and use tools such as {tools}. Leveraging these, you will identify competitive solutions to achieve the following goal: {goal}."""
2
2
 
3
3
 
4
- BACKSTORY_SHORT="""You are an expert {role} with relevant skillsets and abilities to query relevant information from the given knowledge sources. Leveraging these, you will identify competitive solutions to achieve the following goal: {goal}."""
4
+ BACKSTORY_SHORT="""You are an expert {role} with relevant skills and abilities to query relevant information from the given knowledge sources. Leveraging these, you will identify competitive solutions to achieve the following goal: {goal}."""
versionhq/agent/model.py CHANGED
@@ -32,13 +32,15 @@ class Agent(BaseModel):
32
32
  _request_within_rpm_limit: Any = PrivateAttr(default=None)
33
33
  _times_executed: int = PrivateAttr(default=0)
34
34
  _logger_config: Dict[str, Any] = PrivateAttr(default=dict(verbose=True, info_file_save=True))
35
+
36
+ api_key: Optional[str] = Field(default=None)
35
37
  config: Optional[Dict[str, Any]] = Field(default=None, exclude=True, description="values to add to the Agent class")
36
38
 
37
39
  id: UUID4 = Field(default_factory=uuid.uuid4, frozen=True)
38
40
  role: str = Field(description="required. agent's role")
39
41
  goal: Optional[str] = Field(default=None)
40
42
  backstory: Optional[str] = Field(default=None, description="developer prompt to the llm")
41
- skillsets: Optional[List[str]] = Field(default_factory=list)
43
+ skills: Optional[List[str]] = Field(default_factory=list, description="list up the agent's tangible skills in natural language")
42
44
  tools: Optional[List[Any]] = Field(default_factory=list)
43
45
 
44
46
  # knowledge
@@ -149,8 +151,12 @@ class Agent(BaseModel):
149
151
  setattr(tool, k, v)
150
152
  tool_list.append(tool)
151
153
 
154
+ case callable():
155
+ tool = Tool(func=item)
156
+ tool_list.append(tool)
157
+
152
158
  case _:
153
- if item.__base__ == BaseTool or item.__base__ == RagTool or item.__base__ == Tool:
159
+ if hasattr(item, "__base__") and (item.__base__ == BaseTool or item.__base__ == RagTool or item.__base__ == Tool):
154
160
  tool_list.append(item)
155
161
  else:
156
162
  Logger(**self._logger_config, filename=self.key).log(level="error", message=f"Tool {str(item)} is missing a function.", color="red")
@@ -169,12 +175,12 @@ class Agent(BaseModel):
169
175
  if self.backstory is None:
170
176
  from versionhq.agent.TEMPLATES.Backstory import BACKSTORY_FULL, BACKSTORY_SHORT
171
177
  backstory = ""
172
- skills = ", ".join([item for item in self.skillsets]) if self.skillsets else ""
178
+ skills = ", ".join([item for item in self.skills]) if self.skills else ""
173
179
  tools = ", ".join([item.name for item in self.tools if hasattr(item, "name") and item.name is not None]) if self.tools else ""
174
180
  role = self.role.lower()
175
181
  goal = self.goal.lower() if self.goal else ""
176
182
 
177
- if self.tools or self.skillsets:
183
+ if self.tools or self.skills:
178
184
  backstory = BACKSTORY_FULL.format(role=role, goal=goal, skills=skills, tools=tools)
179
185
  else:
180
186
  backstory = BACKSTORY_SHORT.format(role=role, goal=goal)
@@ -371,7 +377,7 @@ class Agent(BaseModel):
371
377
  messages = []
372
378
  messages.append({ "role": "user", "content": prompts })
373
379
  if self.use_developer_prompt:
374
- messages.append({ "role": "system", "content": self.backstory })
380
+ messages.append({ "role": "developer", "content": self.backstory })
375
381
 
376
382
  try:
377
383
  if self._rpm_controller and self.max_rpm:
versionhq/llm/model.py CHANGED
@@ -8,8 +8,7 @@ from contextlib import contextmanager
8
8
  from typing import Any, Dict, List, Optional
9
9
  from typing_extensions import Self
10
10
 
11
- import litellm
12
- from litellm import JSONSchemaValidationError
11
+ from litellm import JSONSchemaValidationError, get_supported_openai_params
13
12
  from pydantic import BaseModel, Field, PrivateAttr, model_validator, ConfigDict
14
13
 
15
14
  from versionhq.llm.llm_vars import LLM_CONTEXT_WINDOW_SIZES, MODELS, PARAMS, PROVIDERS, ENDPOINT_PROVIDERS, ENV_VARS
@@ -48,6 +47,7 @@ class FilteredStream:
48
47
  @contextmanager
49
48
  def suppress_warnings():
50
49
  with warnings.catch_warnings():
50
+ import litellm
51
51
  litellm.set_verbose = False
52
52
  warnings.filterwarnings(action="ignore")
53
53
  old_stdout = sys.stdout
@@ -94,8 +94,6 @@ class LLM(BaseModel):
94
94
 
95
95
  model_config = ConfigDict(extra="allow")
96
96
 
97
- litellm.drop_params = True
98
- litellm.set_verbose = True
99
97
  os.environ['LITELLM_LOG'] = 'DEBUG'
100
98
 
101
99
 
@@ -104,6 +102,8 @@ class LLM(BaseModel):
104
102
  """
105
103
  Validate the given model, provider, interface provider.
106
104
  """
105
+ import litellm
106
+ litellm.drop_params = True
107
107
 
108
108
  self._init_model_name = self.model
109
109
 
@@ -180,6 +180,9 @@ class LLM(BaseModel):
180
180
  """
181
181
  Set up valid config params after setting up a valid model, provider, interface provider names.
182
182
  """
183
+ import litellm
184
+ litellm.drop_params = True
185
+
183
186
  self._tokens = 0
184
187
 
185
188
  if self.callbacks:
@@ -202,11 +205,10 @@ class LLM(BaseModel):
202
205
  """
203
206
  Returns valid params incl. model + litellm original params) from the given config dict.
204
207
  """
205
-
206
208
  valid_config, valid_keys = dict(), list()
207
209
 
208
210
  if self.model:
209
- valid_keys = litellm.get_supported_openai_params(
211
+ valid_keys = get_supported_openai_params(
210
212
  model=self.model, custom_llm_provider=self.endpoint_provider, request_type="chat_completion"
211
213
  )
212
214
 
@@ -257,7 +259,7 @@ class LLM(BaseModel):
257
259
  def _supports_function_calling(self) -> bool:
258
260
  try:
259
261
  if self.model:
260
- params = litellm.get_supported_openai_params(model=self.model)
262
+ params = get_supported_openai_params(model=self.model)
261
263
  return "response_format" in params if params else False
262
264
  else:
263
265
  return False
@@ -267,7 +269,8 @@ class LLM(BaseModel):
267
269
 
268
270
 
269
271
  def _supports_stop_words(self) -> bool:
270
- supported_params = litellm.get_supported_openai_params(model=self.model, custom_llm_provider=self.endpoint_provider)
272
+ import litellm
273
+ supported_params = get_supported_openai_params(model=self.model, custom_llm_provider=self.endpoint_provider)
271
274
  return "stop" in supported_params if supported_params else False
272
275
 
273
276
 
@@ -279,6 +282,7 @@ class LLM(BaseModel):
279
282
 
280
283
 
281
284
  def _set_callbacks(self, callbacks: List[Any]):
285
+ import litellm
282
286
  callback_types = [type(callback) for callback in callbacks]
283
287
  for callback in litellm.success_callback[:]:
284
288
  if type(callback) in callback_types:
@@ -302,8 +306,9 @@ class LLM(BaseModel):
302
306
  """
303
307
  Execute LLM based on the agent's params and model params.
304
308
  """
305
-
309
+ import litellm
306
310
  litellm.drop_params = True
311
+ litellm.set_verbose = True
307
312
 
308
313
  with suppress_warnings():
309
314
  if len(self.callbacks) > 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: versionhq
3
- Version: 1.2.3.4
3
+ Version: 1.2.3.6
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
@@ -68,6 +68,9 @@ Requires-Dist: composio-core==0.7.0
68
68
  Requires-Dist: networkx>=3.4.2
69
69
  Requires-Dist: matplotlib>=3.10.0
70
70
  Requires-Dist: boto3>=1.37.1
71
+ Requires-Dist: scikit-learn>=1.6.1
72
+ Requires-Dist: numpy>=1.26.4
73
+ Requires-Dist: pandas>=2.2.3
71
74
  Provides-Extra: docling
72
75
  Requires-Dist: docling>=2.25.2; extra == "docling"
73
76
  Provides-Extra: mem0ai
@@ -82,10 +85,6 @@ Requires-Dist: sec-api>=1.0.28; extra == "tools"
82
85
  Provides-Extra: torch
83
86
  Requires-Dist: torch>=2.6.0; extra == "torch"
84
87
  Requires-Dist: torchvision>=0.21.0; extra == "torch"
85
- Provides-Extra: evals
86
- Requires-Dist: scikit-learn>=1.6.1; extra == "evals"
87
- Requires-Dist: numpy>=1.26.4; extra == "evals"
88
- Requires-Dist: pandas>=2.2.3; extra == "evals"
89
88
 
90
89
  # Overview
91
90
 
@@ -143,9 +142,9 @@ Agentic orchestration framework for multi-agent networks and task graphs for com
143
142
 
144
143
  ## Key Features
145
144
 
146
- `versionhq` is a Python framework for agent networks that handle complex task automation without human interaction.
145
+ `versionhq` is a Python framework designed for automating complex, multi-step tasks using autonomous agent networks.
147
146
 
148
- Agents are model-agnostic, and will improve task output, while optimizing token cost and job latency, by sharing their memory, knowledge base, and RAG tools with other agents in the network.
147
+ Users can either configure their agents and network manually or allow the system to automatically manage the process based on provided task goals.
149
148
 
150
149
 
151
150
  ### Agent Network
@@ -172,7 +171,7 @@ Each node is triggered by specific events and executed by an assigned agent once
172
171
  While the network automatically reconfigures itself, you retain the ability to direct the agents using `should_reform` variable.
173
172
 
174
173
 
175
- The following code snippet demonstrates the `TaskGraph` and its visualization, saving the diagram to the `uploads` directory.
174
+ The following code snippet explicitly demonstrates the `TaskGraph` and its visualization, saving the diagram to the `uploads` directory.
176
175
 
177
176
  ```python
178
177
  import versionhq as vhq
@@ -214,15 +213,13 @@ A `TaskGraph` represents tasks as `nodes` and their execution dependencies as `e
214
213
 
215
214
  `Agent Networks` can handle `TaskGraph` objects by optimizing their formations.
216
215
 
217
- The following example demonstrates a simple concept of a `supervising` agent network handling a task graph with three tasks and one critical edge.
218
-
219
216
  <img src="https://res.cloudinary.com/dfeirxlea/image/upload/v1739337639/pj_m_home/zfg4ccw1m1ww1tpnb0pa.png">
220
217
 
221
218
  <hr />
222
219
 
223
220
  ### Optimization
224
221
 
225
- Agents are model-agnostic and can handle multiple tasks, leveraging their own and their peers' knowledge sources, memories, and tools.
222
+ Autonomous agents are model-agnostic and can leverage their own and their peers' knowledge sources, memories, and tools.
226
223
 
227
224
  Agents are optimized during network formation, but customization is possible before or after.
228
225
 
@@ -581,7 +578,9 @@ Common issues and solutions:
581
578
 
582
579
  * Issues related to dependencies: `rm -rf uv.lock`, `uv cache clean`, `uv venv`, and run `uv pip install -r requirements.txt -v`.
583
580
 
584
- * Issues related to agents and other systems: Check `.logs` directory located in the root directory for error messages and stack traces.
581
+ * Issues related to `torch` installation: Add optional dependencies by `uv add versionhq[torch]`.
582
+
583
+ * Issues related to agents and other systems: Check `.logs` directory located at the root of the project directory for error messages and stack traces.
585
584
 
586
585
  * Issues related to `Python quit unexpectedly`: Check [this stackoverflow article](https://stackoverflow.com/questions/59888499/macos-catalina-python-quit-unexpectedly-error).
587
586
 
@@ -1,4 +1,4 @@
1
- versionhq/__init__.py,sha256=OB2B9WOc-P9RyhFLEhs2zS0E34d7GwED1POMAfSp4Cg,2980
1
+ versionhq/__init__.py,sha256=40KCEmDQ4M8HPz4QLSdkRurG7jggekd83nKYJJ1j6dE,2980
2
2
  versionhq/_utils/__init__.py,sha256=d-vYVcORZKG-kkLe_fzE8VbViDpAk9DDOKe2fVK25ew,178
3
3
  versionhq/_utils/i18n.py,sha256=TwA_PnYfDLA6VqlUDPuybdV9lgi3Frh_ASsb_X8jJo8,1483
4
4
  versionhq/_utils/llm_as_a_judge.py,sha256=RM0oYfoeanuUyUL3Ewl6_8Xn1F5Axd285UMH46kxG1I,2378
@@ -8,10 +8,10 @@ versionhq/_utils/usage_metrics.py,sha256=xgYGRW3OTuK9EJyi3QYJeYcJl7dL27olcWaLo_7
8
8
  versionhq/_utils/vars.py,sha256=bZ5Dx_bFKlt3hi4-NNGXqdk7B23If_WaTIju2fiTyPQ,57
9
9
  versionhq/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  versionhq/agent/inhouse_agents.py,sha256=BPkvEyMH8VnZWsMeCwsGplDT_kLwlIejeRcr-6ItGqQ,2637
11
- versionhq/agent/model.py,sha256=JU5Yu2ODUAfODS5brm4yXsVWNGjjkJqfPcGJ1NZ8VnI,25392
11
+ versionhq/agent/model.py,sha256=C3MptCdVF7c2xM5TR4Bz5TJzZw1MfYh50TLrvXFMrJ4,25656
12
12
  versionhq/agent/parser.py,sha256=riG0dkdQCxH7uJ0AbdVdg7WvL0BXhUgJht0VtQvxJBc,4082
13
13
  versionhq/agent/rpm_controller.py,sha256=grezIxyBci_lDlwAlgWFRyR5KOocXeOhYkgN02dNFNE,2360
14
- versionhq/agent/TEMPLATES/Backstory.py,sha256=IAhGnnt6VUMe3wO6IzeyZPDNu7XE7Uiu3VEXUreOcKs,532
14
+ versionhq/agent/TEMPLATES/Backstory.py,sha256=dkfuATUQ2g2WoUKkmgAIch-RB--bektGoQaUlsDOn0g,529
15
15
  versionhq/agent/TEMPLATES/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  versionhq/agent_network/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  versionhq/agent_network/formation.py,sha256=CYKNUeKC392wW3leIDIAaGiKADSsumC_vTe0VOnNwRs,7901
@@ -33,7 +33,7 @@ versionhq/knowledge/source_docling.py,sha256=dcu1ITqPXwWZ_lK-6tykEKhhC82eNRTMoWR
33
33
  versionhq/knowledge/storage.py,sha256=Kd-4r6aWM5EDaoXrzKXbgi1hY6tysSQARPGXM95qMmU,8266
34
34
  versionhq/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  versionhq/llm/llm_vars.py,sha256=qSG-_pYeWksdMmwASXpjQqf97fMovsY4lNTSCHQF88k,5694
36
- versionhq/llm/model.py,sha256=R6Mlsfc_MHCPsaUhst1Q9K8KinjpVpKha-B8m6YRoIE,17230
36
+ versionhq/llm/model.py,sha256=W9zcrC18zEz8BKKG2HJ2rO-8rdphif7sdiAHNc9oJbU,17400
37
37
  versionhq/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  versionhq/memory/contextual_memory.py,sha256=QEMVvHuEXxY7M6-12S8HhyFKf108KfX8Zzt7paPW048,3882
39
39
  versionhq/memory/model.py,sha256=VQR1229t7GQPMItlGAHLtJrb6LrZfSoRA1DRW4z0SOU,8234
@@ -62,8 +62,8 @@ versionhq/tool/decorator.py,sha256=C4ZM7Xi2gwtEMaSeRo-geo_g_MAkY77WkSLkAuY0AyI,1
62
62
  versionhq/tool/model.py,sha256=Nc2f9frTK5tH4kh6EeEAk1Fi1w19kEXLOcsBwHCS1a4,12189
63
63
  versionhq/tool/rag_tool.py,sha256=dW5o-83V4bMFFJEj3PUm7XjblwrYJGmZVBlCpPj6CeM,3852
64
64
  versionhq/tool/tool_handler.py,sha256=2m41K8qo5bGCCbwMFferEjT-XZ-mE9F0mDUOBkgivOI,1416
65
- versionhq-1.2.3.4.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
66
- versionhq-1.2.3.4.dist-info/METADATA,sha256=6ctQ8pQeU6rOuUOO0AxAmVy4v0MYDk2QJbZyCWHFBR0,21418
67
- versionhq-1.2.3.4.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
68
- versionhq-1.2.3.4.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
69
- versionhq-1.2.3.4.dist-info/RECORD,,
65
+ versionhq-1.2.3.6.dist-info/LICENSE,sha256=cRoGGdM73IiDs6nDWKqPlgSv7aR4n-qBXYnJlCMHCeE,1082
66
+ versionhq-1.2.3.6.dist-info/METADATA,sha256=pse3tddq8a1S0jxvDrZBlb2v2a83PaF6oPRlSBvjXlM,21262
67
+ versionhq-1.2.3.6.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
68
+ versionhq-1.2.3.6.dist-info/top_level.txt,sha256=DClQwxDWqIUGeRJkA8vBlgeNsYZs4_nJWMonzFt5Wj0,10
69
+ versionhq-1.2.3.6.dist-info/RECORD,,