hyperforge-conditional 1.0.0.post27__tar.gz → 1.0.0.post46__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.
Files changed (17) hide show
  1. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/PKG-INFO +2 -2
  2. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/pyproject.toml +5 -2
  3. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional/conditional.py +6 -7
  4. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional/context_agent.py +6 -6
  5. hyperforge_conditional-1.0.0.post46/src/hyperforge_conditional/py.typed +0 -0
  6. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional.egg-info/PKG-INFO +2 -2
  7. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional.egg-info/SOURCES.txt +1 -0
  8. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/README.md +0 -0
  9. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/setup.cfg +0 -0
  10. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional/__init__.py +0 -0
  11. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional/generation_agent.py +0 -0
  12. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional/postprocess_agent.py +0 -0
  13. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional/preprocess_agent.py +0 -0
  14. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional.egg-info/dependency_links.txt +0 -0
  15. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional.egg-info/requires.txt +0 -0
  16. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/src/hyperforge_conditional.egg-info/top_level.txt +0 -0
  17. {hyperforge_conditional-1.0.0.post27 → hyperforge_conditional-1.0.0.post46}/tests/test_conditional.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperforge_conditional
3
- Version: 1.0.0.post27
3
+ Version: 1.0.0.post46
4
4
  Summary: Conditional Hyperforge agent
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: Apache-2.0
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
- Requires-Python: <4,>=3.10
16
+ Requires-Python: <4,>=3.12
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: hyperforge
19
19
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyperforge_conditional"
7
- version = "1.0.0.post27"
7
+ version = "1.0.0.post46"
8
8
  license = "Apache-2.0"
9
9
  description = "Conditional Hyperforge agent"
10
10
  authors = [{ name = "Nuclia", email = "nucliadb@nuclia.com" }]
@@ -17,7 +17,7 @@ classifiers = [
17
17
  "Programming Language :: Python :: 3 :: Only",
18
18
  "Topic :: Software Development :: Libraries :: Python Modules",
19
19
  ]
20
- requires-python = ">=3.10, <4"
20
+ requires-python = ">=3.12, <4"
21
21
  dependencies = ["hyperforge"]
22
22
 
23
23
  [dependency-groups]
@@ -47,3 +47,6 @@ asyncio_mode = "auto"
47
47
 
48
48
  # Exclude specific files from being packaged
49
49
  source-exclude = ["tests/**", "*.pyc"]
50
+
51
+ [tool.ruff]
52
+ extend = "../../ruff.toml"
@@ -2,6 +2,7 @@ import asyncio
2
2
  from time import time
3
3
  from typing import Any, Dict, List, Literal, Optional, cast
4
4
 
5
+ from hyperforge import PROMPT_ENVIRONMENT
5
6
  from hyperforge.agent import Agent, AgentConfig
6
7
  from hyperforge.configure import get_agent_config_klass, get_agent_klass
7
8
  from hyperforge.manager import Manager
@@ -10,8 +11,6 @@ from hyperforge.trace import trace_agent
10
11
  from hyperforge.utils import WidgetType
11
12
  from pydantic import BaseModel, Field, field_serializer, field_validator
12
13
 
13
- from hyperforge import PROMPT_ENVIRONMENT
14
-
15
14
  CONDITIONAL_AGENT = """
16
15
  Given a prompt that indicates a condition , assess whether a given text fulfills it or not.
17
16
  # PROMPT:
@@ -113,7 +112,7 @@ class ConditionalAgentConfig(AgentConfig):
113
112
  def is_conditional_agent(cls, value: list[Dict[str, Any]]) -> list[BaseModel]:
114
113
  if value is None:
115
114
  return value
116
- result = []
115
+ result: list[BaseModel] = []
117
116
  for agent_cfg in value:
118
117
  module = agent_cfg.get("module")
119
118
  if module is None:
@@ -121,8 +120,8 @@ class ConditionalAgentConfig(AgentConfig):
121
120
 
122
121
  agent_config_klass = get_agent_config_klass(module)
123
122
  agent_config_instance = agent_config_klass.model_validate(agent_cfg)
124
- result.append(agent_config_instance)
125
- return result # type: ignore
123
+ result.append(cast(BaseModel, agent_config_instance))
124
+ return result
126
125
 
127
126
 
128
127
  class Conditional:
@@ -229,7 +228,7 @@ class Conditional:
229
228
 
230
229
  if condition and self.then is not None:
231
230
  for then_agent in self.then:
232
- await then_agent(memory, manager) # type: ignore
231
+ await then_agent(memory, manager)
233
232
  elif condition is False and self.else_ is not None:
234
233
  for else_agent in self.else_:
235
- await else_agent(memory, manager) # type: ignore
234
+ await else_agent(memory, manager)
@@ -19,7 +19,7 @@ from hyperforge_conditional.conditional import (
19
19
  class ContextConditionalAgentConfig(ConditionalAgentConfig, ContextAgentConfig):
20
20
  model_config = ConfigDict(title="Condition")
21
21
  module: Literal["context_conditional"] = "context_conditional"
22
- on: Literal["QUESTION", "CONTEXT"] = Field( # type: ignore
22
+ on: Literal["QUESTION", "CONTEXT"] = Field(
23
23
  default="QUESTION",
24
24
  title="Evaluate condition on",
25
25
  description="Source to evaluate the condition on. CONTEXT is only valid when this agent is used as a next agent in a chain.",
@@ -58,7 +58,7 @@ class ContextConditional(
58
58
  flow_id: str,
59
59
  extra_context: Optional[Dict[str, Any]] = None,
60
60
  ):
61
- self.config: ContextConditionalAgentConfig # type: ignore
61
+ self.config: ContextConditionalAgentConfig
62
62
  if extra_context is not None:
63
63
  question, question_uuid = await self.rephrase(
64
64
  memory=memory,
@@ -137,17 +137,17 @@ class ContextConditional(
137
137
 
138
138
  if self.next_agent is not None:
139
139
  extra_context = extra_context or {}
140
- for agent in ( # type: ignore
140
+ for nagent in (
141
141
  selected_agents + [self.fallback]
142
142
  if self.fallback is not None
143
143
  else selected_agents
144
144
  ):
145
- if agent:
145
+ if nagent:
146
146
  answer_summaries = memory.get_agent_answer_summaries(
147
- flow_id=flow_id, agent_id=agent.agent_id
147
+ flow_id=flow_id, agent_id=nagent.agent_id
148
148
  )
149
149
  if answer_summaries:
150
- extra_context[agent.agent_id] = "\n".join(answer_summaries)
150
+ extra_context[nagent.agent_id] = "\n".join(answer_summaries)
151
151
 
152
152
  await self.next_agent.get_question_context(
153
153
  memory,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperforge_conditional
3
- Version: 1.0.0.post27
3
+ Version: 1.0.0.post46
4
4
  Summary: Conditional Hyperforge agent
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: Apache-2.0
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
- Requires-Python: <4,>=3.10
16
+ Requires-Python: <4,>=3.12
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: hyperforge
19
19
 
@@ -6,6 +6,7 @@ src/hyperforge_conditional/context_agent.py
6
6
  src/hyperforge_conditional/generation_agent.py
7
7
  src/hyperforge_conditional/postprocess_agent.py
8
8
  src/hyperforge_conditional/preprocess_agent.py
9
+ src/hyperforge_conditional/py.typed
9
10
  src/hyperforge_conditional.egg-info/PKG-INFO
10
11
  src/hyperforge_conditional.egg-info/SOURCES.txt
11
12
  src/hyperforge_conditional.egg-info/dependency_links.txt