API reference

Client

DIClient

DIClient The DIClient class serves as a client interface for interacting with the Data Intelligence (DI) solution. It provides methods to retrieve and interact with various data entities such as collections, pipelines, and models. Additionally, it supports performing similarity searches within collections. This class is designed for general-purpose usage and is intended for scenarios where non-administrative operations are required. For administrative operations, such as managing users, permissions, or system-level configurations, the DIAdminClient class should be used instead.

Purpose:

The DIClient class simplifies the interaction with the DI solution by abstracting the underlying API calls and providing a Pythonic interface for common operations. It is particularly useful for developers and data scientists who need to work with DI collections, pipelines, and models in their workflows.

Key Features:

  1. Retrieve specific or all collections, pipelines and models.
  2. Perform similarity searches within a specified collection.
  3. Provides a session object for managing API interactions.

Usage:

  • Use this class for non-administrative tasks such as querying collections, retrieving pipelines, or performing similarity searches.
  • Avoid using this class for administrative tasks. For such operations, use the DIAdminClient class.
Source code in pydi_client/di_client.py
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
class DIClient:
    """
    DIClient
    The `DIClient` class serves as a client interface for interacting with the Data Intelligence (DI) solution.
    It provides methods to retrieve and interact with various data entities such as collections, pipelines,
    and models. Additionally, it supports performing similarity searches within collections.
    This class is designed for general-purpose usage and is intended for scenarios where non-administrative
    operations are required. For administrative operations, such as managing users, permissions, or system-level
    configurations, the `DIAdminClient` class should be used instead.

    Purpose:
    --------
    The `DIClient` class simplifies the interaction with the DI solution by abstracting the underlying API calls
    and providing a Pythonic interface for common operations. It is particularly useful for developers and data
    scientists who need to work with DI collections, pipelines, and models in their workflows.

    Key Features:
    -------------
    1. Retrieve specific or all collections, pipelines and models.
    2. Perform similarity searches within a specified collection.
    3. Provides a session object for managing API interactions.

    Usage:
    ------
    - Use this class for non-administrative tasks such as querying collections, retrieving pipelines, or performing
        similarity searches.
    - Avoid using this class for administrative tasks. For such operations, use the `DIAdminClient` class.
    """

    def __init__(self, *, uri=None) -> None:
        self._session = Session(uri=uri)  # type: ignore

    @property
    def session(self) -> Session:
        """
        Property to get the session object.

        Returns:
            Session: The session object used for making API requests. This session is initialized with the provided URI.

        """
        return self._session

    def get_collection(self, *, name: str) -> V1CollectionResponse:
        """
        Retrieve a collection by its name.

        Args:
            name (str): The name of the collection to retrieve. This is a required keyword-only argument.

        Returns:
            V1CollectionResponse: The collection object corresponding to the
            specified name.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            collection = client.get_collection(name="example_collection")
            print(collection)
            # Output: V1CollectionResponse(
            #     name="example_collection",
            #     pipeline="rag-pipeline",
            #     buckets=["bucket-1", "bucket-2"],
            #     outputStore=None,
            #     indexingMode="HNSW"
            # )
            ```
        """
        return CollectionAPI(self.session).get_collection(name=name)

    def get_all_collections(self) -> ListCollection:
        """
        Retrieves all collections available in the system.

        Returns:
            ListCollection: A response object containing a list of
            collections available in the system.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            collections = client.get_all_collections()
            for collection in collections.root:
                print(collection.name)
            # Output:
            # ListCollection(
            #     root=[
            #         ListCollectionItem(id="1", name="collection1"),
            #         ListCollectionItem(id="2", name="collection2")
            #     ]
            # )
            ```
        """

        return CollectionAPI(self.session).get_collections()

    def get_pipeline(self, *, name: str) -> V1PipelineResponse:
        """
        Retrieve a pipeline by its name.
        This method fetches a pipeline object from the PipelineAPI using the provided name.

        Args:
            name (str): The name of the pipeline to retrieve. This is a required keyword-only argument.

        Returns:
            V1PipelineResponse: The response object containing details about the pipeline.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            pipeline = client.get_pipeline(name="example_pipeline")
            print(pipeline)
            # Output: V1PipelineResponse(
            #     name="example_pipeline",
            #     type="rag",
            #     model="example_model",
            #     customFunction=None,
            #     eventFilter={"objectSuffix": ["*.txt", "*.pdf"],
            #                  "maxObjectSize": 10485760},
            #     schema_name="example_schema",
            #     prompt=None,
            #     chunkSize=512,
            #     chunkOverlap=50
            # )
            ```

        Note:
            The schema is exposed as the ``schema_name`` attribute because ``schema`` collides with a
            reserved Pydantic attribute. It is serialized and deserialized as ``schema``.
        """
        return PipelineAPI(self.session).get_pipeline(name=name)

    def get_all_pipelines(self) -> ListPipelines:
        """
        Retrieves all pipelines available in the system.

        Returns:
            ListPipelines: A response object containing a list of
            pipelines available in the system.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            pipelines = client.get_all_pipelines()
            for pipeline in pipelines.root:
                print(pipeline.name)
            # Output:
            # ListPipelines(
            #     root=[
            #         ListPipeline(id="1", name="pipeline1"),
            #         ListPipeline(id="2", name="pipeline2")
            #     ]
            # )
            ```
        """
        return PipelineAPI(self.session).get_pipelines()

    def similarity_search(
        self,
        *,
        access_key: str,
        secret_key: str,
        collection_name: str,
        query: str,
        top_k: int,
        search_parameters: Union[Any, Dict[str, Any]] = None,
    ) -> Union[Any, List[Dict[str, Any]]]:
        """
        Perform a similarity search on a specified collection using the provided query.
        This method interacts with the SimilaritySearchAPI to retrieve the most relevant
        results from a collection based on the given query. The results are ranked by
        similarity, and the top `k` results are returned.

        Args:
            query (str): The search query string used to find similar items in the collection.
            collection_name (str): The name of the collection to search within.
            top_k (int): The number of top similar results to retrieve.
            access_key (str): The access key for authentication with the API.
            secret_key (str): The secret key for authentication with the API.
            search_parameters (Optional[Union[Any, Dict[str, Any]]]): Additional search parameters
                that can be passed to the API for fine-tuning the search behavior.

        Returns:
            Union[Any, List[Dict[str, Any]]]: A list of dictionaries containing the top `k` similar results, or another data type depending on the API's response.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            results = client.similarity_search(
                query="machine learning",
                collection_name="research_papers",
                top_k=5,
                access_key="your_access_key",
                secret_key="your_secret_key",
                search_parameters={"metric": "cosine", "ef_search": "100"}
            )
            print(results)
            # Output:
            # [
            #     {
            #         "dataChunk": "chunk1",
            #         "score": 0.9,
            #         "chunkMetadata": {
            #             "objectKey": "value",
            #             "startCharIndex": 1,
            #             "endCharIndex": 2,
            #             "bucketName": "string",
            #             "pageLabel": "string",
            #             "versionId": "string",
            #         }
            #     }
            # ]
            ```
        """
        return SimilaritySearchAPI(self.session).search(
            query=query,
            collection_name=collection_name,
            top_k=top_k,
            access_key=access_key,
            secret_key=secret_key,
            search_parameters=search_parameters,
        )

    def get_model(self, *, name: str) -> V1ModelsResponse:
        """
        Retrieve a model by its name.
        This method fetches a model object from the ModelAPI using the provided name.

        Args:
            name (str): The name of the model to retrieve. This is a required keyword-only argument.

        Returns:
            V1ModelsResponse: The response object containing details about the model.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            model = client.get_model(name="example_model")
            print(model)
            # Output: V1ModelsResponse(
            #     name="example_model",
            #     modelName="...",
            #     capabilities=["..."],
            #     version="...",
            #     communicationType="...", # e.g. Ollama API
            #     dimension=...,  # e.g., 768
            #     contextLength=...,  # e.g., 1024
            #     temperature=...,  # e.g., 0.7
            #     topK=...,  # e.g., 40
            #     topP=...,  # e.g., 0.9
            #     maximumTokens=...,  # e.g., 512
            #     timeout=...,  # e.g., 300
            #     language="...",  # e.g., "en-US"
            #     sampleRate=...,  # e.g., 16000
            #     automaticPunctuation=...,  # e.g., True
            #     endpoint="...",  # custom-function models only
            # )
            ```
        """
        return ModelAPI(self.session).get_model(name=name)

    def get_all_models(self) -> V1ListModelsResponse:
        """
        Retrieves all models available in the system.

        Returns:
            V1ListModelsResponse: A response object containing a list of
            models available in the system.

        Example usage:
            ```python
            client = DIClient(uri="https://example.com")
            models = client.get_all_models()
            print(models)
            # Output: V1ListModelsResponse(
            #     models=[ModelRecordSummary(id="1", name="example_model")]
            # )

            for model in models.models:
                print(model.name)
            ```
        """
        return ModelAPI(self.session).get_models()

session property

Property to get the session object.

Returns:
  • Session( Session ) –

    The session object used for making API requests. This session is initialized with the provided URI.

get_collection(*, name)

Retrieve a collection by its name.

Parameters:
  • name (str) –

    The name of the collection to retrieve. This is a required keyword-only argument.

Returns:
Example usage
client = DIClient(uri="https://example.com")
collection = client.get_collection(name="example_collection")
print(collection)
# Output: V1CollectionResponse(
#     name="example_collection",
#     pipeline="rag-pipeline",
#     buckets=["bucket-1", "bucket-2"],
#     outputStore=None,
#     indexingMode="HNSW"
# )
Source code in pydi_client/di_client.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
def get_collection(self, *, name: str) -> V1CollectionResponse:
    """
    Retrieve a collection by its name.

    Args:
        name (str): The name of the collection to retrieve. This is a required keyword-only argument.

    Returns:
        V1CollectionResponse: The collection object corresponding to the
        specified name.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        collection = client.get_collection(name="example_collection")
        print(collection)
        # Output: V1CollectionResponse(
        #     name="example_collection",
        #     pipeline="rag-pipeline",
        #     buckets=["bucket-1", "bucket-2"],
        #     outputStore=None,
        #     indexingMode="HNSW"
        # )
        ```
    """
    return CollectionAPI(self.session).get_collection(name=name)

get_all_collections()

Retrieves all collections available in the system.

Returns:
Example usage
client = DIClient(uri="https://example.com")
collections = client.get_all_collections()
for collection in collections.root:
    print(collection.name)
# Output:
# ListCollection(
#     root=[
#         ListCollectionItem(id="1", name="collection1"),
#         ListCollectionItem(id="2", name="collection2")
#     ]
# )
Source code in pydi_client/di_client.py
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
def get_all_collections(self) -> ListCollection:
    """
    Retrieves all collections available in the system.

    Returns:
        ListCollection: A response object containing a list of
        collections available in the system.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        collections = client.get_all_collections()
        for collection in collections.root:
            print(collection.name)
        # Output:
        # ListCollection(
        #     root=[
        #         ListCollectionItem(id="1", name="collection1"),
        #         ListCollectionItem(id="2", name="collection2")
        #     ]
        # )
        ```
    """

    return CollectionAPI(self.session).get_collections()

get_pipeline(*, name)

Retrieve a pipeline by its name. This method fetches a pipeline object from the PipelineAPI using the provided name.

Parameters:
  • name (str) –

    The name of the pipeline to retrieve. This is a required keyword-only argument.

Returns:
  • V1PipelineResponse( V1PipelineResponse ) –

    The response object containing details about the pipeline.

Example usage
client = DIClient(uri="https://example.com")
pipeline = client.get_pipeline(name="example_pipeline")
print(pipeline)
# Output: V1PipelineResponse(
#     name="example_pipeline",
#     type="rag",
#     model="example_model",
#     customFunction=None,
#     eventFilter={"objectSuffix": ["*.txt", "*.pdf"],
#                  "maxObjectSize": 10485760},
#     schema_name="example_schema",
#     prompt=None,
#     chunkSize=512,
#     chunkOverlap=50
# )
Note

The schema is exposed as the schema_name attribute because schema collides with a reserved Pydantic attribute. It is serialized and deserialized as schema.

Source code in pydi_client/di_client.py
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
def get_pipeline(self, *, name: str) -> V1PipelineResponse:
    """
    Retrieve a pipeline by its name.
    This method fetches a pipeline object from the PipelineAPI using the provided name.

    Args:
        name (str): The name of the pipeline to retrieve. This is a required keyword-only argument.

    Returns:
        V1PipelineResponse: The response object containing details about the pipeline.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        pipeline = client.get_pipeline(name="example_pipeline")
        print(pipeline)
        # Output: V1PipelineResponse(
        #     name="example_pipeline",
        #     type="rag",
        #     model="example_model",
        #     customFunction=None,
        #     eventFilter={"objectSuffix": ["*.txt", "*.pdf"],
        #                  "maxObjectSize": 10485760},
        #     schema_name="example_schema",
        #     prompt=None,
        #     chunkSize=512,
        #     chunkOverlap=50
        # )
        ```

    Note:
        The schema is exposed as the ``schema_name`` attribute because ``schema`` collides with a
        reserved Pydantic attribute. It is serialized and deserialized as ``schema``.
    """
    return PipelineAPI(self.session).get_pipeline(name=name)

get_all_pipelines()

Retrieves all pipelines available in the system.

Returns:
Example usage
client = DIClient(uri="https://example.com")
pipelines = client.get_all_pipelines()
for pipeline in pipelines.root:
    print(pipeline.name)
# Output:
# ListPipelines(
#     root=[
#         ListPipeline(id="1", name="pipeline1"),
#         ListPipeline(id="2", name="pipeline2")
#     ]
# )
Source code in pydi_client/di_client.py
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
def get_all_pipelines(self) -> ListPipelines:
    """
    Retrieves all pipelines available in the system.

    Returns:
        ListPipelines: A response object containing a list of
        pipelines available in the system.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        pipelines = client.get_all_pipelines()
        for pipeline in pipelines.root:
            print(pipeline.name)
        # Output:
        # ListPipelines(
        #     root=[
        #         ListPipeline(id="1", name="pipeline1"),
        #         ListPipeline(id="2", name="pipeline2")
        #     ]
        # )
        ```
    """
    return PipelineAPI(self.session).get_pipelines()

Perform a similarity search on a specified collection using the provided query. This method interacts with the SimilaritySearchAPI to retrieve the most relevant results from a collection based on the given query. The results are ranked by similarity, and the top k results are returned.

Parameters:
  • query (str) –

    The search query string used to find similar items in the collection.

  • collection_name (str) –

    The name of the collection to search within.

  • top_k (int) –

    The number of top similar results to retrieve.

  • access_key (str) –

    The access key for authentication with the API.

  • secret_key (str) –

    The secret key for authentication with the API.

  • search_parameters (Optional[Union[Any, Dict[str, Any]]], default: None ) –

    Additional search parameters that can be passed to the API for fine-tuning the search behavior.

Returns:
  • Union[Any, List[Dict[str, Any]]]

    Union[Any, List[Dict[str, Any]]]: A list of dictionaries containing the top k similar results, or another data type depending on the API's response.

Example usage
client = DIClient(uri="https://example.com")
results = client.similarity_search(
    query="machine learning",
    collection_name="research_papers",
    top_k=5,
    access_key="your_access_key",
    secret_key="your_secret_key",
    search_parameters={"metric": "cosine", "ef_search": "100"}
)
print(results)
# Output:
# [
#     {
#         "dataChunk": "chunk1",
#         "score": 0.9,
#         "chunkMetadata": {
#             "objectKey": "value",
#             "startCharIndex": 1,
#             "endCharIndex": 2,
#             "bucketName": "string",
#             "pageLabel": "string",
#             "versionId": "string",
#         }
#     }
# ]
Source code in pydi_client/di_client.py
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
def similarity_search(
    self,
    *,
    access_key: str,
    secret_key: str,
    collection_name: str,
    query: str,
    top_k: int,
    search_parameters: Union[Any, Dict[str, Any]] = None,
) -> Union[Any, List[Dict[str, Any]]]:
    """
    Perform a similarity search on a specified collection using the provided query.
    This method interacts with the SimilaritySearchAPI to retrieve the most relevant
    results from a collection based on the given query. The results are ranked by
    similarity, and the top `k` results are returned.

    Args:
        query (str): The search query string used to find similar items in the collection.
        collection_name (str): The name of the collection to search within.
        top_k (int): The number of top similar results to retrieve.
        access_key (str): The access key for authentication with the API.
        secret_key (str): The secret key for authentication with the API.
        search_parameters (Optional[Union[Any, Dict[str, Any]]]): Additional search parameters
            that can be passed to the API for fine-tuning the search behavior.

    Returns:
        Union[Any, List[Dict[str, Any]]]: A list of dictionaries containing the top `k` similar results, or another data type depending on the API's response.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        results = client.similarity_search(
            query="machine learning",
            collection_name="research_papers",
            top_k=5,
            access_key="your_access_key",
            secret_key="your_secret_key",
            search_parameters={"metric": "cosine", "ef_search": "100"}
        )
        print(results)
        # Output:
        # [
        #     {
        #         "dataChunk": "chunk1",
        #         "score": 0.9,
        #         "chunkMetadata": {
        #             "objectKey": "value",
        #             "startCharIndex": 1,
        #             "endCharIndex": 2,
        #             "bucketName": "string",
        #             "pageLabel": "string",
        #             "versionId": "string",
        #         }
        #     }
        # ]
        ```
    """
    return SimilaritySearchAPI(self.session).search(
        query=query,
        collection_name=collection_name,
        top_k=top_k,
        access_key=access_key,
        secret_key=secret_key,
        search_parameters=search_parameters,
    )

get_model(*, name)

Retrieve a model by its name. This method fetches a model object from the ModelAPI using the provided name.

Parameters:
  • name (str) –

    The name of the model to retrieve. This is a required keyword-only argument.

Returns:
  • V1ModelsResponse( V1ModelsResponse ) –

    The response object containing details about the model.

Example usage
client = DIClient(uri="https://example.com")
model = client.get_model(name="example_model")
print(model)
# Output: V1ModelsResponse(
#     name="example_model",
#     modelName="...",
#     capabilities=["..."],
#     version="...",
#     communicationType="...", # e.g. Ollama API
#     dimension=...,  # e.g., 768
#     contextLength=...,  # e.g., 1024
#     temperature=...,  # e.g., 0.7
#     topK=...,  # e.g., 40
#     topP=...,  # e.g., 0.9
#     maximumTokens=...,  # e.g., 512
#     timeout=...,  # e.g., 300
#     language="...",  # e.g., "en-US"
#     sampleRate=...,  # e.g., 16000
#     automaticPunctuation=...,  # e.g., True
#     endpoint="...",  # custom-function models only
# )
Source code in pydi_client/di_client.py
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
def get_model(self, *, name: str) -> V1ModelsResponse:
    """
    Retrieve a model by its name.
    This method fetches a model object from the ModelAPI using the provided name.

    Args:
        name (str): The name of the model to retrieve. This is a required keyword-only argument.

    Returns:
        V1ModelsResponse: The response object containing details about the model.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        model = client.get_model(name="example_model")
        print(model)
        # Output: V1ModelsResponse(
        #     name="example_model",
        #     modelName="...",
        #     capabilities=["..."],
        #     version="...",
        #     communicationType="...", # e.g. Ollama API
        #     dimension=...,  # e.g., 768
        #     contextLength=...,  # e.g., 1024
        #     temperature=...,  # e.g., 0.7
        #     topK=...,  # e.g., 40
        #     topP=...,  # e.g., 0.9
        #     maximumTokens=...,  # e.g., 512
        #     timeout=...,  # e.g., 300
        #     language="...",  # e.g., "en-US"
        #     sampleRate=...,  # e.g., 16000
        #     automaticPunctuation=...,  # e.g., True
        #     endpoint="...",  # custom-function models only
        # )
        ```
    """
    return ModelAPI(self.session).get_model(name=name)

get_all_models()

Retrieves all models available in the system.

Returns:
Example usage
client = DIClient(uri="https://example.com")
models = client.get_all_models()
print(models)
# Output: V1ListModelsResponse(
#     models=[ModelRecordSummary(id="1", name="example_model")]
# )

for model in models.models:
    print(model.name)
Source code in pydi_client/di_client.py
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
def get_all_models(self) -> V1ListModelsResponse:
    """
    Retrieves all models available in the system.

    Returns:
        V1ListModelsResponse: A response object containing a list of
        models available in the system.

    Example usage:
        ```python
        client = DIClient(uri="https://example.com")
        models = client.get_all_models()
        print(models)
        # Output: V1ListModelsResponse(
        #     models=[ModelRecordSummary(id="1", name="example_model")]
        # )

        for model in models.models:
            print(model.name)
        ```
    """
    return ModelAPI(self.session).get_models()

DIAdminClient

Bases: DIClient

DIAdminClient The DIAdminClient class is an extension of the DIClient class, designed specifically for administrative operations within the Data Intelligence (DI) platform. This class provides methods to manage collections, pipelines, schemas, and their associated resources. It is intended for use cases where administrative privileges are required to perform operations such as creating, deleting, or modifying collections, pipelines, and schemas.

Purpose:

The DIAdminClient is tailored for scenarios where administrative-level API interactions are necessary. It provides a higher level of control over the DI platform's resources, enabling administrators to configure and manage the system effectively.

When to Use:

  • Use this class when you need to perform administrative tasks such as:

    • Creating or deleting collections.

    • Assigning or unassigning buckets to/from collections.

    • Creating or deleting pipelines.

    • Creating or deleting schemas.

  • This class is specifically designed for admin APIs. For non-admin APIs, use the DIClient class instead.

Initialization:

The DIAdminClient requires authentication credentials (username and password) to establish an authenticated session with the DI platform. Upon initialization, it creates an authenticated session that is used for all subsequent API calls.


Source code in pydi_client/di_client.py
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
class DIAdminClient(DIClient):
    """
    DIAdminClient
    The `DIAdminClient` class is an extension of the `DIClient` class, designed specifically for administrative operations
    within the Data Intelligence (DI) platform. This class provides methods to manage collections, pipelines, schemas,
    and their associated resources. It is intended for use cases where administrative privileges are required to perform
    operations such as creating, deleting, or modifying collections, pipelines, and schemas.

    Purpose:
    ---------
    The `DIAdminClient` is tailored for scenarios where administrative-level API interactions are necessary.
    It provides a higher level of control over the DI platform's resources, enabling administrators to configure
    and manage the system effectively.

    When to Use:
    ------------
    - Use this class when you need to perform administrative tasks such as:

        - Creating or deleting collections.

        - Assigning or unassigning buckets to/from collections.

        - Creating or deleting pipelines.

        - Creating or deleting schemas.

    - This class is specifically designed for admin APIs. For non-admin APIs, use the `DIClient` class instead.

    Initialization:
    ---------------
    The `DIAdminClient` requires authentication credentials (username and password) to establish an authenticated session
    with the DI platform. Upon initialization, it creates an authenticated session that is used for all subsequent API calls.
    --------
    """

    def __init__(self, *, uri: str, username: str, password: str) -> None:
        super().__init__(uri=uri)

        # create session with auth
        self._authenticated_session = AuthAPI.login(
            uri=uri, username=username, password=password
        )

    @property
    def authenticated_session(self) -> AuthenticatedSession:
        """
        Property to get the authenticated session object.

        Returns:
        AuthenticatedSession: The authenticated session object used for making API requests.This session is initialized with the provided URI, username, password, and token.

        """
        return self._authenticated_session

    def create_collection(
        self,
        *,
        name: str,
        pipeline: str,
        buckets: Optional[List[str]] = None,
        output_store: Optional[str] = None,
        indexing_mode: Optional[str] = None,
    ) -> V1CollectionResponse:
        """
        Creates a new collection using the specified pipeline.
        If buckets are provided, they will be associated with the collection and inline embedding generation will be triggered.
        If buckets are not provided, the collection will be created but embedding generation will be deferred until buckets are assigned to the collection.

        Args:
            name (str): The name of the collection to be created. This should be unique.
            pipeline (str): The name of the pipeline to be associated with the collection.
            buckets (Optional[List[str]], optional): A list of bucket names. Defaults to None.
            output_store (Optional[str], optional): Output bucket for transcription results. Defaults to None.
            indexing_mode (Optional[str], optional): Indexing mode for RAG collections (supported values: 'HNSW', 'GPU_CAGRA'). Auto-detected if omitted. Defaults to None.

        Returns:
            V1CollectionResponse: The created collection object.

        Example usage:
            ```python
            # Example usage of create_collection
            client = DIAdminClient(uri="https://example.com", username="admin", password="password")
            collection = client.create_collection(
                name="example_collection",
                pipeline="data_ingestion_pipeline",
                buckets=["bucket1", "bucket2"],
                output_store="output-bucket"
            )
            print(collection)
            # Sample Output:
            # V1CollectionResponse(
            #     name="example_collection",
            #     pipeline="data_ingestion_pipeline",
            #     buckets=["bucket1", "bucket2"],
            #     outputStore="output-bucket"
            # )
            ```
        """
        if buckets is None:
            buckets = []

        return CollectionAPI(session=self.authenticated_session).create_collection(
            name=name,
            buckets=buckets,
            pipeline=pipeline,
            output_store=output_store,
            indexing_mode=indexing_mode,
        )

    def delete_collection(self, *, name: str) -> V1DeleteCollectionResponse:
        """
        Deletes a collection by its name.

        Args:
            name (str): The name of the collection to be deleted.

        Returns:
            V1DeleteCollectionResponse: The response object containing details about the deleted collection.

        Example Usage:
            ```python
            client = DIAdminClient(uri="https://example.com", username="admin", password="password")
            resp = client.delete_collection(name="example_collection")
            print(resp)
            # Output:
            # V1DeleteCollectionResponse(
            #     success=True,
            #     message="Collection 'example_collection' has been deleted."
            # )
            ```
        """
        return CollectionAPI(session=self.authenticated_session).delete_collection(
            name=name
        )

    def assign_buckets_to_collection(
        self, *, collection_name: str, buckets: List[str]
    ) -> BucketUpdateResponse:
        """
        Assigns a list of buckets to a specified collection.
        This enables inline embedding generation for the specified buckets.

        Args:
            collection_name (str): The name of the collection to which the buckets
                will be assigned.
            buckets (List[str]): A list of bucket names to be assigned to the
                specified collection.

        Returns:
            BucketUpdateResponse: The response object containing details about the
            updated collection and assigned buckets.

        Example Usage:
            ```python
            # Initialize the DIAdminClient
            client = DIAdminClient(uri="http://example.com", username="admin", password="password")
            # Define the collection name and buckets
            collection_name = "my_collection"
            buckets = ["bucket1", "bucket2", "bucket3"]
            # Assign buckets to the collection
            response = client.assign_buckets_to_collection(
                collection_name=collection_name,
                buckets=buckets
            )
            print(response)
            # Output:
            # BucketUpdateResponse(
            #     success=True,
            #     message="Buckets assigned successfully to collection 'my_collection'."
            # )
            ```
        Notes:
            - This method is typically used for enabling the user buckets for intelligence using an existing collection.
        """

        return CollectionAPI(
            session=self.authenticated_session
        ).assign_buckets_to_collection(collection_name=collection_name, buckets=buckets)

    def unassign_buckets_from_collection(
        self, *, collection_name: str, buckets: List[str]
    ) -> BucketUpdateResponse:
        """
        Unassigns one or more buckets from a specified collection.

        Args:
            collection_name (str): The name of the collection from which the buckets will be unassigned.
            buckets (List[str]): A list of bucket names to be unassigned.

        Returns:
            BucketUpdateResponse: The response object containing details about the updated collection
            after the buckets have been unassigned.

        Example usage:
            ```python
            # Example usage of unassign_buckets_from_collection
            client = DIAdminClient(uri="http://example.com", username="admin", password="password")

            # Unassign multiple buckets
            response = client.unassign_buckets_from_collection(
                collection_name="example_collection",
                buckets=["bucket_1", "bucket_2", "bucket_3"]
            )
            print(response)
            # Output:
            # BucketUpdateResponse(
            #     success=True,
            #     message="Buckets unassigned successfully from collection 'example_collection'."
            # )
            ```
        """
        return CollectionAPI(
            session=self.authenticated_session
        ).unassign_buckets_from_collection(
            collection_name=collection_name, buckets=buckets
        )

    @normalize_pipeline_argument_errors
    def create_pipeline(
        self,
        *,
        name: str,
        pipeline_type: str,
        event_filter_object_suffix: List[str],
        schema: str,
        event_filter_max_object_size: Optional[int] = None,
        model: Optional[str] = None,
        custom_func: Optional[str] = None,
        prompt: Optional[str] = None,
        chunk_size: Optional[int] = None,
        chunk_overlap: Optional[int] = None,
    ) -> V1CreatePipelineResponse:
        """
        Creates a new pipeline with the specified configuration.

        Args:
            name (str): The name of the pipeline to be created.
            pipeline_type (str): The type of the pipeline ("rag", "metadata", "transcribe-metadata" or "custom-function").
            event_filter_object_suffix (List[str]): A list of file suffixes to filter events. Ex - ["*.txt", "*.pdf"]
            schema (str): The schema definition for the pipeline.
            event_filter_max_object_size Optional (int): The maximum object size for event filtering. Ex - 10485760
            model Optional (str): The model associated with the pipeline. Required for "rag" and "custom-function" pipelines.
            custom_func Optional (str): The custom function to be used in the pipeline. Required for "metadata" pipelines.
            prompt Optional (str): The prompt for transcribe pipelines (e.g., "Transcribe the image content into text.").
            chunk_size Optional (int): Chunk size for RAG pipelines.
            chunk_overlap Optional (int): Chunk overlap for RAG pipelines.

        Returns:
            V1CreatePipelineResponse: The response object containing details of the created pipeline.

        Raises:
            PipelineValidationError: If the arguments are invalid or incomplete, or if the server rejects
                the request with an HTTP 422 validation error.

        Example usage:
            ```python
            client = DIAdminClient(
                uri="http://example.com",
                username="admin",
                password="password"
            )
            pipeline_data = client.create_pipeline(
                name="example_pipeline",
                pipeline_type="rag",
                model="example_model",
                event_filter_object_suffix=["*.txt", "*.pdf"],
                event_filter_max_object_size=10485760,
                schema="example_schema"
            )
            print(pipeline_data)
            # Output: V1CreatePipelineResponse(
            #     success=true,
            #     message="Pipeline 'example_pipeline' created successfully."
            # )
            ```
        """

        return PipelineAPI(session=self.authenticated_session).create_pipeline(
            name=name,
            pipeline_type=pipeline_type,
            model=model,
            custom_func=custom_func,
            event_filter_object_suffix=event_filter_object_suffix,
            event_filter_max_object_size=event_filter_max_object_size,
            schema=schema,
            prompt=prompt,
            chunk_size=chunk_size,
            chunk_overlap=chunk_overlap,
        )

    def delete_pipeline(self, *, name: str) -> V1DeletePipelineResponse:
        """
        Deletes a pipeline with the specified name.

        Args:
            name (str): The name of the pipeline to be deleted.

        Returns:
            V1DeletePipelineResponse: The response object containing details about the deleted pipeline.

        Example usage:
            ```python
            # Initialize the DIAdminClient
            client = DIAdminClient(uri="http://example.com", username="admin", password="password")

            # Delete a pipeline by name
            response = client.delete_pipeline(name="example_pipeline")
            print(response)
            # Output:
            # V1DeletePipelineResponse(
            #     message="Pipeline successfully deleted",
            #     success=True,
            # )
            ```
        """
        return PipelineAPI(session=self.authenticated_session).delete_pipeline(
            name=name
        )

    def get_schema(self, *, name: str) -> V1SchemasResponse:
        """
        Retrieve a schema by its name.
        This method fetches a schema object from the SchemaAPI using the provided name.

        Args:
            name (str): The name of the schema to retrieve. This is a required keyword-only argument.

        Returns:
            V1SchemasResponse: The response object containing details about the schema.

        Example usage:
            ```python
            client = DIAdminClient(uri="https://example.com", username="admin", password="password")
            schema = client.get_schema(name="example_schema")
            print(schema)
            # Output: V1SchemasResponse(
            #     name="example_schema",
            #     type="...",
            #     schema_fields=[SchemaItem(name="id", type="varchar", nullable=False)]
            # )
            ```

        Note:
            The schema fields are exposed as the ``schema_fields`` attribute because ``schema`` collides
            with a reserved Pydantic attribute. They are serialized and deserialized as ``schema``.
        """
        return SchemaAPI(session=self.authenticated_session).get_schema(name=name)

    def get_all_schemas(self) -> V1ListSchemasResponse:
        """
        Retrieves all schemas available in the system.

        Returns:
            V1ListSchemasResponse: A response object containing a list of
            schemas available in the system.

        Example usage:
            ```python
            client = DIAdminClient(uri="https://example.com", username="admin", password="password")
            schemas = client.get_all_schemas()
            print(schemas)
            # Output: V1ListSchemasResponse(
            #     schemas=[SchemaListItem(id="1", name="example_schema")]
            # )
            ```
        """
        return SchemaAPI(session=self.authenticated_session).get_schemas()

    @deprecated(
        message="This method is deprecated and will be removed in future versions. Please use get_model() instead."
    )
    def get_embedding_model(self, *, name: str) -> V1ModelsResponse:
        """
        Retrieve an embedding model by its name.
        This method fetches an embedding model object from the ModelAPI using the provided name.

        .. Deprecated::
          This method is deprecated and will be removed in future versions. Please use `get_model` instead.

        Args:
            name (str): The name of the embedding model to retrieve. This is a required keyword-only argument.

        Returns:
            V1ModelsResponse: The response object containing details about the embedding model.

        Example usage:
            ```python
            client = DIAdminClient(uri="https://example.com", username="admin", password="password")
            model = client.get_embedding_model(name="example_model")
            print(model)
            # Output: V1ModelsResponse(
            #     name="example_model",
            #     modelName="...",
            #     capabilities=["Sentence-Similarity"],
            #     version="...",
            #     dimension=...,  # e.g., 768
            #     maximumTokens=...,  # e.g., 512
            # )
            ```
        """
        return ModelAPI(self.authenticated_session).get_model(name=name)

    @deprecated(
        message="This method is deprecated and will be removed in future versions. Please use get_all_models() instead."
    )
    def get_all_embedding_models(self) -> V1ListModelsResponse:
        """
        Retrieves all embedding models available in the system.

        .. Deprecated::
            This method is deprecated and will be removed in future versions. Please use `get_all_models` instead.

        Returns:
            V1ListModelsResponse: A response object containing a list of
            embedding models available in the system.

        Example usage:
            ```python
            client = DIAdminClient(uri="https://example.com", username="admin", password="password")
            models = client.get_all_embedding_models()
            print(models)
            # Output: V1ListModelsResponse(
            #     models=[ModelRecordSummary(id="1", name="example_embedding_model")]
            # )
            ```
        """
        try:
            model_api = ModelAPI(self.authenticated_session)
            models = model_api.get_models()
            embedding_models_list = list()
            for model in models.models:
                model_details = model_api.get_model(name=model.name)
                if any(
                    capability.lower() == ModelTags.SENTENCE_SIMILARITY.value.lower()
                    for capability in model_details.capabilities
                ):
                    embedding_models_list.append(model)
        except (UnexpectedResponse, UnexpectedStatus) as e:
            raise e

        return V1ListModelsResponse(models=embedding_models_list)

    def create_schema(
        self,
        *,
        name: str,
        schema_type: str,
        schema: List[SchemaItem],
    ) -> V1CreateSchemaResponse:
        """
        Create a new schema.

        Args:
            name (str): The name of the schema to create.
            schema_type (str): The schema type (e.g., 'custom-function').
            schema (List[SchemaItem]): List of schema fields. Each field has a
                ``name`` and ``type``, and may optionally include a ``nullable``
                flag (defaults to ``True``). Set ``nullable`` to ``False`` to
                mark a field as required: the underlying database column is created
                as ``NOT NULL`` and schema validation is strict for that field,
                while fields left as ``nullable=True`` are validated non-strictly.

        Returns:
            V1CreateSchemaResponse: Response indicating success or failure.

        Example usage:
            ```python
            schema_response = client.create_schema(
                name="yolo-detection-schema",
                schema_type="custom-function",
                schema=[{"name": "id", "type": "varchar", "nullable": False},
                        {"name": "content", "type": "varchar"},
                        {"name": "embedding", "type": "array(real)", "nullable": True},
                    ]
            )
            # "id" is required (NOT NULL, strict validation); "content" and
            # "embedding" allow nulls (nullable defaults to True when omitted).
            ```
        """
        return SchemaAPI(session=self.authenticated_session).create_schema(
            name=name,
            schema_type=schema_type,
            schema=schema,
        )

    def delete_schema(self, *, name: str) -> V1DeleteSchemaResponse:
        """
        Deletes a schema with the specified name.

        Args:
            name (str): The name of the schema to be deleted.

        Returns:
            V1DeleteSchemaResponse: The response object containing details about the deleted schema.

        Example usage:
            ```python
            # Initialize the DIAdminClient
            client = DIAdminClient(uri="http://example.com", username="admin", password="password")

            # Delete a schema by name
            response = client.delete_schema(name="example_schema")
            print(response)
            # Output:
            # V1DeleteSchemaResponse(
            #     message="Schema successfully deleted"
            #     success=True,
            # )
            ```
        """
        return SchemaAPI(session=self.authenticated_session).delete_schema(name=name)

authenticated_session property

Property to get the authenticated session object.

Returns: AuthenticatedSession: The authenticated session object used for making API requests.This session is initialized with the provided URI, username, password, and token.

create_collection(*, name, pipeline, buckets=None, output_store=None, indexing_mode=None)

Creates a new collection using the specified pipeline. If buckets are provided, they will be associated with the collection and inline embedding generation will be triggered. If buckets are not provided, the collection will be created but embedding generation will be deferred until buckets are assigned to the collection.

Parameters:
  • name (str) –

    The name of the collection to be created. This should be unique.

  • pipeline (str) –

    The name of the pipeline to be associated with the collection.

  • buckets (Optional[List[str]], default: None ) –

    A list of bucket names. Defaults to None.

  • output_store (Optional[str], default: None ) –

    Output bucket for transcription results. Defaults to None.

  • indexing_mode (Optional[str], default: None ) –

    Indexing mode for RAG collections (supported values: 'HNSW', 'GPU_CAGRA'). Auto-detected if omitted. Defaults to None.

Returns:
Example usage
# Example usage of create_collection
client = DIAdminClient(uri="https://example.com", username="admin", password="password")
collection = client.create_collection(
    name="example_collection",
    pipeline="data_ingestion_pipeline",
    buckets=["bucket1", "bucket2"],
    output_store="output-bucket"
)
print(collection)
# Sample Output:
# V1CollectionResponse(
#     name="example_collection",
#     pipeline="data_ingestion_pipeline",
#     buckets=["bucket1", "bucket2"],
#     outputStore="output-bucket"
# )
Source code in pydi_client/di_client.py
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
def create_collection(
    self,
    *,
    name: str,
    pipeline: str,
    buckets: Optional[List[str]] = None,
    output_store: Optional[str] = None,
    indexing_mode: Optional[str] = None,
) -> V1CollectionResponse:
    """
    Creates a new collection using the specified pipeline.
    If buckets are provided, they will be associated with the collection and inline embedding generation will be triggered.
    If buckets are not provided, the collection will be created but embedding generation will be deferred until buckets are assigned to the collection.

    Args:
        name (str): The name of the collection to be created. This should be unique.
        pipeline (str): The name of the pipeline to be associated with the collection.
        buckets (Optional[List[str]], optional): A list of bucket names. Defaults to None.
        output_store (Optional[str], optional): Output bucket for transcription results. Defaults to None.
        indexing_mode (Optional[str], optional): Indexing mode for RAG collections (supported values: 'HNSW', 'GPU_CAGRA'). Auto-detected if omitted. Defaults to None.

    Returns:
        V1CollectionResponse: The created collection object.

    Example usage:
        ```python
        # Example usage of create_collection
        client = DIAdminClient(uri="https://example.com", username="admin", password="password")
        collection = client.create_collection(
            name="example_collection",
            pipeline="data_ingestion_pipeline",
            buckets=["bucket1", "bucket2"],
            output_store="output-bucket"
        )
        print(collection)
        # Sample Output:
        # V1CollectionResponse(
        #     name="example_collection",
        #     pipeline="data_ingestion_pipeline",
        #     buckets=["bucket1", "bucket2"],
        #     outputStore="output-bucket"
        # )
        ```
    """
    if buckets is None:
        buckets = []

    return CollectionAPI(session=self.authenticated_session).create_collection(
        name=name,
        buckets=buckets,
        pipeline=pipeline,
        output_store=output_store,
        indexing_mode=indexing_mode,
    )

delete_collection(*, name)

Deletes a collection by its name.

Parameters:
  • name (str) –

    The name of the collection to be deleted.

Returns:
  • V1DeleteCollectionResponse( V1DeleteCollectionResponse ) –

    The response object containing details about the deleted collection.

Example Usage
client = DIAdminClient(uri="https://example.com", username="admin", password="password")
resp = client.delete_collection(name="example_collection")
print(resp)
# Output:
# V1DeleteCollectionResponse(
#     success=True,
#     message="Collection 'example_collection' has been deleted."
# )
Source code in pydi_client/di_client.py
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
def delete_collection(self, *, name: str) -> V1DeleteCollectionResponse:
    """
    Deletes a collection by its name.

    Args:
        name (str): The name of the collection to be deleted.

    Returns:
        V1DeleteCollectionResponse: The response object containing details about the deleted collection.

    Example Usage:
        ```python
        client = DIAdminClient(uri="https://example.com", username="admin", password="password")
        resp = client.delete_collection(name="example_collection")
        print(resp)
        # Output:
        # V1DeleteCollectionResponse(
        #     success=True,
        #     message="Collection 'example_collection' has been deleted."
        # )
        ```
    """
    return CollectionAPI(session=self.authenticated_session).delete_collection(
        name=name
    )

assign_buckets_to_collection(*, collection_name, buckets)

Assigns a list of buckets to a specified collection. This enables inline embedding generation for the specified buckets.

Parameters:
  • collection_name (str) –

    The name of the collection to which the buckets will be assigned.

  • buckets (List[str]) –

    A list of bucket names to be assigned to the specified collection.

Returns:
Example Usage
# Initialize the DIAdminClient
client = DIAdminClient(uri="http://example.com", username="admin", password="password")
# Define the collection name and buckets
collection_name = "my_collection"
buckets = ["bucket1", "bucket2", "bucket3"]
# Assign buckets to the collection
response = client.assign_buckets_to_collection(
    collection_name=collection_name,
    buckets=buckets
)
print(response)
# Output:
# BucketUpdateResponse(
#     success=True,
#     message="Buckets assigned successfully to collection 'my_collection'."
# )

Notes: - This method is typically used for enabling the user buckets for intelligence using an existing collection.

Source code in pydi_client/di_client.py
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
def assign_buckets_to_collection(
    self, *, collection_name: str, buckets: List[str]
) -> BucketUpdateResponse:
    """
    Assigns a list of buckets to a specified collection.
    This enables inline embedding generation for the specified buckets.

    Args:
        collection_name (str): The name of the collection to which the buckets
            will be assigned.
        buckets (List[str]): A list of bucket names to be assigned to the
            specified collection.

    Returns:
        BucketUpdateResponse: The response object containing details about the
        updated collection and assigned buckets.

    Example Usage:
        ```python
        # Initialize the DIAdminClient
        client = DIAdminClient(uri="http://example.com", username="admin", password="password")
        # Define the collection name and buckets
        collection_name = "my_collection"
        buckets = ["bucket1", "bucket2", "bucket3"]
        # Assign buckets to the collection
        response = client.assign_buckets_to_collection(
            collection_name=collection_name,
            buckets=buckets
        )
        print(response)
        # Output:
        # BucketUpdateResponse(
        #     success=True,
        #     message="Buckets assigned successfully to collection 'my_collection'."
        # )
        ```
    Notes:
        - This method is typically used for enabling the user buckets for intelligence using an existing collection.
    """

    return CollectionAPI(
        session=self.authenticated_session
    ).assign_buckets_to_collection(collection_name=collection_name, buckets=buckets)

unassign_buckets_from_collection(*, collection_name, buckets)

Unassigns one or more buckets from a specified collection.

Parameters:
  • collection_name (str) –

    The name of the collection from which the buckets will be unassigned.

  • buckets (List[str]) –

    A list of bucket names to be unassigned.

Returns:
Example usage
# Example usage of unassign_buckets_from_collection
client = DIAdminClient(uri="http://example.com", username="admin", password="password")

# Unassign multiple buckets
response = client.unassign_buckets_from_collection(
    collection_name="example_collection",
    buckets=["bucket_1", "bucket_2", "bucket_3"]
)
print(response)
# Output:
# BucketUpdateResponse(
#     success=True,
#     message="Buckets unassigned successfully from collection 'example_collection'."
# )
Source code in pydi_client/di_client.py
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
def unassign_buckets_from_collection(
    self, *, collection_name: str, buckets: List[str]
) -> BucketUpdateResponse:
    """
    Unassigns one or more buckets from a specified collection.

    Args:
        collection_name (str): The name of the collection from which the buckets will be unassigned.
        buckets (List[str]): A list of bucket names to be unassigned.

    Returns:
        BucketUpdateResponse: The response object containing details about the updated collection
        after the buckets have been unassigned.

    Example usage:
        ```python
        # Example usage of unassign_buckets_from_collection
        client = DIAdminClient(uri="http://example.com", username="admin", password="password")

        # Unassign multiple buckets
        response = client.unassign_buckets_from_collection(
            collection_name="example_collection",
            buckets=["bucket_1", "bucket_2", "bucket_3"]
        )
        print(response)
        # Output:
        # BucketUpdateResponse(
        #     success=True,
        #     message="Buckets unassigned successfully from collection 'example_collection'."
        # )
        ```
    """
    return CollectionAPI(
        session=self.authenticated_session
    ).unassign_buckets_from_collection(
        collection_name=collection_name, buckets=buckets
    )

create_pipeline(*, name, pipeline_type, event_filter_object_suffix, schema, event_filter_max_object_size=None, model=None, custom_func=None, prompt=None, chunk_size=None, chunk_overlap=None)

Creates a new pipeline with the specified configuration.

Parameters:
  • name (str) –

    The name of the pipeline to be created.

  • pipeline_type (str) –

    The type of the pipeline ("rag", "metadata", "transcribe-metadata" or "custom-function").

  • event_filter_object_suffix (List[str]) –

    A list of file suffixes to filter events. Ex - [".txt", ".pdf"]

  • schema (str) –

    The schema definition for the pipeline.

  • event_filter_max_object_size Optional (int) –

    The maximum object size for event filtering. Ex - 10485760

  • model Optional (str) –

    The model associated with the pipeline. Required for "rag" and "custom-function" pipelines.

  • custom_func Optional (str) –

    The custom function to be used in the pipeline. Required for "metadata" pipelines.

  • prompt Optional (str) –

    The prompt for transcribe pipelines (e.g., "Transcribe the image content into text.").

  • chunk_size Optional (int) –

    Chunk size for RAG pipelines.

  • chunk_overlap Optional (int) –

    Chunk overlap for RAG pipelines.

Returns:
  • V1CreatePipelineResponse( V1CreatePipelineResponse ) –

    The response object containing details of the created pipeline.

Raises:
  • PipelineValidationError

    If the arguments are invalid or incomplete, or if the server rejects the request with an HTTP 422 validation error.

Example usage
client = DIAdminClient(
    uri="http://example.com",
    username="admin",
    password="password"
)
pipeline_data = client.create_pipeline(
    name="example_pipeline",
    pipeline_type="rag",
    model="example_model",
    event_filter_object_suffix=["*.txt", "*.pdf"],
    event_filter_max_object_size=10485760,
    schema="example_schema"
)
print(pipeline_data)
# Output: V1CreatePipelineResponse(
#     success=true,
#     message="Pipeline 'example_pipeline' created successfully."
# )
Source code in pydi_client/di_client.py
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
@normalize_pipeline_argument_errors
def create_pipeline(
    self,
    *,
    name: str,
    pipeline_type: str,
    event_filter_object_suffix: List[str],
    schema: str,
    event_filter_max_object_size: Optional[int] = None,
    model: Optional[str] = None,
    custom_func: Optional[str] = None,
    prompt: Optional[str] = None,
    chunk_size: Optional[int] = None,
    chunk_overlap: Optional[int] = None,
) -> V1CreatePipelineResponse:
    """
    Creates a new pipeline with the specified configuration.

    Args:
        name (str): The name of the pipeline to be created.
        pipeline_type (str): The type of the pipeline ("rag", "metadata", "transcribe-metadata" or "custom-function").
        event_filter_object_suffix (List[str]): A list of file suffixes to filter events. Ex - ["*.txt", "*.pdf"]
        schema (str): The schema definition for the pipeline.
        event_filter_max_object_size Optional (int): The maximum object size for event filtering. Ex - 10485760
        model Optional (str): The model associated with the pipeline. Required for "rag" and "custom-function" pipelines.
        custom_func Optional (str): The custom function to be used in the pipeline. Required for "metadata" pipelines.
        prompt Optional (str): The prompt for transcribe pipelines (e.g., "Transcribe the image content into text.").
        chunk_size Optional (int): Chunk size for RAG pipelines.
        chunk_overlap Optional (int): Chunk overlap for RAG pipelines.

    Returns:
        V1CreatePipelineResponse: The response object containing details of the created pipeline.

    Raises:
        PipelineValidationError: If the arguments are invalid or incomplete, or if the server rejects
            the request with an HTTP 422 validation error.

    Example usage:
        ```python
        client = DIAdminClient(
            uri="http://example.com",
            username="admin",
            password="password"
        )
        pipeline_data = client.create_pipeline(
            name="example_pipeline",
            pipeline_type="rag",
            model="example_model",
            event_filter_object_suffix=["*.txt", "*.pdf"],
            event_filter_max_object_size=10485760,
            schema="example_schema"
        )
        print(pipeline_data)
        # Output: V1CreatePipelineResponse(
        #     success=true,
        #     message="Pipeline 'example_pipeline' created successfully."
        # )
        ```
    """

    return PipelineAPI(session=self.authenticated_session).create_pipeline(
        name=name,
        pipeline_type=pipeline_type,
        model=model,
        custom_func=custom_func,
        event_filter_object_suffix=event_filter_object_suffix,
        event_filter_max_object_size=event_filter_max_object_size,
        schema=schema,
        prompt=prompt,
        chunk_size=chunk_size,
        chunk_overlap=chunk_overlap,
    )

delete_pipeline(*, name)

Deletes a pipeline with the specified name.

Parameters:
  • name (str) –

    The name of the pipeline to be deleted.

Returns:
  • V1DeletePipelineResponse( V1DeletePipelineResponse ) –

    The response object containing details about the deleted pipeline.

Example usage
# Initialize the DIAdminClient
client = DIAdminClient(uri="http://example.com", username="admin", password="password")

# Delete a pipeline by name
response = client.delete_pipeline(name="example_pipeline")
print(response)
# Output:
# V1DeletePipelineResponse(
#     message="Pipeline successfully deleted",
#     success=True,
# )
Source code in pydi_client/di_client.py
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
def delete_pipeline(self, *, name: str) -> V1DeletePipelineResponse:
    """
    Deletes a pipeline with the specified name.

    Args:
        name (str): The name of the pipeline to be deleted.

    Returns:
        V1DeletePipelineResponse: The response object containing details about the deleted pipeline.

    Example usage:
        ```python
        # Initialize the DIAdminClient
        client = DIAdminClient(uri="http://example.com", username="admin", password="password")

        # Delete a pipeline by name
        response = client.delete_pipeline(name="example_pipeline")
        print(response)
        # Output:
        # V1DeletePipelineResponse(
        #     message="Pipeline successfully deleted",
        #     success=True,
        # )
        ```
    """
    return PipelineAPI(session=self.authenticated_session).delete_pipeline(
        name=name
    )

get_schema(*, name)

Retrieve a schema by its name. This method fetches a schema object from the SchemaAPI using the provided name.

Parameters:
  • name (str) –

    The name of the schema to retrieve. This is a required keyword-only argument.

Returns:
  • V1SchemasResponse( V1SchemasResponse ) –

    The response object containing details about the schema.

Example usage
client = DIAdminClient(uri="https://example.com", username="admin", password="password")
schema = client.get_schema(name="example_schema")
print(schema)
# Output: V1SchemasResponse(
#     name="example_schema",
#     type="...",
#     schema_fields=[SchemaItem(name="id", type="varchar", nullable=False)]
# )
Note

The schema fields are exposed as the schema_fields attribute because schema collides with a reserved Pydantic attribute. They are serialized and deserialized as schema.

Source code in pydi_client/di_client.py
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
def get_schema(self, *, name: str) -> V1SchemasResponse:
    """
    Retrieve a schema by its name.
    This method fetches a schema object from the SchemaAPI using the provided name.

    Args:
        name (str): The name of the schema to retrieve. This is a required keyword-only argument.

    Returns:
        V1SchemasResponse: The response object containing details about the schema.

    Example usage:
        ```python
        client = DIAdminClient(uri="https://example.com", username="admin", password="password")
        schema = client.get_schema(name="example_schema")
        print(schema)
        # Output: V1SchemasResponse(
        #     name="example_schema",
        #     type="...",
        #     schema_fields=[SchemaItem(name="id", type="varchar", nullable=False)]
        # )
        ```

    Note:
        The schema fields are exposed as the ``schema_fields`` attribute because ``schema`` collides
        with a reserved Pydantic attribute. They are serialized and deserialized as ``schema``.
    """
    return SchemaAPI(session=self.authenticated_session).get_schema(name=name)

get_all_schemas()

Retrieves all schemas available in the system.

Returns:
Example usage
client = DIAdminClient(uri="https://example.com", username="admin", password="password")
schemas = client.get_all_schemas()
print(schemas)
# Output: V1ListSchemasResponse(
#     schemas=[SchemaListItem(id="1", name="example_schema")]
# )
Source code in pydi_client/di_client.py
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
def get_all_schemas(self) -> V1ListSchemasResponse:
    """
    Retrieves all schemas available in the system.

    Returns:
        V1ListSchemasResponse: A response object containing a list of
        schemas available in the system.

    Example usage:
        ```python
        client = DIAdminClient(uri="https://example.com", username="admin", password="password")
        schemas = client.get_all_schemas()
        print(schemas)
        # Output: V1ListSchemasResponse(
        #     schemas=[SchemaListItem(id="1", name="example_schema")]
        # )
        ```
    """
    return SchemaAPI(session=self.authenticated_session).get_schemas()

get_embedding_model(*, name)

Retrieve an embedding model by its name. This method fetches an embedding model object from the ModelAPI using the provided name.

.. Deprecated:: This method is deprecated and will be removed in future versions. Please use get_model instead.

Parameters:
  • name (str) –

    The name of the embedding model to retrieve. This is a required keyword-only argument.

Returns:
  • V1ModelsResponse( V1ModelsResponse ) –

    The response object containing details about the embedding model.

Example usage
client = DIAdminClient(uri="https://example.com", username="admin", password="password")
model = client.get_embedding_model(name="example_model")
print(model)
# Output: V1ModelsResponse(
#     name="example_model",
#     modelName="...",
#     capabilities=["Sentence-Similarity"],
#     version="...",
#     dimension=...,  # e.g., 768
#     maximumTokens=...,  # e.g., 512
# )
Source code in pydi_client/di_client.py
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
@deprecated(
    message="This method is deprecated and will be removed in future versions. Please use get_model() instead."
)
def get_embedding_model(self, *, name: str) -> V1ModelsResponse:
    """
    Retrieve an embedding model by its name.
    This method fetches an embedding model object from the ModelAPI using the provided name.

    .. Deprecated::
      This method is deprecated and will be removed in future versions. Please use `get_model` instead.

    Args:
        name (str): The name of the embedding model to retrieve. This is a required keyword-only argument.

    Returns:
        V1ModelsResponse: The response object containing details about the embedding model.

    Example usage:
        ```python
        client = DIAdminClient(uri="https://example.com", username="admin", password="password")
        model = client.get_embedding_model(name="example_model")
        print(model)
        # Output: V1ModelsResponse(
        #     name="example_model",
        #     modelName="...",
        #     capabilities=["Sentence-Similarity"],
        #     version="...",
        #     dimension=...,  # e.g., 768
        #     maximumTokens=...,  # e.g., 512
        # )
        ```
    """
    return ModelAPI(self.authenticated_session).get_model(name=name)

get_all_embedding_models()

Retrieves all embedding models available in the system.

.. Deprecated:: This method is deprecated and will be removed in future versions. Please use get_all_models instead.

Returns:
Example usage
client = DIAdminClient(uri="https://example.com", username="admin", password="password")
models = client.get_all_embedding_models()
print(models)
# Output: V1ListModelsResponse(
#     models=[ModelRecordSummary(id="1", name="example_embedding_model")]
# )
Source code in pydi_client/di_client.py
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
@deprecated(
    message="This method is deprecated and will be removed in future versions. Please use get_all_models() instead."
)
def get_all_embedding_models(self) -> V1ListModelsResponse:
    """
    Retrieves all embedding models available in the system.

    .. Deprecated::
        This method is deprecated and will be removed in future versions. Please use `get_all_models` instead.

    Returns:
        V1ListModelsResponse: A response object containing a list of
        embedding models available in the system.

    Example usage:
        ```python
        client = DIAdminClient(uri="https://example.com", username="admin", password="password")
        models = client.get_all_embedding_models()
        print(models)
        # Output: V1ListModelsResponse(
        #     models=[ModelRecordSummary(id="1", name="example_embedding_model")]
        # )
        ```
    """
    try:
        model_api = ModelAPI(self.authenticated_session)
        models = model_api.get_models()
        embedding_models_list = list()
        for model in models.models:
            model_details = model_api.get_model(name=model.name)
            if any(
                capability.lower() == ModelTags.SENTENCE_SIMILARITY.value.lower()
                for capability in model_details.capabilities
            ):
                embedding_models_list.append(model)
    except (UnexpectedResponse, UnexpectedStatus) as e:
        raise e

    return V1ListModelsResponse(models=embedding_models_list)

create_schema(*, name, schema_type, schema)

Create a new schema.

Parameters:
  • name (str) –

    The name of the schema to create.

  • schema_type (str) –

    The schema type (e.g., 'custom-function').

  • schema (List[SchemaItem]) –

    List of schema fields. Each field has a name and type, and may optionally include a nullable flag (defaults to True). Set nullable to False to mark a field as required: the underlying database column is created as NOT NULL and schema validation is strict for that field, while fields left as nullable=True are validated non-strictly.

Returns:
Example usage
schema_response = client.create_schema(
    name="yolo-detection-schema",
    schema_type="custom-function",
    schema=[{"name": "id", "type": "varchar", "nullable": False},
            {"name": "content", "type": "varchar"},
            {"name": "embedding", "type": "array(real)", "nullable": True},
        ]
)
# "id" is required (NOT NULL, strict validation); "content" and
# "embedding" allow nulls (nullable defaults to True when omitted).
Source code in pydi_client/di_client.py
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
def create_schema(
    self,
    *,
    name: str,
    schema_type: str,
    schema: List[SchemaItem],
) -> V1CreateSchemaResponse:
    """
    Create a new schema.

    Args:
        name (str): The name of the schema to create.
        schema_type (str): The schema type (e.g., 'custom-function').
        schema (List[SchemaItem]): List of schema fields. Each field has a
            ``name`` and ``type``, and may optionally include a ``nullable``
            flag (defaults to ``True``). Set ``nullable`` to ``False`` to
            mark a field as required: the underlying database column is created
            as ``NOT NULL`` and schema validation is strict for that field,
            while fields left as ``nullable=True`` are validated non-strictly.

    Returns:
        V1CreateSchemaResponse: Response indicating success or failure.

    Example usage:
        ```python
        schema_response = client.create_schema(
            name="yolo-detection-schema",
            schema_type="custom-function",
            schema=[{"name": "id", "type": "varchar", "nullable": False},
                    {"name": "content", "type": "varchar"},
                    {"name": "embedding", "type": "array(real)", "nullable": True},
                ]
        )
        # "id" is required (NOT NULL, strict validation); "content" and
        # "embedding" allow nulls (nullable defaults to True when omitted).
        ```
    """
    return SchemaAPI(session=self.authenticated_session).create_schema(
        name=name,
        schema_type=schema_type,
        schema=schema,
    )

delete_schema(*, name)

Deletes a schema with the specified name.

Parameters:
  • name (str) –

    The name of the schema to be deleted.

Returns:
  • V1DeleteSchemaResponse( V1DeleteSchemaResponse ) –

    The response object containing details about the deleted schema.

Example usage
# Initialize the DIAdminClient
client = DIAdminClient(uri="http://example.com", username="admin", password="password")

# Delete a schema by name
response = client.delete_schema(name="example_schema")
print(response)
# Output:
# V1DeleteSchemaResponse(
#     message="Schema successfully deleted"
#     success=True,
# )
Source code in pydi_client/di_client.py
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
def delete_schema(self, *, name: str) -> V1DeleteSchemaResponse:
    """
    Deletes a schema with the specified name.

    Args:
        name (str): The name of the schema to be deleted.

    Returns:
        V1DeleteSchemaResponse: The response object containing details about the deleted schema.

    Example usage:
        ```python
        # Initialize the DIAdminClient
        client = DIAdminClient(uri="http://example.com", username="admin", password="password")

        # Delete a schema by name
        response = client.delete_schema(name="example_schema")
        print(response)
        # Output:
        # V1DeleteSchemaResponse(
        #     message="Schema successfully deleted"
        #     success=True,
        # )
        ```
    """
    return SchemaAPI(session=self.authenticated_session).delete_schema(name=name)

Errors

PipelineValidationError

Bases: ValueError

Exception raised when pipeline creation input is invalid.

Source code in pydi_client/errors.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class PipelineValidationError(ValueError):
    """Exception raised when pipeline creation input is invalid."""

    def __init__(
        self,
        *,
        errors: List[Dict[str, Any]],
        source: Literal["client", "server"],
        status_code: Optional[int] = None,
        raw_response: Optional[bytes] = None,
    ):
        self.errors = errors
        self.source = source
        self.status_code = status_code
        self.raw_response = raw_response

        super().__init__(self._message())

    def _message(self) -> str:
        details = []
        for error in self.errors:
            rendered_error = self._format_error(error)
            if rendered_error:
                details.append(rendered_error)

        prefix = f"Pipeline validation failed ({self.source})"
        return (
            f"{prefix}: {'; '.join(details)}"
            if details
            else f"{prefix}: no error details"
        )

    @staticmethod
    def _format_error(error: Dict[str, Any]) -> str:
        message = error.get("msg")
        if not isinstance(message, str):
            return ""

        location = error.get("loc")
        if isinstance(location, (list, tuple)) and location:
            return f"{'.'.join(str(part) for part in location)}: {message}"

        status = error.get("status")
        if isinstance(status, str) and status:
            return f"{status}: {message}"

        return message

NotImplementedException

Bases: Exception

Exception raised for methods that are not implemented.

Source code in pydi_client/errors.py
 96
 97
 98
 99
100
class NotImplementedException(Exception):
    """Exception raised for methods that are not implemented."""

    def __init__(self, message="This method is not implemented."):
        super().__init__(message)

HTTPUnauthorizedException

Bases: Exception

Exception raised for HTTP 401 Unauthorized errors.

Source code in pydi_client/errors.py
103
104
105
106
107
108
109
110
class HTTPUnauthorizedException(Exception):
    """Exception raised for HTTP 401 Unauthorized errors."""

    def __init__(
        self,
        message="HTTP 401 Unauthorized: Access is denied due to invalid credentials.",
    ):
        super().__init__(message)

SimilaritySearchFailureException

Bases: Exception

Exception raised when a similarity search operation fails.

Source code in pydi_client/errors.py
113
114
115
116
117
class SimilaritySearchFailureException(Exception):
    """Exception raised when a similarity search operation fails."""

    def __init__(self, message="Similarity search operation failed."):
        super().__init__(message)

UnexpectedStatus

Bases: Exception

Raised by api functions when the response status an unexpected status

Source code in pydi_client/errors.py
120
121
122
123
124
125
126
127
128
129
class UnexpectedStatus(Exception):
    """Raised by api functions when the response status an unexpected status"""

    def __init__(self, status_code: int, content: bytes):
        self.status_code = status_code
        self.content = content

        super().__init__(
            f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
        )

UnexpectedResponse

Bases: Exception

Exception raised when an API response is not as expected.

Source code in pydi_client/errors.py
132
133
134
135
136
137
138
139
140
141
class UnexpectedResponse(Exception):
    """Exception raised when an API response is not as expected."""

    def __init__(self, status_code: int, response: bytes):
        self.status_code = status_code
        self.response = response

        super().__init__(
            f"Unexpected response: {status_code}\n\nResponse content:\n{response.decode(errors='ignore')}"
        )

normalize_pipeline_argument_errors(function)

Convert pipeline method argument-binding failures to validation errors.

Source code in pydi_client/errors.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def normalize_pipeline_argument_errors(
    function: Callable[P, T],
) -> Callable[P, T]:
    """Convert pipeline method argument-binding failures to validation errors."""
    function_signature = signature(function)

    @wraps(function)
    def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
        try:
            function_signature.bind(*args, **kwargs)
        except TypeError as error:
            try:
                bound_arguments = function_signature.bind_partial(*args, **kwargs)
                missing_arguments = [
                    parameter.name
                    for parameter in function_signature.parameters.values()
                    if parameter.name != "self"
                    and parameter.default is Parameter.empty
                    and parameter.name not in bound_arguments.arguments
                ]
            except TypeError:
                missing_arguments = []

            errors = [
                {"type": "missing", "loc": [name], "msg": "Field required"}
                for name in missing_arguments
            ] or [{"type": "argument_binding_error", "loc": [], "msg": str(error)}]

            raise PipelineValidationError(errors=errors, source="client") from error

        return function(*args, **kwargs)

    return wrapper