versionhq 1.2.1.17__tar.gz → 1.2.1.18__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.2.1.17 → versionhq-1.2.1.18}/PKG-INFO +1 -1
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/pyproject.toml +1 -1
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/__init__.py +1 -1
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/_utils/process_config.py +1 -1
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/model.py +91 -88
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent_network/formation.py +3 -3
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq.egg-info/PKG-INFO +1 -1
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task/task_test.py +0 -8
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.env.sample +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.github/workflows/deploy_docs.yml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.github/workflows/publish.yml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.github/workflows/publish_testpypi.yml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.github/workflows/run_tests.yml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.github/workflows/security_check.yml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.gitignore +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.pre-commit-config.yaml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/.python-version +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/LICENSE +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/README.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/SECURITY.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/db/preprocess.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/CNAME +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/_logos/favicon.ico +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/_logos/logo192.png +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/agent/config.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/agent/index.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/agent/ref.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/agent/task-handling.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/agent-network/index.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/llm/index.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/task/evaluation.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/task/index.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/task/response-field.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/task/task-output.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/task-graph/index.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/core/tool.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/index.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/quickstart.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/stylesheets/main.css +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/docs/tags.md +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/mkdocs.yml +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/requirements-dev.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/requirements.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/runtime.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/setup.cfg +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/_utils/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/_utils/i18n.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/_utils/logger.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/_utils/usage_metrics.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/_utils/vars.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/TEMPLATES/Backstory.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/TEMPLATES/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/inhouse_agents.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/parser.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent/rpm_controller.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent_network/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/agent_network/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/cli/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/customer/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/customer/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/product/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/product/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/workflow/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/clients/workflow/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/_utils.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/embedding.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/source.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/source_docling.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/knowledge/storage.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/llm/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/llm/llm_vars.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/llm/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/memory/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/memory/contextual_memory.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/memory/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/base.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/ltm_sqlite_storage.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/mem0_storage.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/rag_storage.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/task_output_storage.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/storage/utils.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/TEMPLATES/Description.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/evaluate.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/formatter.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/log_handler.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task/structured_response.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task_graph/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task_graph/colors.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task_graph/draft.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/task_graph/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/cache_handler.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/composio_tool.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/composio_tool_vars.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/decorator.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/model.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq/tool/tool_handler.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq.egg-info/SOURCES.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq.egg-info/dependency_links.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq.egg-info/requires.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/src/versionhq.egg-info/top_level.txt +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/agent/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/agent/agent_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/agent/doc_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/agent_network/Prompts/Demo_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/agent_network/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/agent_network/agent_network_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/cli/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/clients/customer_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/clients/product_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/clients/workflow_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/conftest.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/doc_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/formation_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/knowledge/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/knowledge/knowledge_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/knowledge/mock_report_compressed.pdf +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/llm/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/llm/llm_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/memory/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/memory/memory_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task/doc_taskoutput_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task/doc_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task/llm_connection_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task_graph/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task_graph/doc_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/task_graph/task_graph_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/tool/__init__.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/tool/composio_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/tool/doc_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/tool/tool_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/tests/usecase_test.py +0 -0
- {versionhq-1.2.1.17 → versionhq-1.2.1.18}/uv.lock +0 -0
@@ -15,7 +15,7 @@ exclude = ["test*", "__pycache__", "*.egg-info"]
|
|
15
15
|
|
16
16
|
[project]
|
17
17
|
name = "versionhq"
|
18
|
-
version = "1.2.1.
|
18
|
+
version = "1.2.1.18"
|
19
19
|
authors = [{ name = "Kuriko Iwai", email = "kuriko@versi0n.io" }]
|
20
20
|
description = "An agentic orchestration framework for building agent networks that handle task automation."
|
21
21
|
readme = "README.md"
|
@@ -8,7 +8,7 @@ def process_config(values_to_update: Dict[str, Any], model_class: Type[BaseModel
|
|
8
8
|
Refer to the Pydantic model class for field validation.
|
9
9
|
"""
|
10
10
|
|
11
|
-
config = values_to_update.pop("config"
|
11
|
+
config = values_to_update.pop("config") if "config" in values_to_update else {}
|
12
12
|
|
13
13
|
if config:
|
14
14
|
for k, v in config.items():
|
@@ -149,94 +149,6 @@ class Agent(BaseModel):
|
|
149
149
|
return self
|
150
150
|
|
151
151
|
|
152
|
-
def _convert_to_llm_object(self, llm: Any = None) -> LLM:
|
153
|
-
"""
|
154
|
-
Convert the given value to LLM object.
|
155
|
-
When `llm` is dict or self.llm_config is not None, add these values to the LLM object after validating them.
|
156
|
-
"""
|
157
|
-
llm = llm if llm else self.llm if self.llm else DEFAULT_MODEL_NAME
|
158
|
-
|
159
|
-
if not llm:
|
160
|
-
pass
|
161
|
-
|
162
|
-
match llm:
|
163
|
-
case LLM():
|
164
|
-
return self._set_llm_params(llm=llm, config=self.llm_config)
|
165
|
-
|
166
|
-
case str():
|
167
|
-
llm_obj = LLM(model=llm)
|
168
|
-
return self._set_llm_params(llm=llm_obj, config=self.llm_config)
|
169
|
-
|
170
|
-
case dict():
|
171
|
-
model_name = llm.pop("model_name", llm.pop("deployment_name", str(llm)))
|
172
|
-
llm_obj = LLM(model=model_name if model_name else DEFAULT_MODEL_NAME)
|
173
|
-
config = llm.update(self.llm_config) if self.llm_config else llm
|
174
|
-
return self._set_llm_params(llm_obj, config=config)
|
175
|
-
|
176
|
-
case _:
|
177
|
-
model_name = (getattr(self.llm, "model_name") or getattr(self.llm, "deployment_name") or str(self.llm))
|
178
|
-
llm_obj = LLM(model=model_name if model_name else DEFAULT_MODEL_NAME)
|
179
|
-
llm_params = {
|
180
|
-
"max_tokens": (getattr(llm, "max_tokens") or 3000),
|
181
|
-
"timeout": getattr(llm, "timeout", self.max_execution_time),
|
182
|
-
"callbacks": getattr(llm, "callbacks", None),
|
183
|
-
"temperature": getattr(llm, "temperature", None),
|
184
|
-
"logprobs": getattr(llm, "logprobs", None),
|
185
|
-
"api_key": getattr(llm, "api_key", os.environ.get("LITELLM_API_KEY", None)),
|
186
|
-
"base_url": getattr(llm, "base_url", None),
|
187
|
-
}
|
188
|
-
config = llm_params.update(self.llm_config) if self.llm_config else llm_params
|
189
|
-
return self._set_llm_params(llm=llm_obj, config=config)
|
190
|
-
|
191
|
-
|
192
|
-
def _set_llm_params(self, llm: LLM, config: Dict[str, Any] = None) -> LLM:
|
193
|
-
"""
|
194
|
-
Add valid params to the LLM object.
|
195
|
-
"""
|
196
|
-
|
197
|
-
import litellm
|
198
|
-
from versionhq.llm.llm_vars import PARAMS
|
199
|
-
|
200
|
-
valid_config = {k: v for k, v in config.items() if v} if config else {}
|
201
|
-
|
202
|
-
if valid_config:
|
203
|
-
valid_keys = list()
|
204
|
-
try:
|
205
|
-
valid_keys = litellm.get_supported_openai_params(model=llm.model, custom_llm_provider=self.endpoint_provider, request_type="chat_completion")
|
206
|
-
if not valid_keys:
|
207
|
-
valid_keys = PARAMS.get("common")
|
208
|
-
except:
|
209
|
-
valid_keys = PARAMS.get("common")
|
210
|
-
|
211
|
-
valid_keys += PARAMS.get("litellm")
|
212
|
-
|
213
|
-
for key in valid_keys:
|
214
|
-
if key in valid_config and valid_config[key]:
|
215
|
-
val = valid_config[key]
|
216
|
-
if [key == k for k, v in LLM.model_fields.items()]:
|
217
|
-
setattr(llm, key, val)
|
218
|
-
else:
|
219
|
-
llm.other_valid_config.update({ key: val})
|
220
|
-
|
221
|
-
|
222
|
-
llm.timeout = self.max_execution_time if llm.timeout is None else llm.timeout
|
223
|
-
# llm.max_tokens = self.max_tokens if self.max_tokens else llm.max_tokens
|
224
|
-
|
225
|
-
if llm.provider is None:
|
226
|
-
provider_name = llm.model.split("/")[0]
|
227
|
-
valid_provider = provider_name if provider_name in PROVIDERS else None
|
228
|
-
llm.provider = valid_provider
|
229
|
-
|
230
|
-
if self.callbacks:
|
231
|
-
llm.callbacks = self.callbacks
|
232
|
-
llm._set_callbacks(llm.callbacks)
|
233
|
-
|
234
|
-
if self.respect_context_window == False:
|
235
|
-
llm.context_window_size = DEFAULT_CONTEXT_WINDOW_SIZE
|
236
|
-
|
237
|
-
return llm
|
238
|
-
|
239
|
-
|
240
152
|
@model_validator(mode="after")
|
241
153
|
def set_up_tools(self) -> Self:
|
242
154
|
"""
|
@@ -369,6 +281,94 @@ class Agent(BaseModel):
|
|
369
281
|
return self
|
370
282
|
|
371
283
|
|
284
|
+
def _convert_to_llm_object(self, llm: Any = None) -> LLM:
|
285
|
+
"""
|
286
|
+
Convert the given value to LLM object.
|
287
|
+
When `llm` is dict or self.llm_config is not None, add these values to the LLM object after validating them.
|
288
|
+
"""
|
289
|
+
llm = llm if llm else self.llm if self.llm else DEFAULT_MODEL_NAME
|
290
|
+
|
291
|
+
if not llm:
|
292
|
+
pass
|
293
|
+
|
294
|
+
match llm:
|
295
|
+
case LLM():
|
296
|
+
return self._set_llm_params(llm=llm, config=self.llm_config)
|
297
|
+
|
298
|
+
case str():
|
299
|
+
llm_obj = LLM(model=llm)
|
300
|
+
return self._set_llm_params(llm=llm_obj, config=self.llm_config)
|
301
|
+
|
302
|
+
case dict():
|
303
|
+
model_name = llm.pop("model_name", llm.pop("deployment_name", str(llm)))
|
304
|
+
llm_obj = LLM(model=model_name if model_name else DEFAULT_MODEL_NAME)
|
305
|
+
config = llm.update(self.llm_config) if self.llm_config else llm
|
306
|
+
return self._set_llm_params(llm_obj, config=config)
|
307
|
+
|
308
|
+
case _:
|
309
|
+
model_name = (getattr(self.llm, "model_name") or getattr(self.llm, "deployment_name") or str(self.llm))
|
310
|
+
llm_obj = LLM(model=model_name if model_name else DEFAULT_MODEL_NAME)
|
311
|
+
llm_params = {
|
312
|
+
"max_tokens": (getattr(llm, "max_tokens") or 3000),
|
313
|
+
"timeout": getattr(llm, "timeout", self.max_execution_time),
|
314
|
+
"callbacks": getattr(llm, "callbacks", None),
|
315
|
+
"temperature": getattr(llm, "temperature", None),
|
316
|
+
"logprobs": getattr(llm, "logprobs", None),
|
317
|
+
"api_key": getattr(llm, "api_key", os.environ.get("LITELLM_API_KEY", None)),
|
318
|
+
"base_url": getattr(llm, "base_url", None),
|
319
|
+
}
|
320
|
+
config = llm_params.update(self.llm_config) if self.llm_config else llm_params
|
321
|
+
return self._set_llm_params(llm=llm_obj, config=config)
|
322
|
+
|
323
|
+
|
324
|
+
def _set_llm_params(self, llm: LLM, config: Dict[str, Any] = None) -> LLM:
|
325
|
+
"""
|
326
|
+
Add valid params to the LLM object.
|
327
|
+
"""
|
328
|
+
|
329
|
+
import litellm
|
330
|
+
from versionhq.llm.llm_vars import PARAMS
|
331
|
+
|
332
|
+
valid_config = {k: v for k, v in config.items() if v} if config else {}
|
333
|
+
|
334
|
+
if valid_config:
|
335
|
+
valid_keys = list()
|
336
|
+
try:
|
337
|
+
valid_keys = litellm.get_supported_openai_params(model=llm.model, custom_llm_provider=self.endpoint_provider, request_type="chat_completion")
|
338
|
+
if not valid_keys:
|
339
|
+
valid_keys = PARAMS.get("common")
|
340
|
+
except:
|
341
|
+
valid_keys = PARAMS.get("common")
|
342
|
+
|
343
|
+
valid_keys += PARAMS.get("litellm")
|
344
|
+
|
345
|
+
for key in valid_keys:
|
346
|
+
if key in valid_config and valid_config[key]:
|
347
|
+
val = valid_config[key]
|
348
|
+
if [key == k for k, v in LLM.model_fields.items()]:
|
349
|
+
setattr(llm, key, val)
|
350
|
+
else:
|
351
|
+
llm.other_valid_config.update({ key: val})
|
352
|
+
|
353
|
+
|
354
|
+
llm.timeout = self.max_execution_time if llm.timeout is None else llm.timeout
|
355
|
+
# llm.max_tokens = self.max_tokens if self.max_tokens else llm.max_tokens
|
356
|
+
|
357
|
+
if llm.provider is None:
|
358
|
+
provider_name = llm.model.split("/")[0]
|
359
|
+
valid_provider = provider_name if provider_name in PROVIDERS else None
|
360
|
+
llm.provider = valid_provider
|
361
|
+
|
362
|
+
if self.callbacks:
|
363
|
+
llm.callbacks = self.callbacks
|
364
|
+
llm._set_callbacks(llm.callbacks)
|
365
|
+
|
366
|
+
if self.respect_context_window == False:
|
367
|
+
llm.context_window_size = DEFAULT_CONTEXT_WINDOW_SIZE
|
368
|
+
|
369
|
+
return llm
|
370
|
+
|
371
|
+
|
372
372
|
def _update_llm(self, llm: Any = None, llm_config: Optional[Dict[str, Any]] = None) -> Self:
|
373
373
|
"""
|
374
374
|
Update llm and llm_config of the exsiting agent. (Other conditions will remain the same.)
|
@@ -599,3 +599,6 @@ class Agent(BaseModel):
|
|
599
599
|
|
600
600
|
def __repr__(self):
|
601
601
|
return f"Agent(role={self.role}, goal={self.goal}"
|
602
|
+
|
603
|
+
def __str__(self):
|
604
|
+
return super().__str__()
|
@@ -94,7 +94,7 @@ def form_agent_network(
|
|
94
94
|
fields = {}
|
95
95
|
for ob in item:
|
96
96
|
try:
|
97
|
-
field_name = str(ob).lower().
|
97
|
+
field_name = str(ob).lower().split(":")[0].replace(" ", "_")[0: 16]
|
98
98
|
fields[field_name] = (str, Field(default=None))
|
99
99
|
except:
|
100
100
|
pass
|
@@ -108,7 +108,7 @@ def form_agent_network(
|
|
108
108
|
fields = {}
|
109
109
|
for ob in item:
|
110
110
|
try:
|
111
|
-
field_name = str(ob).lower().
|
111
|
+
field_name = str(ob).lower().split(":")[0].replace(" ", "_")[0: 16]
|
112
112
|
fields[field_name] = (str, Field(default=None))
|
113
113
|
except:
|
114
114
|
pass
|
@@ -137,7 +137,7 @@ def form_agent_network(
|
|
137
137
|
member = Member(agent=created_agents[i], is_manager=is_manager, tasks=[created_tasks[i]])
|
138
138
|
members.append(member)
|
139
139
|
|
140
|
-
network_tasks.
|
140
|
+
network_tasks.extend(created_tasks[len(created_agents):len(created_tasks)])
|
141
141
|
|
142
142
|
|
143
143
|
if _formation == Formation.SUPERVISING and not [member for member in members if member.is_manager]:
|
@@ -1,19 +1,11 @@
|
|
1
|
-
import sys
|
2
|
-
import threading
|
3
1
|
from unittest.mock import patch
|
4
2
|
from typing import Callable
|
5
3
|
|
6
|
-
from pydantic import BaseModel, Field
|
7
|
-
|
8
4
|
from versionhq.agent.model import Agent, LLM
|
9
5
|
from versionhq.task.model import Task, ResponseField, TaskOutput, TaskExecutionType
|
10
6
|
from versionhq.tool.model import Tool, ToolSet
|
11
7
|
from versionhq.tool.decorator import tool
|
12
8
|
|
13
|
-
sys.setrecursionlimit(2097152)
|
14
|
-
threading.stack_size(134217728)
|
15
|
-
|
16
|
-
|
17
9
|
|
18
10
|
# def test_async_execute_task():
|
19
11
|
# task = Task(description="Return string: 'test'", type=TaskExecutionType.ASYNC)
|
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
|
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
|
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
|