dataiku-api-client 14.5.1__tar.gz → 14.6.0__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.
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/HISTORY.txt +9 -0
- {dataiku_api_client-14.5.1/dataiku_api_client.egg-info → dataiku_api_client-14.6.0}/PKG-INFO +11 -2
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0/dataiku_api_client.egg-info}/PKG-INFO +11 -2
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/admin.py +1 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/agent.py +36 -12
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/agent_review.py +54 -2
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/agent_tool.py +22 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/document_extractor.py +176 -4
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/knowledgebank.py +1 -1
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/langchain/tool.py +4 -7
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/llm.py +4 -32
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/llm_utils/__init__.py +57 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/ml.py +113 -13
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/project.py +37 -8
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/recipe.py +28 -1
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/retrieval_augmented_llm.py +86 -1
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/semantic_model.py +1 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dssclient.py +14 -3
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/instances.py +3 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern_client.py +6 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/group.py +1 -1
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/user.py +53 -6
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/setup.py +1 -1
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/LICENSE.txt +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/MANIFEST.in +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/README +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataiku_api_client.egg-info/SOURCES.txt +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataiku_api_client.egg-info/dependency_links.txt +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataiku_api_client.egg-info/requires.txt +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataiku_api_client.egg-info/top_level.txt +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/apinode_admin/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/apinode_admin/auth.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/apinode_admin/service.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/apinode_admin_client.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/apinode_client.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/auth.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/base_client.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/analysis.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/apideployer.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/apiservice.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/app.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/businessapp.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/codestudio.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/continuousactivity.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/dashboard.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/data_collection.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/data_directories_footprint.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/data_quality.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/dataset.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/discussion.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/drift.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/enterprise_asset_library.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/evaluationcomparison.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/evaluationstore.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/feature_store.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/flow.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/future.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/insight.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/job.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/jupyternotebook.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/labeling_task.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/langchain/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/langchain/embeddings.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/langchain/knowledge_bank.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/langchain/llm.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/langchain/utils.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/llm_tracing/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/local_model.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/macro.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/managedfolder.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/meaning.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/messaging_channel.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/metrics.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/mlflow.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/modelcomparison.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/modelevaluationstore.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/notebook.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/plugin.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/project_standards.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/projectdeployer.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/projectfolder.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/projectlibrary.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/savedmodel.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/scenario.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/sqlnotebook.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/sqlquery.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/statistics.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/streaming_endpoint.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/tools/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/tools/codegen.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/tools/langchain.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/unifiedmonitoring.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/utils.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/webapp.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/wiki.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/workspace.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss_plugin_mlflow/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss_plugin_mlflow/artifact_repository.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss_plugin_mlflow/header_provider.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss_plugin_mlflow/utils.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/cloudaccounts.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/future.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/instancesettingstemplates.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/loadbalancers.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/tenant.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fm/virtualnetworks.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/fmclient.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/admin.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/admin_blueprint_designer.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/admin_custom_pages_handler.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/admin_roles_permissions_handler.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/artifact.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/artifact_search.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/blueprint.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/custom_page.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/future.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/time_series.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/uploaded_file.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/govern/users_container.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/iam/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/iam/settings.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/__init__.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/exceptions.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/node.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/profile.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/response.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad/task.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/launchpad_client.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/utils.py +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/requirements.txt +0 -0
- {dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/setup.cfg +0 -0
{dataiku_api_client-14.5.1/dataiku_api_client.egg-info → dataiku_api_client-14.6.0}/PKG-INFO
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataiku-api-client
|
|
3
|
-
Version: 14.
|
|
3
|
+
Version: 14.6.0
|
|
4
4
|
Summary: Python API client for Dataiku APIs
|
|
5
5
|
Home-page: https://www.dataiku.com
|
|
6
|
-
Download-URL: https://github.com/dataiku/dataiku-api-client-python/tarball/14.
|
|
6
|
+
Download-URL: https://github.com/dataiku/dataiku-api-client-python/tarball/14.6.0
|
|
7
7
|
Author: Dataiku
|
|
8
8
|
Author-email: support@dataiku.com
|
|
9
9
|
License: Apache Software License
|
|
@@ -36,6 +36,15 @@ Changelog
|
|
|
36
36
|
==========
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
14.6.0 (2026-05-27)
|
|
40
|
+
-------------------
|
|
41
|
+
|
|
42
|
+
* Initial release for DSS 14.6.0
|
|
43
|
+
|
|
44
|
+
14.5.2 (2026-05-25)
|
|
45
|
+
-------------------
|
|
46
|
+
|
|
47
|
+
* Initial release for DSS 14.5.2
|
|
39
48
|
|
|
40
49
|
14.5.1 (2026-04-27)
|
|
41
50
|
-------------------
|
{dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0/dataiku_api_client.egg-info}/PKG-INFO
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataiku-api-client
|
|
3
|
-
Version: 14.
|
|
3
|
+
Version: 14.6.0
|
|
4
4
|
Summary: Python API client for Dataiku APIs
|
|
5
5
|
Home-page: https://www.dataiku.com
|
|
6
|
-
Download-URL: https://github.com/dataiku/dataiku-api-client-python/tarball/14.
|
|
6
|
+
Download-URL: https://github.com/dataiku/dataiku-api-client-python/tarball/14.6.0
|
|
7
7
|
Author: Dataiku
|
|
8
8
|
Author-email: support@dataiku.com
|
|
9
9
|
License: Apache Software License
|
|
@@ -36,6 +36,15 @@ Changelog
|
|
|
36
36
|
==========
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
14.6.0 (2026-05-27)
|
|
40
|
+
-------------------
|
|
41
|
+
|
|
42
|
+
* Initial release for DSS 14.6.0
|
|
43
|
+
|
|
44
|
+
14.5.2 (2026-05-25)
|
|
45
|
+
-------------------
|
|
46
|
+
|
|
47
|
+
* Initial release for DSS 14.5.2
|
|
39
48
|
|
|
40
49
|
14.5.1 (2026-04-27)
|
|
41
50
|
-------------------
|
|
@@ -2202,6 +2202,7 @@ class DSSCodeEnvContainerConfsBearer(object):
|
|
|
2202
2202
|
* PYTHON36_SUPPORT
|
|
2203
2203
|
* PYTHON37_SUPPORT
|
|
2204
2204
|
* PYTHON38_SUPPORT
|
|
2205
|
+
* HUGGING_FACE_LOCAL_GPU
|
|
2205
2206
|
|
|
2206
2207
|
:param dict container_runtime_addition: a dict with the container runtime addition definition
|
|
2207
2208
|
"""
|
|
@@ -226,6 +226,11 @@ class DSSAgentInteractionLoggingSelection(object):
|
|
|
226
226
|
self.mode = self.MODE_NONE
|
|
227
227
|
|
|
228
228
|
|
|
229
|
+
# Neutral aliases for shared LLM interaction logging concepts.
|
|
230
|
+
DSSLLMInteractionLoggingSettings = DSSAgentInteractionLoggingSettings
|
|
231
|
+
DSSLLMInteractionLoggingSelection = DSSAgentInteractionLoggingSelection
|
|
232
|
+
|
|
233
|
+
|
|
229
234
|
class DSSAgentListItem(DSSTaggableObjectListItem):
|
|
230
235
|
"""
|
|
231
236
|
An item in a list of agents
|
|
@@ -241,7 +246,7 @@ class DSSAgentListItem(DSSTaggableObjectListItem):
|
|
|
241
246
|
@property
|
|
242
247
|
def project_key(self):
|
|
243
248
|
"""
|
|
244
|
-
:returns: The project
|
|
249
|
+
:returns: The project
|
|
245
250
|
:rtype: string
|
|
246
251
|
"""
|
|
247
252
|
return self._data["projectKey"]
|
|
@@ -263,7 +268,10 @@ class DSSAgentListItem(DSSTaggableObjectListItem):
|
|
|
263
268
|
return self._data["name"]
|
|
264
269
|
|
|
265
270
|
def as_llm(self):
|
|
266
|
-
"""
|
|
271
|
+
"""
|
|
272
|
+
:returns: this agent as a usable :class:`dataikuapi.dss.llm.DSSLLM` for querying
|
|
273
|
+
:rtype: dataikuapi.dss.llm.DSSLLM
|
|
274
|
+
"""
|
|
267
275
|
return self.client.get_project(self.project_key).get_llm("agent:%s" % self.id)
|
|
268
276
|
|
|
269
277
|
|
|
@@ -285,14 +293,15 @@ class DSSAgent(object):
|
|
|
285
293
|
return self._id
|
|
286
294
|
|
|
287
295
|
def as_llm(self):
|
|
288
|
-
"""
|
|
296
|
+
"""
|
|
297
|
+
:returns: this agent as a usable :class:`dataikuapi.dss.llm.DSSLLM` for querying
|
|
298
|
+
:rtype: dataikuapi.dss.llm.DSSLLM
|
|
299
|
+
"""
|
|
289
300
|
return self.client.get_project(self.project_key).get_llm("agent:%s" % self.id)
|
|
290
301
|
|
|
291
302
|
def get_settings(self):
|
|
292
303
|
"""
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
:return: a handle on the agent definition
|
|
304
|
+
:return: a handle on the agent's definition
|
|
296
305
|
:rtype: :class:`dataikuapi.dss.agent.DSSAgentSettings`
|
|
297
306
|
"""
|
|
298
307
|
settings = self.client._perform_json(
|
|
@@ -362,15 +371,26 @@ class DSSAgentSettings(DSSTaggableObjectSettings):
|
|
|
362
371
|
self._settings = settings
|
|
363
372
|
|
|
364
373
|
def get_version_ids(self):
|
|
374
|
+
"""
|
|
375
|
+
List the ids of each version of this agent
|
|
376
|
+
|
|
377
|
+
:rtype: list[str]
|
|
378
|
+
"""
|
|
365
379
|
return [v["versionId"] for v in self._settings["versions"]]
|
|
366
380
|
|
|
367
381
|
@property
|
|
368
382
|
def active_version(self):
|
|
369
|
-
"""
|
|
383
|
+
"""
|
|
384
|
+
:returns: the active version of this agent, or None if no version is declared as active
|
|
385
|
+
:rtype: str | None
|
|
386
|
+
"""
|
|
370
387
|
return self._settings.get("activeVersion")
|
|
371
388
|
|
|
372
389
|
def get_version_settings(self, version_id):
|
|
373
|
-
|
|
390
|
+
"""
|
|
391
|
+
:returns: the settings of the given version of this agent
|
|
392
|
+
:rtype: DSSAgentVersionSettings
|
|
393
|
+
"""
|
|
374
394
|
version_settings = None
|
|
375
395
|
for vs in self._settings["versions"]:
|
|
376
396
|
if vs["versionId"] == version_id:
|
|
@@ -387,8 +407,7 @@ class DSSAgentSettings(DSSTaggableObjectSettings):
|
|
|
387
407
|
|
|
388
408
|
def get_raw(self):
|
|
389
409
|
"""
|
|
390
|
-
|
|
391
|
-
:return: the raw settings of the agent
|
|
410
|
+
:returns: the raw settings of this agent
|
|
392
411
|
:rtype: dict
|
|
393
412
|
"""
|
|
394
413
|
return self._settings
|
|
@@ -406,13 +425,18 @@ class DSSAgentVersionSettings(object):
|
|
|
406
425
|
self._version_settings = version_settings
|
|
407
426
|
|
|
408
427
|
def get_raw(self):
|
|
428
|
+
"""
|
|
429
|
+
:returns: the raw settings of this agent version
|
|
430
|
+
:rtype: dict
|
|
431
|
+
"""
|
|
409
432
|
return self._version_settings
|
|
410
433
|
|
|
411
434
|
@property
|
|
412
435
|
def llm_id(self):
|
|
413
436
|
"""
|
|
414
437
|
Only for Visual Agents
|
|
415
|
-
|
|
438
|
+
|
|
439
|
+
:rtype: str
|
|
416
440
|
"""
|
|
417
441
|
if not self._agent_settings.type == "TOOLS_USING_AGENT":
|
|
418
442
|
raise ValueError("Only valid for Simple Visual Agents")
|
|
@@ -502,7 +526,7 @@ class DSSAgentVersionSettings(object):
|
|
|
502
526
|
.. code-block:: python
|
|
503
527
|
|
|
504
528
|
project = client.get_project("MYPROJECT")
|
|
505
|
-
project.
|
|
529
|
+
project.create_llm_interaction_logging_dataset(
|
|
506
530
|
"agent_logs",
|
|
507
531
|
connection_id="filesystem_managed",
|
|
508
532
|
time_partitioning="DAY",
|
|
@@ -214,6 +214,32 @@ class DSSAgentReview(object):
|
|
|
214
214
|
def nb_executions(self, value):
|
|
215
215
|
self.data["nbExecutions"] = value
|
|
216
216
|
|
|
217
|
+
@property
|
|
218
|
+
def hitl_validation_policy(self):
|
|
219
|
+
"""
|
|
220
|
+
Review-wide default HITL validation policy used when creating a test.
|
|
221
|
+
Possible values are ``ACCEPT`` or ``REJECT``.
|
|
222
|
+
:rtype: str
|
|
223
|
+
"""
|
|
224
|
+
return self.data.get("hitlValidationPolicy")
|
|
225
|
+
|
|
226
|
+
@hitl_validation_policy.setter
|
|
227
|
+
def hitl_validation_policy(self, value):
|
|
228
|
+
self.data["hitlValidationPolicy"] = value
|
|
229
|
+
|
|
230
|
+
@property
|
|
231
|
+
def hitl_max_validation_turns(self):
|
|
232
|
+
"""
|
|
233
|
+
Maximum number of validation turns auto-answered during a test run before stopping.
|
|
234
|
+
Possible values are integers greater than or equal to ``1``.
|
|
235
|
+
:rtype: int
|
|
236
|
+
"""
|
|
237
|
+
return self.data.get("hitlMaxValidationTurns")
|
|
238
|
+
|
|
239
|
+
@hitl_max_validation_turns.setter
|
|
240
|
+
def hitl_max_validation_turns(self, value):
|
|
241
|
+
self.data["hitlMaxValidationTurns"] = value
|
|
242
|
+
|
|
217
243
|
def get_trait(self, trait_id):
|
|
218
244
|
"""
|
|
219
245
|
Get a specific trait by its ID.
|
|
@@ -278,13 +304,14 @@ class DSSAgentReview(object):
|
|
|
278
304
|
)
|
|
279
305
|
return DSSAgentReviewTest(self.dss_client, self.project_key, test)
|
|
280
306
|
|
|
281
|
-
def create_test(self, query=None, reference_answer=None, expectations=None):
|
|
307
|
+
def create_test(self, query=None, reference_answer=None, expectations=None, hitl_validation_policy=None):
|
|
282
308
|
"""
|
|
283
309
|
Create a new test for this agent review.
|
|
284
310
|
|
|
285
311
|
:param str query: Query to test the agent. Optional.
|
|
286
312
|
:param str reference_answer: Reference answer. Optional.
|
|
287
313
|
:param str expectations: Expectations on the agent answer. Optional.
|
|
314
|
+
:param str hitl_validation_policy: Per-test HITL validation policy. Optional.
|
|
288
315
|
:returns: The created test object.
|
|
289
316
|
:rtype: :class:`DSSAgentReviewTest`
|
|
290
317
|
"""
|
|
@@ -294,13 +321,14 @@ class DSSAgentReview(object):
|
|
|
294
321
|
"query": query,
|
|
295
322
|
"referenceAnswer": reference_answer,
|
|
296
323
|
"expectations": expectations,
|
|
324
|
+
"hitlValidationPolicy": hitl_validation_policy,
|
|
297
325
|
}
|
|
298
326
|
test = self.dss_client._perform_json(
|
|
299
327
|
"POST", "/projects/%s/agent-reviews/tests" % self.project_key, body=body
|
|
300
328
|
)
|
|
301
329
|
return DSSAgentReviewTest(self.dss_client, self.project_key, test)
|
|
302
330
|
|
|
303
|
-
def create_tests_from_dataset(self, full_dataset_name, query_column, reference_answer_column=None, expectations_column=None, top_n=None, partitions=None, latest_partitions_n=None):
|
|
331
|
+
def create_tests_from_dataset(self, full_dataset_name, query_column, reference_answer_column=None, expectations_column=None, top_n=None, partitions=None, latest_partitions_n=None, hitl_validation_policy_column=None):
|
|
304
332
|
"""
|
|
305
333
|
Create new tests for this agent review by importing them from a dataset.
|
|
306
334
|
|
|
@@ -311,6 +339,7 @@ class DSSAgentReview(object):
|
|
|
311
339
|
:param int top_n: Only take the first n rows of the dataset. Optional.
|
|
312
340
|
:param list[str] partitions: For partitioned datasets, only consider the given partitions. Optional.
|
|
313
341
|
:param int latest_partitions_n: For partitioned datasets and if partitions is not set, only consider the latest n partitions. Optional.
|
|
342
|
+
:param str hitl_validation_policy_column: Name of the column containing per-test HITL validation policy. Optional.
|
|
314
343
|
:returns: A dictionary with keys:
|
|
315
344
|
- "createdTestIds": list of ids of the created tests
|
|
316
345
|
- "error": The error message if any occurred
|
|
@@ -324,6 +353,7 @@ class DSSAgentReview(object):
|
|
|
324
353
|
"queryColumn": query_column,
|
|
325
354
|
"referenceAnswerColumn": reference_answer_column,
|
|
326
355
|
"expectationsColumn": expectations_column,
|
|
356
|
+
"hitlValidationPolicyColumn": hitl_validation_policy_column,
|
|
327
357
|
}
|
|
328
358
|
if top_n is not None:
|
|
329
359
|
body["samplingMethod"] = "HEAD_SEQUENTIAL"
|
|
@@ -587,6 +617,19 @@ class DSSAgentReviewTest(object):
|
|
|
587
617
|
def expectations(self, value):
|
|
588
618
|
self.data["expectations"] = value
|
|
589
619
|
|
|
620
|
+
@property
|
|
621
|
+
def hitl_validation_policy(self):
|
|
622
|
+
"""
|
|
623
|
+
Per-test HITL validation policy.
|
|
624
|
+
Possible values are ``ACCEPT`` or ``REJECT``.
|
|
625
|
+
:rtype: str
|
|
626
|
+
"""
|
|
627
|
+
return self.data.get("hitlValidationPolicy")
|
|
628
|
+
|
|
629
|
+
@hitl_validation_policy.setter
|
|
630
|
+
def hitl_validation_policy(self, value):
|
|
631
|
+
self.data["hitlValidationPolicy"] = value
|
|
632
|
+
|
|
590
633
|
@property
|
|
591
634
|
def creation_timestamp(self):
|
|
592
635
|
"""
|
|
@@ -735,6 +778,15 @@ class DSSAgentReviewTestListItem(dict):
|
|
|
735
778
|
"""
|
|
736
779
|
return self.get("expectations")
|
|
737
780
|
|
|
781
|
+
@property
|
|
782
|
+
def hitl_validation_policy(self):
|
|
783
|
+
"""
|
|
784
|
+
Per-test HITL validation policy.
|
|
785
|
+
Possible values are ``ACCEPT`` or ``REJECT``.
|
|
786
|
+
:rtype: str
|
|
787
|
+
"""
|
|
788
|
+
return self.get("hitlValidationPolicy")
|
|
789
|
+
|
|
738
790
|
|
|
739
791
|
class DSSAgentReviewRun(object):
|
|
740
792
|
"""
|
|
@@ -98,12 +98,22 @@ class DSSAgentTool(object):
|
|
|
98
98
|
return self.client._perform_empty("DELETE", "/projects/%s/agents/tools/%s" % (self.project_key, self.id))
|
|
99
99
|
|
|
100
100
|
def as_langchain_structured_tool(self, context = None):
|
|
101
|
+
"""
|
|
102
|
+
:returns: this tool as a LangChain StructuredTool
|
|
103
|
+
:rtype: langchain_core.tools.StructuredTool
|
|
104
|
+
"""
|
|
101
105
|
from dataikuapi.dss.langchain.tool import convert_to_langchain_structured_tool
|
|
102
106
|
return convert_to_langchain_structured_tool(self, context)
|
|
103
107
|
|
|
104
108
|
def run(self, input, context=None, subtool_name=None, memory_fragment=None, tool_validation_responses=None, tool_validation_requests=None):
|
|
105
109
|
"""
|
|
106
110
|
Execute a tool call
|
|
111
|
+
|
|
112
|
+
:param str input: Text input
|
|
113
|
+
:param dict context: Additional request context
|
|
114
|
+
:param str subtool_name: Name of the sub-tool, if applicable (e.g., for a MCP tool)
|
|
115
|
+
:rtype: dict
|
|
116
|
+
:returns: The result of running this tool
|
|
107
117
|
"""
|
|
108
118
|
|
|
109
119
|
invocation = {
|
|
@@ -201,6 +211,10 @@ class DSSAgentToolSettings(DSSTaggableObjectSettings):
|
|
|
201
211
|
self._settings = settings
|
|
202
212
|
|
|
203
213
|
def get_raw(self):
|
|
214
|
+
"""
|
|
215
|
+
:returns: the raw settings dict for this agent tool
|
|
216
|
+
:rtype: dict
|
|
217
|
+
"""
|
|
204
218
|
return self._settings
|
|
205
219
|
|
|
206
220
|
@property
|
|
@@ -237,6 +251,10 @@ class DSSVectorStoreSearchAgentToolCreator(DSSAgentToolCreator):
|
|
|
237
251
|
DSSAgentToolCreator.__init__(self, project, type, name, id)
|
|
238
252
|
|
|
239
253
|
def with_knowledge_bank(self, kb):
|
|
254
|
+
"""
|
|
255
|
+
:param kb: Knowledge Bank (object, list item, or identifier) to use in this tool
|
|
256
|
+
:type kb: DSSKnowledgeBank | DSSKnowledgeBankListItem | str
|
|
257
|
+
"""
|
|
240
258
|
loc = _kb_to_loc(self.project.project_key, kb)
|
|
241
259
|
self.proto["creationParams"]["knowledgeBankRef"] = loc.to_ref(self.project.project_key)
|
|
242
260
|
return self
|
|
@@ -246,5 +264,9 @@ class DSSVectorStoreSearchAgentToolSettings(DSSAgentToolSettings):
|
|
|
246
264
|
DSSAgentToolSettings.__init__(self, agent_tool, settings)
|
|
247
265
|
|
|
248
266
|
def set_knowledge_bank(self, kb):
|
|
267
|
+
"""
|
|
268
|
+
:param kb: Knowledge Bank (object, list item, or identifier) to use in this tool
|
|
269
|
+
:type kb: DSSKnowledgeBank | DSSKnowledgeBankListItem | str
|
|
270
|
+
"""
|
|
249
271
|
loc = _kb_to_loc(self.project.project_key, kb)
|
|
250
272
|
self.settings["params"]["knowledgeBankRef"] = loc.to_ref(self.agent_tool.project_key)
|
{dataiku_api_client-14.5.1 → dataiku_api_client-14.6.0}/dataikuapi/dss/document_extractor.py
RENAMED
|
@@ -3,6 +3,8 @@ import copy
|
|
|
3
3
|
import json
|
|
4
4
|
import warnings
|
|
5
5
|
|
|
6
|
+
from dataikuapi.dss.llm_utils import get_json_schema_and_parser
|
|
7
|
+
from dataikuapi.dss.recipe import DSSRecipe
|
|
6
8
|
from dataikuapi.utils import _write_response_content_to_file
|
|
7
9
|
|
|
8
10
|
|
|
@@ -70,6 +72,89 @@ class DocumentExtractor(object):
|
|
|
70
72
|
body=extractor_request)
|
|
71
73
|
return VlmExtractorResponse(ret)
|
|
72
74
|
|
|
75
|
+
|
|
76
|
+
def vlm_extract_fields(self, images, schema=None, llm_id=None, llm_prompt=None, from_recipe=None, strict=None, compatible=None):
|
|
77
|
+
"""
|
|
78
|
+
Extract specific fields (structured data) from images (typically screenshots of a document's pages) using a vision LLM.
|
|
79
|
+
Describe expected fields in ``extraction_schema``, or specify an Extract Fields recipe to use its settings.
|
|
80
|
+
|
|
81
|
+
:param images: screenshots of the document's pages from which to extract the fields
|
|
82
|
+
:type images: iterable(:class:`InlineImageRef`) | iterable(:class:`ManagedFolderImageRef`)
|
|
83
|
+
:param schema: a JSON schema or a Pydantic model class describing the fields to extract.
|
|
84
|
+
JSON schema definitions or Pydantic models referencing other models are unsupported.
|
|
85
|
+
:type schema: str | dict | pydantic.BaseModel class or Python type hint.
|
|
86
|
+
:param llm_id: Identifier of a vision LLM
|
|
87
|
+
:type llm_id: str
|
|
88
|
+
:param llm_prompt: Custom prompt to extract fields from the images
|
|
89
|
+
:type llm_prompt: str
|
|
90
|
+
:param from_recipe: Name of a recipe from which to read the other arguments.
|
|
91
|
+
Arguments provided explicitly take precedence.
|
|
92
|
+
:type from_recipe: str
|
|
93
|
+
:param strict: Whether to strictly enforce the schema. Support varies across models/providers.
|
|
94
|
+
:type strict: bool
|
|
95
|
+
:param compatible: Allow DSS to modify the schema in order to increase compatibility, depending on known limitations of the model/provider. Defaults to automatic.
|
|
96
|
+
:type compatible: bool
|
|
97
|
+
|
|
98
|
+
:returns: Extracted fields from images
|
|
99
|
+
:rtype: :class:`FieldsVlmExtractorResponse`
|
|
100
|
+
"""
|
|
101
|
+
if from_recipe is not None and (schema is None or llm_id is None or llm_prompt is None or strict is None or compatible is None):
|
|
102
|
+
recipe_settings = DSSRecipe(self.client, self.project_key, from_recipe).get_settings()
|
|
103
|
+
recipe_params = recipe_settings.raw_params
|
|
104
|
+
|
|
105
|
+
if schema is None:
|
|
106
|
+
schema = recipe_params.get("extractionSchema")
|
|
107
|
+
if llm_id is None:
|
|
108
|
+
llm_id = recipe_params.get("vlmId")
|
|
109
|
+
if llm_prompt is None:
|
|
110
|
+
llm_prompt = recipe_params.get("extractionPrompt")
|
|
111
|
+
if strict is None:
|
|
112
|
+
strict = recipe_params.get("valueErrorHandling") == "BLANK_VALUE"
|
|
113
|
+
if compatible is None:
|
|
114
|
+
compatible = True
|
|
115
|
+
dku_properties = recipe_settings.get_recipe_raw_definition().get("dkuProperties") or []
|
|
116
|
+
for prop in dku_properties:
|
|
117
|
+
if isinstance(prop, dict) and prop.get("name") == "dku.extractFields.schemaCompatibilityEnhancer" and isinstance(prop.get("value"), bool):
|
|
118
|
+
compatible = prop.get("value")
|
|
119
|
+
break
|
|
120
|
+
|
|
121
|
+
json_schema, parser_method = get_json_schema_and_parser(schema)
|
|
122
|
+
|
|
123
|
+
extractor_request = {
|
|
124
|
+
"settings": {
|
|
125
|
+
"llmId": llm_id,
|
|
126
|
+
"llmPrompt": llm_prompt,
|
|
127
|
+
"extractionSchema" : json.loads(json_schema),
|
|
128
|
+
"strictSchemaAdherence": strict,
|
|
129
|
+
"schemaCompatibilityEnhancer": compatible
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
images = list(images)
|
|
134
|
+
if not images:
|
|
135
|
+
raise ValueError("No images provided")
|
|
136
|
+
if all(isinstance(ir, InlineImageRef) for ir in images):
|
|
137
|
+
extractor_request["inputs"] = {
|
|
138
|
+
"imagesRef": {
|
|
139
|
+
"type": images[0].type,
|
|
140
|
+
"inlineImages": [ir.as_dict() for ir in images]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
elif all(isinstance(ir, ManagedFolderImageRef) for ir in images):
|
|
144
|
+
extractor_request["inputs"] = {
|
|
145
|
+
"imagesRef": {
|
|
146
|
+
"type": images[0].type,
|
|
147
|
+
"managedFolderRef": images[0].managed_folder_ref,
|
|
148
|
+
"imagesPaths": [ir.image_path for ir in images]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else:
|
|
152
|
+
raise ValueError("Unsupported mix of image types: %s" % set([ir.type for ir in images]))
|
|
153
|
+
|
|
154
|
+
ret = self.client._perform_json("POST", "/projects/%s/document-extractors/fields/vlm" % self.project_key,
|
|
155
|
+
body=extractor_request)
|
|
156
|
+
return FieldsVlmExtractorResponse(ret, parser_method)
|
|
157
|
+
|
|
73
158
|
def structured_extract(self, document, max_section_depth=6, image_handling_mode='IGNORE', ocr_engine='AUTO', languages="en", llm_id=None, llm_prompt=None,
|
|
74
159
|
output_managed_folder=None, image_validation=True):
|
|
75
160
|
"""
|
|
@@ -191,7 +276,8 @@ class DocumentExtractor(object):
|
|
|
191
276
|
|
|
192
277
|
return TextExtractorResponse(ret)
|
|
193
278
|
|
|
194
|
-
def generate_pages_screenshots(self, document, output_managed_folder=None, offset=0, fetch_size=10, keep_fetched=True
|
|
279
|
+
def generate_pages_screenshots(self, document, output_managed_folder=None, offset=0, fetch_size=10, keep_fetched=True,
|
|
280
|
+
page_dpi=None, max_memory_per_document=None):
|
|
195
281
|
"""
|
|
196
282
|
Generate per-page screenshots of a document, returning an iterable over the screenshots.
|
|
197
283
|
|
|
@@ -232,12 +318,24 @@ class DocumentExtractor(object):
|
|
|
232
318
|
:type fetch_size: int
|
|
233
319
|
:param keep_fetched: whether to keep previous screenshots requests within this response object when fetching next ones.
|
|
234
320
|
:type keep_fetched: boolean
|
|
321
|
+
:param page_dpi: DPI used to render pages if memory allows.
|
|
322
|
+
:type page_dpi: int
|
|
323
|
+
:param max_memory_per_document: maximum memory budget in MB used while rendering a document.
|
|
324
|
+
The effective DPI may be reduced to fit this limit depending on page dimensions.
|
|
325
|
+
:type max_memory_per_document: int
|
|
235
326
|
|
|
236
327
|
:returns: An iterable over the result screenshots
|
|
237
328
|
:rtype: :class:`ScreenshotterResponse`
|
|
238
329
|
"""
|
|
239
330
|
|
|
240
|
-
screenshotter_request = ScreenshotterRequest(
|
|
331
|
+
screenshotter_request = ScreenshotterRequest(
|
|
332
|
+
document,
|
|
333
|
+
output_managed_folder,
|
|
334
|
+
offset,
|
|
335
|
+
fetch_size,
|
|
336
|
+
page_dpi,
|
|
337
|
+
max_memory_per_document
|
|
338
|
+
)
|
|
241
339
|
return ScreenshotterResponse(self.client, self.project_key, screenshotter_request, keep_fetched)
|
|
242
340
|
|
|
243
341
|
|
|
@@ -269,11 +367,13 @@ class ScreenshotterRequest(object):
|
|
|
269
367
|
|
|
270
368
|
"""
|
|
271
369
|
|
|
272
|
-
def __init__(self, document, output_managed_folder, offset, fetch_size):
|
|
370
|
+
def __init__(self, document, output_managed_folder, offset, fetch_size, page_dpi=None, max_memory_per_document=None):
|
|
273
371
|
self.document = document
|
|
274
372
|
self.output_managed_folder = output_managed_folder
|
|
275
373
|
self.offset = offset
|
|
276
374
|
self.fetch_size = fetch_size
|
|
375
|
+
self.page_dpi = page_dpi
|
|
376
|
+
self.max_memory_per_document = max_memory_per_document # MB
|
|
277
377
|
|
|
278
378
|
def as_json(self):
|
|
279
379
|
"""
|
|
@@ -302,6 +402,8 @@ class ScreenshotterRequest(object):
|
|
|
302
402
|
"outputManagedFolderRef": self.output_managed_folder,
|
|
303
403
|
"paginationOffset": self.offset,
|
|
304
404
|
"paginationSize": self.fetch_size,
|
|
405
|
+
"pageDPI": self.page_dpi,
|
|
406
|
+
"maxMemoryPerDocMB": self.max_memory_per_document,
|
|
305
407
|
}
|
|
306
408
|
}
|
|
307
409
|
|
|
@@ -683,7 +785,6 @@ class VlmExtractorResponse(object):
|
|
|
683
785
|
@property
|
|
684
786
|
def success(self):
|
|
685
787
|
"""
|
|
686
|
-
:returns: The outcome of the extractor request.
|
|
687
788
|
:rtype: bool
|
|
688
789
|
"""
|
|
689
790
|
return self._data.get("ok")
|
|
@@ -706,6 +807,77 @@ class VlmExtractorResponse(object):
|
|
|
706
807
|
)
|
|
707
808
|
raise Exception(error_message)
|
|
708
809
|
|
|
810
|
+
class FieldsVlmExtractorResponse(object):
|
|
811
|
+
"""
|
|
812
|
+
A handle to interact with a VLM fields extraction result.
|
|
813
|
+
|
|
814
|
+
.. important::
|
|
815
|
+
Do not create this class directly; use :meth:`~DocumentExtractor.vlm_extract_fields`
|
|
816
|
+
"""
|
|
817
|
+
|
|
818
|
+
def __init__(self, data, response_parser=None):
|
|
819
|
+
self._data = data
|
|
820
|
+
self._response_parser = response_parser
|
|
821
|
+
self._parsed_fields = None
|
|
822
|
+
|
|
823
|
+
def get_raw(self):
|
|
824
|
+
return self._data
|
|
825
|
+
|
|
826
|
+
@property
|
|
827
|
+
def success(self):
|
|
828
|
+
"""
|
|
829
|
+
:rtype: bool
|
|
830
|
+
"""
|
|
831
|
+
return self._data.get("status", "nok") != "nok"
|
|
832
|
+
|
|
833
|
+
@property
|
|
834
|
+
def fields(self):
|
|
835
|
+
"""
|
|
836
|
+
Fields extracted from the original document.
|
|
837
|
+
Follows the structure of the extraction schema, has only the fields that abide by it.
|
|
838
|
+
|
|
839
|
+
:returns: extracted fields.
|
|
840
|
+
:rtype: dict
|
|
841
|
+
"""
|
|
842
|
+
self._fail_unless_success()
|
|
843
|
+
return self._data["curatedFields"]
|
|
844
|
+
|
|
845
|
+
@property
|
|
846
|
+
def parsed_fields(self):
|
|
847
|
+
"""
|
|
848
|
+
Fields extracted from the original document.
|
|
849
|
+
Follows the structure of the extraction schema, has only the fields that abide by it.
|
|
850
|
+
Only available for extraction schema given as a Pydantic model or using Python type hint.
|
|
851
|
+
|
|
852
|
+
:returns: extracted fields deserialized into a Pydantic model instance.
|
|
853
|
+
:rtype: pydantic.BaseModel
|
|
854
|
+
"""
|
|
855
|
+
self._fail_unless_success()
|
|
856
|
+
if self._parsed_fields is None and self._data["curatedFields"] is not None:
|
|
857
|
+
if not self._response_parser:
|
|
858
|
+
raise Exception("Require extraction schema to be given as a Pydantic model or using Python type hint.")
|
|
859
|
+
else:
|
|
860
|
+
self._parsed_fields = self._response_parser(json.dumps(self._data["curatedFields"]))
|
|
861
|
+
return self._parsed_fields
|
|
862
|
+
|
|
863
|
+
@property
|
|
864
|
+
def invalid_fields(self):
|
|
865
|
+
"""
|
|
866
|
+
Fields in the extraction schema that the Vision LLM could not extract.
|
|
867
|
+
Follows the structure/hierarchy of the extraction schema, but has only the incorrect or missing fields.
|
|
868
|
+
|
|
869
|
+
:rtype: dict
|
|
870
|
+
"""
|
|
871
|
+
self._fail_unless_success()
|
|
872
|
+
return self._data["invalidFields"]
|
|
873
|
+
|
|
874
|
+
def _fail_unless_success(self):
|
|
875
|
+
if not self.success:
|
|
876
|
+
error_message = "Document failed to be extracted - request failed: {}".format(
|
|
877
|
+
self._data.get("errorMessage", "An unknown error occurred")
|
|
878
|
+
)
|
|
879
|
+
raise Exception(error_message)
|
|
880
|
+
|
|
709
881
|
|
|
710
882
|
class InputRef(object):
|
|
711
883
|
def as_dict(self):
|
|
@@ -245,7 +245,7 @@ class DSSKnowledgeBankSettings(DSSTaggableObjectSettings):
|
|
|
245
245
|
@property
|
|
246
246
|
def vector_store_type(self):
|
|
247
247
|
"""
|
|
248
|
-
Returns the type of storage backing the vector store (could be CHROMA, PINECONE, ELASTICSEARCH, AZURE_AI_SEARCH, VERTEX_AI_GCS_BASED, FAISS, QDRANT_LOCAL)
|
|
248
|
+
Returns the type of storage backing the vector store (could be CHROMA, PINECONE, ELASTICSEARCH, AZURE_AI_SEARCH, SNOWFLAKE_CORTEX_SEARCH, VERTEX_AI_GCS_BASED, FAISS, QDRANT_LOCAL)
|
|
249
249
|
|
|
250
250
|
:rtype: str
|
|
251
251
|
"""
|
|
@@ -2,11 +2,8 @@ import textwrap
|
|
|
2
2
|
import warnings
|
|
3
3
|
from typing import Optional, Callable, Literal, Type, Any, Dict
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
except ModuleNotFoundError:
|
|
8
|
-
from langchain.tools import StructuredTool
|
|
9
|
-
|
|
5
|
+
from langchain_core.tools import StructuredTool, create_schema_from_function
|
|
6
|
+
from langchain_core.tools.structured import _filter_schema_args
|
|
10
7
|
from pydantic import BaseModel
|
|
11
8
|
|
|
12
9
|
from dataiku.langchain.dku_tracer import dku_span_builder_for_callbacks
|
|
@@ -98,12 +95,12 @@ class DKUStructuredTool(StructuredTool):
|
|
|
98
95
|
name = name or source_function.__name__
|
|
99
96
|
if args_schema is None and infer_schema:
|
|
100
97
|
# schema name is appended within function
|
|
101
|
-
args_schema = create_schema_from_function(
|
|
98
|
+
args_schema = create_schema_from_function(
|
|
102
99
|
name,
|
|
103
100
|
source_function,
|
|
104
101
|
parse_docstring=parse_docstring,
|
|
105
102
|
error_on_invalid_docstring=error_on_invalid_docstring,
|
|
106
|
-
filter_args=_filter_schema_args(source_function),
|
|
103
|
+
filter_args=_filter_schema_args(source_function),
|
|
107
104
|
)
|
|
108
105
|
description_ = description
|
|
109
106
|
if description is None and not parse_docstring:
|