versionhq 1.1.7.1__tar.gz → 1.1.7.2__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.
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/PKG-INFO +1 -1
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/pyproject.toml +1 -1
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/__init__.py +1 -1
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/agent/model.py +1 -1
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/task/model.py +8 -5
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq.egg-info/PKG-INFO +1 -1
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/task/task_test.py +57 -1
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.github/workflows/publish.yml +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.github/workflows/publish_testpypi.yml +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.github/workflows/run_tests.yml +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.github/workflows/security_check.yml +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.gitignore +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.pre-commit-config.yaml +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/.python-version +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/LICENSE +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/README.md +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/SECURITY.md +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/db/preprocess.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/requirements.txt +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/runtime.txt +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/setup.cfg +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/cache_handler.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/i18n.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/logger.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/process_config.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/rpm_controller.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/_utils/usage_metrics.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/agent/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/agent/parser.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/cli/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/customer/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/customer/model.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/product/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/product/model.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/workflow/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/clients/workflow/model.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/llm/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/llm/llm_vars.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/llm/model.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/task/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/task/formatter.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/team/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/team/model.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/team/team_planner.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/tool/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/tool/decorator.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/tool/model.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq/tool/tool_handler.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq.egg-info/SOURCES.txt +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq.egg-info/dependency_links.txt +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq.egg-info/requires.txt +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/src/versionhq.egg-info/top_level.txt +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/agent/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/agent/agent_test.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/cli/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/conftest.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/task/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/team/Prompts/Demo_test.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/team/__init__.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/tests/team/team_test.py +0 -0
- {versionhq-1.1.7.1 → versionhq-1.1.7.2}/uv.lock +0 -0
@@ -15,7 +15,7 @@ exclude = ["test*", "__pycache__"]
|
|
15
15
|
|
16
16
|
[project]
|
17
17
|
name = "versionhq"
|
18
|
-
version = "1.1.7.
|
18
|
+
version = "1.1.7.2"
|
19
19
|
authors = [{ name = "Kuriko Iwai", email = "kuriko@versi0n.io" }]
|
20
20
|
description = "LLM orchestration frameworks for model-agnostic AI agents that handle complex outbound workflows"
|
21
21
|
readme = "README.md"
|
@@ -367,7 +367,7 @@ class Agent(ABC, BaseModel):
|
|
367
367
|
"""
|
368
368
|
|
369
369
|
task_prompt = task.prompt()
|
370
|
-
if context:
|
370
|
+
if context is not task.prompt_context: # as `task.prompt()` includes adding `task.prompt_context` to the prompt.
|
371
371
|
task_prompt += context
|
372
372
|
|
373
373
|
tool_results = []
|
@@ -153,7 +153,7 @@ class Task(BaseModel):
|
|
153
153
|
tools_called: Optional[List[ToolCalled]] = Field(default_factory=list, description="tools that the agent can use for this task")
|
154
154
|
take_tool_res_as_final: bool = Field(default=False,description="when set True, tools res will be stored in the `TaskOutput`")
|
155
155
|
|
156
|
-
prompt_context: Optional[str] = None
|
156
|
+
prompt_context: Optional[str] = Field(default=None)
|
157
157
|
async_execution: bool = Field(default=False,description="whether the task should be executed asynchronously or not")
|
158
158
|
config: Optional[Dict[str, Any]] = Field(default=None, description="configuration for the agent")
|
159
159
|
callback: Optional[Any] = Field(default=None, description="callback to be executed after the task is completed.")
|
@@ -278,17 +278,20 @@ Your outputs MUST adhere to the following format and should NOT include any irre
|
|
278
278
|
When we have cusotmer/product info, add them to the prompt.
|
279
279
|
"""
|
280
280
|
|
281
|
-
task_slices = [self.description, f"{self.output_prompt}"]
|
281
|
+
task_slices = [self.description, f"{self.output_prompt}", f"Take the following context into consideration: "]
|
282
282
|
|
283
283
|
if self.context:
|
284
284
|
context_outputs = "\n".join([task.output.context_prompting() if hasattr(task, "output") else "" for task in self.context])
|
285
|
-
task_slices.insert(
|
285
|
+
task_slices.insert(len(task_slices), context_outputs)
|
286
286
|
|
287
287
|
if customer:
|
288
|
-
task_slices.insert(
|
288
|
+
task_slices.insert(len(task_slices), f"Customer overview: {customer}")
|
289
289
|
|
290
290
|
if product_overview:
|
291
|
-
task_slices.insert(
|
291
|
+
task_slices.insert(len(task_slices), f"Product overview: {product_overview}")
|
292
|
+
|
293
|
+
if self.prompt_context:
|
294
|
+
task_slices.insert(len(task_slices), self.prompt_context)
|
292
295
|
|
293
296
|
return "\n".join(task_slices)
|
294
297
|
|
@@ -51,7 +51,7 @@ def test_sync_execute_task():
|
|
51
51
|
assert type(res.pydantic.test2) == list
|
52
52
|
|
53
53
|
|
54
|
-
def
|
54
|
+
def test_sync_execute_task_with_task_context():
|
55
55
|
"""
|
56
56
|
Use case = One agent handling multiple tasks sequentially using context set in the main task.
|
57
57
|
"""
|
@@ -109,4 +109,60 @@ def test_sync_execute_task_with_context():
|
|
109
109
|
assert "result" in main_task.prompt()
|
110
110
|
|
111
111
|
|
112
|
+
def test_sync_execute_task_with_prompt_context():
|
113
|
+
agent = Agent(
|
114
|
+
role="demo agent 001",
|
115
|
+
goal="My amazing goals",
|
116
|
+
backstory="My amazing backstory",
|
117
|
+
verbose=True,
|
118
|
+
llm=DEFAULT_MODEL_NAME,
|
119
|
+
max_tokens=3000,
|
120
|
+
)
|
121
|
+
|
122
|
+
sub_task = Task(
|
123
|
+
description="analyze the client's business model",
|
124
|
+
expected_output_json=True,
|
125
|
+
expected_output_pydantic=False,
|
126
|
+
output_field_list=[
|
127
|
+
ResponseField(title="result", type=str, required=True),
|
128
|
+
]
|
129
|
+
)
|
130
|
+
main_task = Task(
|
131
|
+
description="Define the optimal cohort timeframe in days and target audience.",
|
132
|
+
expected_output_json=True,
|
133
|
+
expected_output_pydantic=True,
|
134
|
+
output_field_list=[
|
135
|
+
ResponseField(title="test1", type=int, required=True),
|
136
|
+
ResponseField(title="test2", type=str, required=True),
|
137
|
+
],
|
138
|
+
context=[sub_task]
|
139
|
+
)
|
140
|
+
res = main_task.execute_sync(agent=agent, context="consider building black friday marketing campaign.")
|
141
|
+
|
142
|
+
assert isinstance(res, TaskOutput)
|
143
|
+
assert res.task_id is main_task.id
|
144
|
+
assert res.raw is not None
|
145
|
+
assert isinstance(res.raw, str)
|
146
|
+
assert res.json_dict is not None
|
147
|
+
assert isinstance(res.json_dict, dict)
|
148
|
+
assert res.pydantic is not None
|
149
|
+
|
150
|
+
if hasattr(res.pydantic, "output"):
|
151
|
+
assert res.pydantic.output is not None
|
152
|
+
else:
|
153
|
+
assert hasattr(res.pydantic, "test1")
|
154
|
+
if res.pydantic.test1:
|
155
|
+
assert type(res.pydantic.test1) == Union[int, str]
|
156
|
+
|
157
|
+
assert hasattr(res.pydantic, "test2")
|
158
|
+
if res.pydantic.test2:
|
159
|
+
assert type(res.pydantic.test2) == Union[list, str]
|
160
|
+
|
161
|
+
assert sub_task.output is not None
|
162
|
+
assert sub_task.output.json_dict is not None
|
163
|
+
assert "result" in main_task.prompt()
|
164
|
+
assert main_task.prompt_context == "consider building black friday marketing campaign."
|
165
|
+
assert "consider building black friday marketing campaign." in main_task.prompt()
|
166
|
+
|
167
|
+
|
112
168
|
# CALLBACKS, tools, FUTURE, ASYNC, CONDITIONAL, token usage
|
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
|
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
|
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
|
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
|
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
|