versionhq 1.1.9.1__tar.gz → 1.1.9.3__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.9.1 → versionhq-1.1.9.3}/.gitignore +3 -1
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/PKG-INFO +5 -2
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/README.md +1 -1
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/pyproject.toml +4 -1
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/requirements.txt +70 -5
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/__init__.py +3 -3
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/logger.py +12 -19
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/agent/model.py +0 -5
- versionhq-1.1.9.3/src/versionhq/clients/customer/__init__.py +5 -0
- versionhq-1.1.9.3/src/versionhq/clients/customer/model.py +53 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/clients/product/model.py +9 -8
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/clients/workflow/model.py +16 -23
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/tool/__init__.py +7 -4
- versionhq-1.1.9.3/src/versionhq/tool/composio_tool.py +191 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/tool/model.py +35 -24
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/tool/tool_handler.py +10 -10
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq.egg-info/PKG-INFO +5 -2
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq.egg-info/SOURCES.txt +2 -1
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq.egg-info/requires.txt +3 -0
- versionhq-1.1.9.3/tests/clients/product_test.py +11 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/clients/workflow_test.py +6 -28
- versionhq-1.1.9.3/tests/tool/composio_test.py +37 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/tool/tool_test.py +27 -2
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/uv.lock +358 -32
- versionhq-1.1.9.1/src/versionhq/clients/customer/model.py +0 -41
- versionhq-1.1.9.1/src/versionhq/tool/composio.py +0 -149
- versionhq-1.1.9.1/tests/tool/__init__.py +0 -0
- versionhq-1.1.9.1/tests/tool/composio_test.py +0 -19
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/.github/workflows/publish.yml +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/.github/workflows/publish_testpypi.yml +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/.github/workflows/run_tests.yml +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/.github/workflows/security_check.yml +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/.pre-commit-config.yaml +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/.python-version +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/LICENSE +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/SECURITY.md +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/db/preprocess.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/requirements-dev.txt +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/runtime.txt +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/setup.cfg +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/cache_handler.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/i18n.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/process_config.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/rpm_controller.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/_utils/usage_metrics.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/agent/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/agent/parser.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/cli/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/clients/__init__.py +0 -0
- {versionhq-1.1.9.1/src/versionhq/clients/customer → versionhq-1.1.9.3/src/versionhq/clients/product}/__init__.py +0 -0
- {versionhq-1.1.9.1/src/versionhq/clients/product → versionhq-1.1.9.3/src/versionhq/clients/workflow}/__init__.py +0 -0
- {versionhq-1.1.9.1/src/versionhq/clients/workflow → versionhq-1.1.9.3/src/versionhq/llm}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/llm/llm_vars.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/llm/model.py +0 -0
- {versionhq-1.1.9.1/src/versionhq/llm → versionhq-1.1.9.3/src/versionhq/storage}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/storage/task_output_storage.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/task/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/task/formatter.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/task/log_handler.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/task/model.py +0 -0
- {versionhq-1.1.9.1/src/versionhq/storage → versionhq-1.1.9.3/src/versionhq/team}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/team/model.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/team/team_planner.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq/tool/decorator.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq.egg-info/dependency_links.txt +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/src/versionhq.egg-info/top_level.txt +0 -0
- {versionhq-1.1.9.1/src/versionhq/team → versionhq-1.1.9.3/tests}/__init__.py +0 -0
- {versionhq-1.1.9.1/tests → versionhq-1.1.9.3/tests/agent}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/agent/agent_test.py +0 -0
- {versionhq-1.1.9.1/tests/agent → versionhq-1.1.9.3/tests/cli}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/conftest.py +0 -0
- {versionhq-1.1.9.1/tests/cli → versionhq-1.1.9.3/tests/task}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/task/task_test.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/team/Prompts/Demo_test.py +0 -0
- {versionhq-1.1.9.1/tests/task → versionhq-1.1.9.3/tests/team}/__init__.py +0 -0
- {versionhq-1.1.9.1 → versionhq-1.1.9.3}/tests/team/team_test.py +0 -0
- {versionhq-1.1.9.1/tests/team → versionhq-1.1.9.3/tests/tool}/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: versionhq
|
3
|
-
Version: 1.1.9.
|
3
|
+
Version: 1.1.9.3
|
4
4
|
Summary: LLM orchestration frameworks for model-agnostic AI agents that handle complex outbound workflows
|
5
5
|
Author-email: Kuriko Iwai <kuriko@versi0n.io>
|
6
6
|
License: MIT License
|
@@ -52,12 +52,15 @@ Requires-Dist: setuptools>=75.6.0
|
|
52
52
|
Requires-Dist: wheel>=0.45.1
|
53
53
|
Requires-Dist: python-dotenv>=1.0.0
|
54
54
|
Requires-Dist: appdirs>=1.4.4
|
55
|
+
Requires-Dist: langchain>=0.3.14
|
56
|
+
Requires-Dist: langchain-openai>=0.2.14
|
57
|
+
Requires-Dist: composio-langchain>=0.6.12
|
55
58
|
|
56
59
|
# Overview
|
57
60
|
|
58
61
|

|
59
62
|
[](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml)
|
60
|
-

|
61
64
|

|
62
65
|

|
63
66
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
[](https://github.com/versionHQ/multi-agent-system/actions/workflows/publish.yml)
|
5
|
-

|
6
6
|

|
7
7
|

|
8
8
|
|
@@ -15,7 +15,7 @@ exclude = ["test*", "__pycache__"]
|
|
15
15
|
|
16
16
|
[project]
|
17
17
|
name = "versionhq"
|
18
|
-
version = "1.1.9.
|
18
|
+
version = "1.1.9.3"
|
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"
|
@@ -37,6 +37,9 @@ dependencies = [
|
|
37
37
|
"wheel>=0.45.1",
|
38
38
|
"python-dotenv>=1.0.0",
|
39
39
|
"appdirs>=1.4.4",
|
40
|
+
"langchain>=0.3.14",
|
41
|
+
"langchain-openai>=0.2.14",
|
42
|
+
"composio-langchain>=0.6.12"
|
40
43
|
]
|
41
44
|
classifiers = [
|
42
45
|
"Programming Language :: Python",
|
@@ -5,6 +5,7 @@ aiohappyeyeballs==2.4.4
|
|
5
5
|
aiohttp==3.11.11
|
6
6
|
# via
|
7
7
|
# composio-core
|
8
|
+
# langchain
|
8
9
|
# litellm
|
9
10
|
aiosignal==1.3.2
|
10
11
|
# via aiohttp
|
@@ -43,8 +44,12 @@ click==8.1.8
|
|
43
44
|
# uvicorn
|
44
45
|
composio==0.1.0
|
45
46
|
# via versionhq (pyproject.toml)
|
46
|
-
composio-core==0.6.
|
47
|
-
# via
|
47
|
+
composio-core==0.6.11.post1
|
48
|
+
# via
|
49
|
+
# composio-langchain
|
50
|
+
# composio-openai
|
51
|
+
composio-langchain==0.6.12
|
52
|
+
# via versionhq (pyproject.toml)
|
48
53
|
composio-openai==0.6.9
|
49
54
|
# via versionhq (pyproject.toml)
|
50
55
|
cryptography==44.0.0
|
@@ -69,6 +74,7 @@ httpcore==1.0.7
|
|
69
74
|
# via httpx
|
70
75
|
httpx==0.27.2
|
71
76
|
# via
|
77
|
+
# langsmith
|
72
78
|
# litellm
|
73
79
|
# openai
|
74
80
|
huggingface-hub==0.27.0
|
@@ -91,6 +97,10 @@ jiter==0.8.2
|
|
91
97
|
# via openai
|
92
98
|
json-repair==0.35.0
|
93
99
|
# via versionhq (pyproject.toml)
|
100
|
+
jsonpatch==1.33
|
101
|
+
# via langchain-core
|
102
|
+
jsonpointer==3.0.0
|
103
|
+
# via jsonpatch
|
94
104
|
jsonref==1.1.0
|
95
105
|
# via composio-core
|
96
106
|
jsonschema==4.23.0
|
@@ -99,6 +109,27 @@ jsonschema==4.23.0
|
|
99
109
|
# litellm
|
100
110
|
jsonschema-specifications==2024.10.1
|
101
111
|
# via jsonschema
|
112
|
+
langchain==0.3.14
|
113
|
+
# via
|
114
|
+
# versionhq (pyproject.toml)
|
115
|
+
# composio-langchain
|
116
|
+
langchain-core==0.3.29
|
117
|
+
# via
|
118
|
+
# langchain
|
119
|
+
# langchain-openai
|
120
|
+
# langchain-text-splitters
|
121
|
+
langchain-openai==0.2.14
|
122
|
+
# via
|
123
|
+
# versionhq (pyproject.toml)
|
124
|
+
# composio-langchain
|
125
|
+
langchain-text-splitters==0.3.4
|
126
|
+
# via langchain
|
127
|
+
langchainhub==0.1.21
|
128
|
+
# via composio-langchain
|
129
|
+
langsmith==0.2.10
|
130
|
+
# via
|
131
|
+
# langchain
|
132
|
+
# langchain-core
|
102
133
|
litellm==1.56.5
|
103
134
|
# via versionhq (pyproject.toml)
|
104
135
|
markdown-it-py==3.0.0
|
@@ -113,13 +144,21 @@ multidict==6.1.0
|
|
113
144
|
# via
|
114
145
|
# aiohttp
|
115
146
|
# yarl
|
147
|
+
numpy==2.2.1
|
148
|
+
# via langchain
|
116
149
|
openai==1.58.1
|
117
150
|
# via
|
118
151
|
# versionhq (pyproject.toml)
|
119
152
|
# composio-openai
|
153
|
+
# langchain-openai
|
120
154
|
# litellm
|
155
|
+
orjson==3.10.13
|
156
|
+
# via langsmith
|
121
157
|
packaging==24.2
|
122
|
-
# via
|
158
|
+
# via
|
159
|
+
# huggingface-hub
|
160
|
+
# langchain-core
|
161
|
+
# langchainhub
|
123
162
|
paramiko==3.5.0
|
124
163
|
# via composio-core
|
125
164
|
propcache==0.2.1
|
@@ -132,7 +171,11 @@ pydantic==2.10.4
|
|
132
171
|
# via
|
133
172
|
# versionhq (pyproject.toml)
|
134
173
|
# composio-core
|
174
|
+
# composio-langchain
|
135
175
|
# fastapi
|
176
|
+
# langchain
|
177
|
+
# langchain-core
|
178
|
+
# langsmith
|
136
179
|
# litellm
|
137
180
|
# openai
|
138
181
|
pydantic-core==2.27.2
|
@@ -150,7 +193,10 @@ python-dotenv==1.0.1
|
|
150
193
|
# versionhq (pyproject.toml)
|
151
194
|
# litellm
|
152
195
|
pyyaml==6.0.2
|
153
|
-
# via
|
196
|
+
# via
|
197
|
+
# huggingface-hub
|
198
|
+
# langchain
|
199
|
+
# langchain-core
|
154
200
|
referencing==0.35.1
|
155
201
|
# via
|
156
202
|
# jsonschema
|
@@ -164,8 +210,14 @@ requests==2.32.3
|
|
164
210
|
# versionhq (pyproject.toml)
|
165
211
|
# composio-core
|
166
212
|
# huggingface-hub
|
213
|
+
# langchain
|
214
|
+
# langchainhub
|
215
|
+
# langsmith
|
167
216
|
# pysher
|
217
|
+
# requests-toolbelt
|
168
218
|
# tiktoken
|
219
|
+
requests-toolbelt==1.0.0
|
220
|
+
# via langsmith
|
169
221
|
rich==13.9.4
|
170
222
|
# via composio-core
|
171
223
|
rpds-py==0.22.3
|
@@ -183,29 +235,42 @@ sniffio==1.3.1
|
|
183
235
|
# anyio
|
184
236
|
# httpx
|
185
237
|
# openai
|
238
|
+
sqlalchemy==2.0.36
|
239
|
+
# via langchain
|
186
240
|
starlette==0.41.3
|
187
241
|
# via fastapi
|
242
|
+
tenacity==9.0.0
|
243
|
+
# via
|
244
|
+
# langchain
|
245
|
+
# langchain-core
|
188
246
|
tiktoken==0.8.0
|
189
|
-
# via
|
247
|
+
# via
|
248
|
+
# langchain-openai
|
249
|
+
# litellm
|
190
250
|
tokenizers==0.21.0
|
191
251
|
# via litellm
|
192
252
|
tqdm==4.67.1
|
193
253
|
# via
|
194
254
|
# huggingface-hub
|
195
255
|
# openai
|
256
|
+
types-requests==2.32.0.20241016
|
257
|
+
# via langchainhub
|
196
258
|
typing==3.10.0.0
|
197
259
|
# via versionhq (pyproject.toml)
|
198
260
|
typing-extensions==4.12.2
|
199
261
|
# via
|
200
262
|
# fastapi
|
201
263
|
# huggingface-hub
|
264
|
+
# langchain-core
|
202
265
|
# openai
|
203
266
|
# pydantic
|
204
267
|
# pydantic-core
|
268
|
+
# sqlalchemy
|
205
269
|
urllib3==2.3.0
|
206
270
|
# via
|
207
271
|
# requests
|
208
272
|
# sentry-sdk
|
273
|
+
# types-requests
|
209
274
|
uvicorn==0.34.0
|
210
275
|
# via composio-core
|
211
276
|
websocket-client==1.8.0
|
@@ -15,10 +15,10 @@ from versionhq.llm.model import LLM
|
|
15
15
|
from versionhq.task.model import Task, TaskOutput
|
16
16
|
from versionhq.team.model import Team, TeamOutput
|
17
17
|
from versionhq.tool.model import Tool
|
18
|
-
from versionhq.tool.
|
18
|
+
from versionhq.tool.composio_tool import ComposioHandler
|
19
19
|
|
20
20
|
|
21
|
-
__version__ = "1.1.9.
|
21
|
+
__version__ = "1.1.9.3"
|
22
22
|
__all__ = [
|
23
23
|
"Agent",
|
24
24
|
"Customer",
|
@@ -34,5 +34,5 @@ __all__ = [
|
|
34
34
|
"Team",
|
35
35
|
"TeamOutput",
|
36
36
|
"Tool",
|
37
|
-
"
|
37
|
+
"ComposioHandler"
|
38
38
|
]
|
@@ -10,23 +10,21 @@ class Printer:
|
|
10
10
|
self._print_purple(content)
|
11
11
|
elif color == "red":
|
12
12
|
self._print_red(content)
|
13
|
-
elif color == "
|
14
|
-
self.
|
15
|
-
elif color == "
|
16
|
-
self.
|
17
|
-
elif color == "
|
18
|
-
self.
|
13
|
+
elif color == "green":
|
14
|
+
self._print_green(content)
|
15
|
+
elif color == "purple":
|
16
|
+
self._print_purple(content)
|
17
|
+
elif color == "blue":
|
18
|
+
self._print_blue(content)
|
19
19
|
elif color == "yellow":
|
20
20
|
self._print_yellow(content)
|
21
|
-
elif color == "bold_yellow":
|
22
|
-
self._print_bold_yellow(content)
|
23
21
|
else:
|
24
22
|
print(content)
|
25
23
|
|
26
|
-
def
|
24
|
+
def _print_purple(self, content):
|
27
25
|
print("\033[1m\033[95m {}\033[00m".format(content))
|
28
26
|
|
29
|
-
def
|
27
|
+
def _print_green(self, content):
|
30
28
|
print("\033[1m\033[92m {}\033[00m".format(content))
|
31
29
|
|
32
30
|
def _print_purple(self, content):
|
@@ -35,23 +33,18 @@ class Printer:
|
|
35
33
|
def _print_red(self, content):
|
36
34
|
print("\033[91m {}\033[00m".format(content))
|
37
35
|
|
38
|
-
def
|
36
|
+
def _print_blue(self, content):
|
39
37
|
print("\033[1m\033[94m {}\033[00m".format(content))
|
40
38
|
|
41
39
|
def _print_yellow(self, content):
|
42
|
-
print("\033[93m {}\033[00m".format(content))
|
43
|
-
|
44
|
-
def _print_bold_yellow(self, content):
|
45
40
|
print("\033[1m\033[93m {}\033[00m".format(content))
|
46
41
|
|
47
42
|
|
48
43
|
class Logger(BaseModel):
|
49
|
-
verbose: bool = Field(default=
|
44
|
+
verbose: bool = Field(default=True)
|
50
45
|
_printer: Printer = PrivateAttr(default_factory=Printer)
|
51
46
|
|
52
|
-
def log(self, level, message, color="
|
47
|
+
def log(self, level, message, color="yellow"):
|
53
48
|
if self.verbose:
|
54
49
|
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
55
|
-
self._printer.print(
|
56
|
-
f"\n[{timestamp}][{level.upper()}]: {message}", color=color
|
57
|
-
)
|
50
|
+
self._printer.print(f"\n[{timestamp}][{level.upper()}]: {message}", color=color)
|
@@ -6,11 +6,9 @@ from dotenv import load_dotenv
|
|
6
6
|
from pydantic import UUID4, BaseModel, Field, InstanceOf, PrivateAttr, model_validator, field_validator
|
7
7
|
from pydantic_core import PydanticCustomError
|
8
8
|
|
9
|
-
from versionhq._utils.cache_handler import CacheHandler
|
10
9
|
from versionhq._utils.logger import Logger
|
11
10
|
from versionhq._utils.rpm_controller import RPMController
|
12
11
|
from versionhq._utils.usage_metrics import UsageMetrics
|
13
|
-
from versionhq.agent.parser import AgentAction
|
14
12
|
from versionhq.llm.llm_vars import LLM_VARS
|
15
13
|
from versionhq.llm.model import LLM, DEFAULT_CONTEXT_WINDOW
|
16
14
|
from versionhq.task import TaskOutputFormat
|
@@ -122,10 +120,7 @@ class Agent(BaseModel):
|
|
122
120
|
|
123
121
|
# config, cache, error handling
|
124
122
|
config: Optional[Dict[str, Any]] = Field(default=None, exclude=True, description="Configuration for the agent")
|
125
|
-
cache: bool = Field(default=True, description="Whether the agent should use a cache for tool usage.")
|
126
|
-
cache_handler: InstanceOf[CacheHandler] = Field(default=None, description="An instance of the CacheHandler class.")
|
127
123
|
formatting_errors: int = Field(default=0, description="Number of formatting errors.")
|
128
|
-
verbose: bool = Field(default=True, description="Verbose mode for the Agent Execution")
|
129
124
|
agent_ops_agent_name: str = None
|
130
125
|
agent_ops_agent_id: str = None
|
131
126
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import uuid
|
2
|
+
from abc import ABC, abstractmethod
|
3
|
+
from typing import Any, Dict, List, Callable, Type, Optional, get_args, get_origin
|
4
|
+
from pydantic import UUID4, InstanceOf, BaseModel, ConfigDict, Field, create_model, field_validator, model_validator
|
5
|
+
from pydantic_core import PydanticCustomError
|
6
|
+
|
7
|
+
from versionhq.clients.product.model import Product, ProductProvider
|
8
|
+
from versionhq.clients.customer import Status
|
9
|
+
|
10
|
+
|
11
|
+
class BaseCustomer(ABC, BaseModel):
|
12
|
+
"""
|
13
|
+
Abstract base class for the base customer
|
14
|
+
"""
|
15
|
+
|
16
|
+
id: UUID4 = Field(default_factory=uuid.uuid4, frozen=True)
|
17
|
+
name: Optional[str] = Field(default=None, description="customer's name if any")
|
18
|
+
products: Optional[List[Product]] = Field(default=list, description="store products that the customer is associated with")
|
19
|
+
analysis: str = Field(default=None, description="store the latest analysis results on the customer")
|
20
|
+
status: str = Field(default=Status.ON_WORKFLOW)
|
21
|
+
|
22
|
+
|
23
|
+
@field_validator("id", mode="before")
|
24
|
+
@classmethod
|
25
|
+
def _deny_user_set_id(cls, v: Optional[UUID4]) -> None:
|
26
|
+
if v:
|
27
|
+
raise PydanticCustomError("may_not_set_field", "This field is not to be set by the user.", {})
|
28
|
+
|
29
|
+
|
30
|
+
def customer_to(self) -> List[ProductProvider]:
|
31
|
+
"""
|
32
|
+
Return list of ProductProvider if the customer has `product_list`
|
33
|
+
"""
|
34
|
+
|
35
|
+
res = []
|
36
|
+
if self.products:
|
37
|
+
for item in self.products:
|
38
|
+
if item.provider not in res:
|
39
|
+
res.appned(item.provider)
|
40
|
+
return res
|
41
|
+
|
42
|
+
|
43
|
+
@abstractmethod
|
44
|
+
def _deploy(self, *args, **kwargs) -> Any:
|
45
|
+
"""Any method to deploy targeting the customer"""
|
46
|
+
|
47
|
+
|
48
|
+
class Customer(BaseCustomer):
|
49
|
+
id: UUID4 = Field(default_factory=uuid.uuid4, frozen=True)
|
50
|
+
name: Optional[str] = Field(default=None, description="customer's name if any")
|
51
|
+
products: Optional[List[Product]] = Field(default=list, description="store products that the customer is associated with")
|
52
|
+
analysis: str = Field(default=None, description="store the latest analysis results on the customer")
|
53
|
+
status: str = Field(default=Status.ON_WORKFLOW)
|
@@ -1,22 +1,23 @@
|
|
1
1
|
import uuid
|
2
|
+
from abc import ABC, abstractmethod
|
2
3
|
from typing import Any, Dict, List, Callable, Type, Optional, get_args, get_origin
|
4
|
+
|
3
5
|
from pydantic import UUID4, InstanceOf, BaseModel, ConfigDict, Field, create_model, field_validator, model_validator
|
4
6
|
from pydantic_core import PydanticCustomError
|
5
7
|
|
8
|
+
from versionhq.tool import ComposioAppName
|
9
|
+
|
6
10
|
|
7
|
-
class ProductProvider(BaseModel):
|
11
|
+
class ProductProvider(ABC, BaseModel):
|
8
12
|
"""
|
9
|
-
|
10
|
-
`data_pipeline` and `destinations` are for composio plug-in.
|
11
|
-
(!REFINEME) Create an Enum list for the options.
|
12
|
-
(!REFINEME) Create an Enum list for regions.
|
13
|
+
Abstract class for the product provider entity.
|
13
14
|
"""
|
14
15
|
|
15
16
|
id: UUID4 = Field(default_factory=uuid.uuid4, frozen=True)
|
16
|
-
name: Optional[str] = Field(default=None
|
17
|
+
name: Optional[str] = Field(default=None)
|
17
18
|
region: Optional[str] = Field(default=None, description="region of client's main business operation")
|
18
|
-
|
19
|
-
|
19
|
+
data_pipelines: Optional[List[ComposioAppName | str]] = Field(default_factory=list)
|
20
|
+
destination_services: Optional[List[ComposioAppName | str]] = Field(default=None)
|
20
21
|
|
21
22
|
@field_validator("id", mode="before")
|
22
23
|
@classmethod
|
@@ -10,6 +10,7 @@ from versionhq.clients.product.model import Product
|
|
10
10
|
from versionhq.clients.customer.model import Customer
|
11
11
|
from versionhq.agent.model import Agent
|
12
12
|
from versionhq.team.model import Team
|
13
|
+
from versionhq.tool import ComposioAppName
|
13
14
|
|
14
15
|
|
15
16
|
class ScoreFormat:
|
@@ -57,14 +58,12 @@ class Score:
|
|
57
58
|
class MessagingComponent(ABC, BaseModel):
|
58
59
|
layer_id: int = Field(default=0, description="add id of the layer: 0, 1, 2")
|
59
60
|
message: str = Field(default=None, max_length=1024, description="text message content to be sent")
|
60
|
-
|
61
|
-
|
62
|
-
)
|
63
|
-
score: float | InstanceOf[Score] = Field(default=None)
|
64
|
-
condition: str = Field(default=None, max_length=128, description="condition to execute the next messaging component")
|
61
|
+
score: InstanceOf[Score] = Field(default=None)
|
62
|
+
condition: str = Field(default=None, max_length=128, description="condition to execute the next component")
|
63
|
+
interval: Optional[str] = Field(default=None, description="ideal interval to set to assess the condition")
|
65
64
|
|
66
65
|
|
67
|
-
def store_scoring_result(self,
|
66
|
+
def store_scoring_result(self, subject: str, score_raw: int | Score | ScoreFormat = None) -> Self:
|
68
67
|
"""
|
69
68
|
Set up the `score` field
|
70
69
|
"""
|
@@ -74,12 +73,12 @@ class MessagingComponent(ABC, BaseModel):
|
|
74
73
|
|
75
74
|
elif isinstance(score_raw, ScoreFormat):
|
76
75
|
score_instance = Score()
|
77
|
-
setattr(score_instance,
|
76
|
+
setattr(score_instance, subject, score_raw)
|
78
77
|
setattr(self, "score", score_instance)
|
79
78
|
|
80
79
|
elif isinstance(score_raw, int) or isinstance(score_raw, float):
|
81
80
|
score_instance, score_format_instance = Score(), ScoreFormat(rate=score_raw, weight=1)
|
82
|
-
setattr(score_instance, "kwargs", {
|
81
|
+
setattr(score_instance, "kwargs", { subject: score_format_instance })
|
83
82
|
setattr(self, "score", score_instance)
|
84
83
|
|
85
84
|
else:
|
@@ -100,23 +99,17 @@ class MessagingWorkflow(ABC, BaseModel):
|
|
100
99
|
model_config = ConfigDict()
|
101
100
|
|
102
101
|
id: UUID4 = Field(default_factory=uuid.uuid4, frozen=True)
|
103
|
-
|
102
|
+
messaging_components: List[MessagingComponent] = Field(default_factory=list, description="store messaging components in the workflow")
|
104
103
|
|
105
104
|
# responsible tean or agents
|
106
|
-
team: Optional[Team] = Field(default=None, description="store
|
107
|
-
agents: Optional[List[Agent]] = Field(
|
108
|
-
default=None, description="store `Agent` instances responsible for autopiloting this workflow. if the team exsits, this field remains as `None`")
|
105
|
+
team: Optional[Team] = Field(default=None, description="store a responsibile team to autopilot the workflow")
|
106
|
+
agents: Optional[List[Agent]] = Field(default=None, description="store responsible agents. None when the team exists")
|
109
107
|
|
110
108
|
# metrics
|
111
|
-
destination: Optional[
|
109
|
+
destination: Optional[ComposioAppName | str] = Field(default=None, description="destination service to launch the workflow")
|
112
110
|
product: InstanceOf[Product] = Field(default=None)
|
113
111
|
customer: InstanceOf[Customer] = Field(default=None)
|
114
|
-
|
115
|
-
metrics: List[Dict[str, Any]] | List[str] = Field(
|
116
|
-
default=None,
|
117
|
-
max_length=256,
|
118
|
-
description="store metrics that used to predict and track the performance of this workflow."
|
119
|
-
)
|
112
|
+
performance_metrics: List[Dict[str, Any]] | List[str] = Field(default=None, max_length=256, description="performance metrics to track")
|
120
113
|
|
121
114
|
@field_validator("id", mode="before")
|
122
115
|
@classmethod
|
@@ -132,11 +125,11 @@ class MessagingWorkflow(ABC, BaseModel):
|
|
132
125
|
Prioritize customer's destination to the product provider's destination list.
|
133
126
|
"""
|
134
127
|
if self.destination is None:
|
135
|
-
if self.customer is not None:
|
136
|
-
|
128
|
+
# if self.customer is not None:
|
129
|
+
# self.destination = self.customer.on
|
137
130
|
|
138
|
-
|
139
|
-
self.destination = self.product.provider.
|
131
|
+
if self.product.provider is not None and self.product.provider.destination_services:
|
132
|
+
self.destination = self.product.provider.destination_services[0]
|
140
133
|
|
141
134
|
return self
|
142
135
|
|
@@ -40,10 +40,11 @@ composio_app_set = [
|
|
40
40
|
(ComposioAppName.LINKEDIN, ComposioAuthScheme.OAUTH2),
|
41
41
|
]
|
42
42
|
|
43
|
-
class
|
44
|
-
INITIATED = "
|
45
|
-
ACTIVE = "
|
46
|
-
FAILED = "
|
43
|
+
class ComposioStatus(str, Enum):
|
44
|
+
INITIATED = "INITIATED"
|
45
|
+
ACTIVE = "ACTIVE"
|
46
|
+
FAILED = "FAILED"
|
47
|
+
|
47
48
|
|
48
49
|
|
49
50
|
|
@@ -51,3 +52,5 @@ class ComposioAction(str, Enum):
|
|
51
52
|
"""
|
52
53
|
Enum to store composio's action that can be called via `Actions.xxx`
|
53
54
|
"""
|
55
|
+
# HUBSPOT_INITIATE_DATA_IMPORT_PROCESS = "hubspot_initate_date_import_process"
|
56
|
+
HUBSPOT_CREATE_PIPELINE_STAGE = "hubspot_create_pipeline_stage"
|