diff --git a/Makefile b/Makefile index 231787b..ecfd850 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ -.PHONY: install docs lint license-check test test-integration test-pkg test-pkg-integration +.PHONY: install generate docs lint license-check test test-integration test-pkg test-pkg-integration install: uv sync --all-packages --all-extras +GENERATE_PACKAGES := $(dir $(shell grep -rl "^generate:" packages/*/Makefile 2>/dev/null)) + +generate: + $(foreach pkg,$(GENERATE_PACKAGES),$(MAKE) -C $(pkg) generate;) + docs: uv run sphinx-apidoc -e -M -f -T \ -o docs/sphinx/_autogen/base \ diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000..8dd0d74 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.25.0" + } +} diff --git a/packages/gen/Makefile b/packages/gen/Makefile new file mode 100644 index 0000000..9092db8 --- /dev/null +++ b/packages/gen/Makefile @@ -0,0 +1,12 @@ +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SPECS := $(wildcard $(PKG_DIR)specs/*) + +.PHONY: generate + +generate: + $(foreach spec,$(SPECS), \ + uv run --package sap-openapi-generator sap-generate \ + -i $(spec) \ + -o $(PKG_DIR) \ + -s $(spec)/options-per-service.json; \ + ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py new file mode 100644 index 0000000..63d2cca --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/__init__.py @@ -0,0 +1,418 @@ +from gen_ai_hub.document_grounding_generation.client import GroundingApiClient +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi +from gen_ai_hub.document_grounding_generation.generated.models import ( # noqa: F401 + ApiError, + BaseDocument, + BasePipelineMinimalResponse, + BasePipelineResponse, + BatchUpdateDocumentSuccess, + BatchUpdateDocumentsResponseInner, + BinaryBooleanFilter, + BoostingScoreComputationStrategy, + BoostingScoringConfiguration, + BoostingScoringConfigurationMetadataInner, + Chunk, + Collection, + CollectionCreatedResponse, + CollectionDeletedResponse, + CollectionPendingResponse, + CollectionRequest, + CollectionsListResponse, + ConfigurationDocument, + ConfigurationDocumentFullDetails, + CreatePipeline, + DataRepositories, + DataRepository, + DataRepositoryPerFilterSearchResult, + DataRepositorySearchResult, + DataRepositorySearchResults, + DataRepositoryType, + DataRepositoryWithDocuments, + DenseRetrievalScoringConfiguration, + DetailsErrorResponse, + Document, + DocumentBulkDeleteRequest, + DocumentBulkDeleteResponse, + DocumentCreateRequest, + DocumentInput, + DocumentKeyValueListPair, + DocumentMetadata, + DocumentMetadataBatchRequest, + DocumentMetadataUpdate, + DocumentMetadataUpdateError, + DocumentOutput, + DocumentResponse, + DocumentStatus, + DocumentUpdateRequest, + DocumentWithoutChunks, + Documents, + DocumentsChunk, + DocumentsListResponse, + DocumentsStatusResponse, + DocumentsStatusResponseResourcesInner, + EmbeddingConfig, + ErrorResponse, + Filter, + FilterMatchModeEnum, + FiltersInner, + GenericError, + GetAllPipelines400Response, + GetCollectionCreationStatus200Response, + GetCollectionDeletionStatus200Response, + GetPipeline, + GetPipelineExecutionById, + GetPipelineExecutions, + GetPipelineStatus, + GetPipelines, + GoogleDriveConfig, + GoogleDriveConfigurationMinimal, + GoogleDriveConfigurationStruct, + GoogleDrivePipelineCreateRequest, + GoogleDrivePipelineGetResponse, + GoogleDrivePipelineMinimalResponse, + GoogleDriveResourceDetail, + HTTPValidationError, + KeyValueListPair, + KeyWordRetrievalScoringConfiguration, + Left, + Left1, + ListConfigurationDocuments, + ListConfigurationDocumentsFullDetails, + ListMetadataConfigurations, + LocationInner, + ManualPipelineTrigger, + MergeStrategyReranker, + MergeStrategyRerankerBoostingInner, + MergeStrategyScoreReuse, + MergeStrategyType, + MessageResponse, + MSSharePointConfiguration, + MSSharePointConfigurationGetResponse, + MSSharePointConfigurationMinimal, + MSSharePointPipelineCreateRequest, + MSSharePointPipelineGetResponse, + MSSharePointPipelineMinimalResponse, + MetaData, + MetaDataDataRepositoryMetadataInner, + MetaDataKeyValuePairStrict, + MetadataConfiguration, + MetadataConfigurationMetadata, + MetadataConfigurationRequest, + MetadataConfigurationRequestLabelsInner, + MetadataConfigurationResponse, + MetadataConfigurationStruct, + MetadataItem, + MetadataKeyUpdate, + MetadataOperation, + MetadataOperationEnum, + MetadataResponse, + MetadataUpdateItem, + MetadataUpdates, + PatchPipeline, + PatchPipelineConfiguration, + PatchPipelineMetadata, + PerFilterSearchResult, + PerFilterSearchResultError, + PerFilterSearchResultWithError, + PipelineDocumentResponse, + PipelineExecutionData, + PipelineExecutionStatus, + PipelineId, + PipelineMinimalResponse, + PostProcessingObjectReference, + PostProcessingOperation, + ResultsInner, + ResultsInner1, + ResultsInner2, + RetrievalBinaryBooleanFilter, + RetrievalChunk, + RetrievalDataRepositorySearchResult, + RetrievalDocumentKeyValueListPair, + RetrievalKeyValueListPair, + RetrievalPerFilterSearchResult, + RetrievalPerFilterSearchResultError, + RetrievalPerFilterSearchResultWithError, + RetrievalScopedKeyValueListPair, + RetrievalSearchConfiguration, + RetrievalSearchDocumentKeyValueListPair, + RetrievalSearchFilter, + RetrievalSearchInput, + RetrievalSearchInputPostProcessingInner, + RetrievalSearchInputPostProcessingInnerInputsInner, + RetrievalSearchInputPostProcessingInnerStrategy, + RetrievalSearchResults, + RetrievalSearchSelectOptionEnum, + RetrievalVectorSearchFilter, + RetrievalVectorSearchFilterFilter, + Right, + Right1, + S3Configuration, + S3ConfigurationMinimal, + S3PipelineCreateRequest, + S3PipelineGetResponse, + S3PipelineMinimalResponse, + SDMPipelineCreateRequest, + SDMPipelineGetResponse, + SDMPipelineMinimalResponse, + SFTPConfiguration, + SFTPConfigurationMinimal, + SFTPPipelineCreateRequest, + SFTPPipelineGetResponse, + SFTPPipelineMinimalResponse, + ScopedKeyValueListPair, + Score, + ScoresAggregationStrategy, + SearchConfiguration, + SearchDocumentKeyValueListPair, + SearchFilter, + SearchPipeline, + SearchPipelinesResponse, + SearchResults, + SearchScores, + SearchScoresAggregatedScore, + SearchSelectOptionEnum, + ServiceNowConfig, + ServiceNowConfigurationMinimal, + ServiceNowConfigurationMinimalServiceNow, + ServiceNowConfigurationStruct, + ServiceNowPipelineCreateRequest, + ServiceNowPipelineGetResponse, + ServiceNowPipelineMinimalResponse, + SharePointConfig, + SharePointConfigGetResponse, + SharePointSite, + SharePointSiteDetail, + SharePointSiteGetResponse, + Strategy, + TextOnlyBaseChunk, + TextOnlyBaseChunkCreate, + TextSearchRequest, + ValidationError, + VectorChunk, + VectorDocumentKeyValueListPair, + VectorKeyValueListPair, + VectorPerFilterSearchResult, + VectorScoringConfiguration, + VectorSearchConfiguration, + VectorSearchDocumentKeyValueListPair, + VectorSearchFilter, + VectorSearchResults, + VectorSearchSelectOptionEnum, + WorkZonePipelineCreateRequest, + WorkZonePipelineGetResponse, + WorkZonePipelineMinimalResponse, +) + +__all__ = [ + # Client + "GroundingApiClient", + # API classes + "MetadataConfigurationsApi", + "PipelinesApi", + "RetrievalApi", + "VectorApi", + # Models + "ApiError", + "BaseDocument", + "BasePipelineMinimalResponse", + "BasePipelineResponse", + "BatchUpdateDocumentSuccess", + "BatchUpdateDocumentsResponseInner", + "BinaryBooleanFilter", + "BoostingScoreComputationStrategy", + "BoostingScoringConfiguration", + "BoostingScoringConfigurationMetadataInner", + "Chunk", + "Collection", + "CollectionCreatedResponse", + "CollectionDeletedResponse", + "CollectionPendingResponse", + "CollectionRequest", + "CollectionsListResponse", + "ConfigurationDocument", + "ConfigurationDocumentFullDetails", + "CreatePipeline", + "DataRepositories", + "DataRepository", + "DataRepositoryPerFilterSearchResult", + "DataRepositorySearchResult", + "DataRepositorySearchResults", + "DataRepositoryType", + "DataRepositoryWithDocuments", + "DenseRetrievalScoringConfiguration", + "DetailsErrorResponse", + "Document", + "DocumentBulkDeleteRequest", + "DocumentBulkDeleteResponse", + "DocumentCreateRequest", + "DocumentInput", + "DocumentKeyValueListPair", + "DocumentMetadata", + "DocumentMetadataBatchRequest", + "DocumentMetadataUpdate", + "DocumentMetadataUpdateError", + "DocumentOutput", + "DocumentResponse", + "DocumentStatus", + "DocumentUpdateRequest", + "DocumentWithoutChunks", + "Documents", + "DocumentsChunk", + "DocumentsListResponse", + "DocumentsStatusResponse", + "DocumentsStatusResponseResourcesInner", + "EmbeddingConfig", + "ErrorResponse", + "Filter", + "FilterMatchModeEnum", + "FiltersInner", + "GenericError", + "GetAllPipelines400Response", + "GetCollectionCreationStatus200Response", + "GetCollectionDeletionStatus200Response", + "GetPipeline", + "GetPipelineExecutionById", + "GetPipelineExecutions", + "GetPipelineStatus", + "GetPipelines", + "GoogleDriveConfig", + "GoogleDriveConfigurationMinimal", + "GoogleDriveConfigurationStruct", + "GoogleDrivePipelineCreateRequest", + "GoogleDrivePipelineGetResponse", + "GoogleDrivePipelineMinimalResponse", + "GoogleDriveResourceDetail", + "HTTPValidationError", + "KeyValueListPair", + "KeyWordRetrievalScoringConfiguration", + "Left", + "Left1", + "ListConfigurationDocuments", + "ListConfigurationDocumentsFullDetails", + "ListMetadataConfigurations", + "LocationInner", + "ManualPipelineTrigger", + "MergeStrategyReranker", + "MergeStrategyRerankerBoostingInner", + "MergeStrategyScoreReuse", + "MergeStrategyType", + "MessageResponse", + "MSSharePointConfiguration", + "MSSharePointConfigurationGetResponse", + "MSSharePointConfigurationMinimal", + "MSSharePointPipelineCreateRequest", + "MSSharePointPipelineGetResponse", + "MSSharePointPipelineMinimalResponse", + "MetaData", + "MetaDataDataRepositoryMetadataInner", + "MetaDataKeyValuePairStrict", + "MetadataConfiguration", + "MetadataConfigurationMetadata", + "MetadataConfigurationRequest", + "MetadataConfigurationRequestLabelsInner", + "MetadataConfigurationResponse", + "MetadataConfigurationStruct", + "MetadataItem", + "MetadataKeyUpdate", + "MetadataOperation", + "MetadataOperationEnum", + "MetadataResponse", + "MetadataUpdateItem", + "MetadataUpdates", + "PatchPipeline", + "PatchPipelineConfiguration", + "PatchPipelineMetadata", + "PerFilterSearchResult", + "PerFilterSearchResultError", + "PerFilterSearchResultWithError", + "PipelineDocumentResponse", + "PipelineExecutionData", + "PipelineExecutionStatus", + "PipelineId", + "PipelineMinimalResponse", + "PostProcessingObjectReference", + "PostProcessingOperation", + "ResultsInner", + "ResultsInner1", + "ResultsInner2", + "RetrievalBinaryBooleanFilter", + "RetrievalChunk", + "RetrievalDataRepositorySearchResult", + "RetrievalDocumentKeyValueListPair", + "RetrievalKeyValueListPair", + "RetrievalPerFilterSearchResult", + "RetrievalPerFilterSearchResultError", + "RetrievalPerFilterSearchResultWithError", + "RetrievalScopedKeyValueListPair", + "RetrievalSearchConfiguration", + "RetrievalSearchDocumentKeyValueListPair", + "RetrievalSearchFilter", + "RetrievalSearchInput", + "RetrievalSearchInputPostProcessingInner", + "RetrievalSearchInputPostProcessingInnerInputsInner", + "RetrievalSearchInputPostProcessingInnerStrategy", + "RetrievalSearchResults", + "RetrievalSearchSelectOptionEnum", + "RetrievalVectorSearchFilter", + "RetrievalVectorSearchFilterFilter", + "Right", + "Right1", + "S3Configuration", + "S3ConfigurationMinimal", + "S3PipelineCreateRequest", + "S3PipelineGetResponse", + "S3PipelineMinimalResponse", + "SDMPipelineCreateRequest", + "SDMPipelineGetResponse", + "SDMPipelineMinimalResponse", + "SFTPConfiguration", + "SFTPConfigurationMinimal", + "SFTPPipelineCreateRequest", + "SFTPPipelineGetResponse", + "SFTPPipelineMinimalResponse", + "ScopedKeyValueListPair", + "Score", + "ScoresAggregationStrategy", + "SearchConfiguration", + "SearchDocumentKeyValueListPair", + "SearchFilter", + "SearchPipeline", + "SearchPipelinesResponse", + "SearchResults", + "SearchScores", + "SearchScoresAggregatedScore", + "SearchSelectOptionEnum", + "ServiceNowConfig", + "ServiceNowConfigurationMinimal", + "ServiceNowConfigurationMinimalServiceNow", + "ServiceNowConfigurationStruct", + "ServiceNowPipelineCreateRequest", + "ServiceNowPipelineGetResponse", + "ServiceNowPipelineMinimalResponse", + "SharePointConfig", + "SharePointConfigGetResponse", + "SharePointSite", + "SharePointSiteDetail", + "SharePointSiteGetResponse", + "Strategy", + "TextOnlyBaseChunk", + "TextOnlyBaseChunkCreate", + "TextSearchRequest", + "ValidationError", + "VectorChunk", + "VectorDocumentKeyValueListPair", + "VectorKeyValueListPair", + "VectorPerFilterSearchResult", + "VectorScoringConfiguration", + "VectorSearchConfiguration", + "VectorSearchDocumentKeyValueListPair", + "VectorSearchFilter", + "VectorSearchResults", + "VectorSearchSelectOptionEnum", + "WorkZonePipelineCreateRequest", + "WorkZonePipelineGetResponse", + "WorkZonePipelineMinimalResponse", +] diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/client.py b/packages/gen/gen_ai_hub/document_grounding_generation/client.py new file mode 100644 index 0000000..8a9521a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/client.py @@ -0,0 +1,63 @@ +"""SAP AI Core authentication wiring for the generated document grounding client. + +Subclasses the generated RESTClientObject and ApiClient to inject auth headers +from an AiCoreV2Client or GenAIHubProxyClient via httpx event hooks — the same +pattern used in packages/gen (PR #44 utils.py). + +Usage: + from ai_core_sdk.ai_core_v2_client import AICoreV2Client + from gen_ai_hub.document_grounding_generation import GroundingApiClient, VectorApi + + client = GroundingApiClient(AICoreV2Client.from_env()) + collections = await VectorApi(client).get_all_collections( + header_parameters={"AI-Resource-Group": "default"} + ) +""" + +from __future__ import annotations + +from typing import Any + +import httpx + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration +from gen_ai_hub.document_grounding_generation.generated.rest import RESTClientObject + + +def _make_auth_hook(proxy_client: Any): + """Return an httpx request event hook that injects SAP AI Core auth headers.""" + + async def inject_auth(request: httpx.Request) -> None: + for key, value in proxy_client.request_header.items(): + request.headers[key] = value + + return inject_auth + + +class _SapRESTClientObject(RESTClientObject): + def __init__(self, configuration: Configuration, proxy_client: Any) -> None: + super().__init__(configuration) + self._proxy_client = proxy_client + + def _create_pool_manager(self) -> httpx.AsyncClient: + return httpx.AsyncClient( + event_hooks={"request": [_make_auth_hook(self._proxy_client)]} + ) + + +class GroundingApiClient(ApiClient): + """ApiClient pre-wired with SAP AI Core authentication. + + Args: + proxy_client: An AICoreV2Client or GenAIHubProxyClient instance. + Its request_header property is called per-request to inject + Authorization and AI-* headers. + base_url: Optional override for the service base URL. Defaults to the + basePath baked into Configuration (/lm/document-grounding). + """ + + def __init__(self, proxy_client: Any, base_url: str | None = None) -> None: + config = Configuration(host=base_url) if base_url else Configuration() + super().__init__(configuration=config) + self.rest_client = _SapRESTClientObject(config, proxy_client) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py new file mode 100644 index 0000000..17c372a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/__init__.py @@ -0,0 +1,454 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# Define package exports +__all__ = [ + "MetadataConfigurationsApi", + "PipelinesApi", + "RetrievalApi", + "VectorApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "ApiError", + "BaseDocument", + "BasePipelineMinimalResponse", + "BasePipelineResponse", + "BatchUpdateDocumentSuccess", + "BatchUpdateDocumentsResponseInner", + "BinaryBooleanFilter", + "BoostingScoreComputationStrategy", + "BoostingScoringConfiguration", + "BoostingScoringConfigurationMetadataInner", + "Chunk", + "Collection", + "CollectionCreatedResponse", + "CollectionDeletedResponse", + "CollectionPendingResponse", + "CollectionRequest", + "CollectionsListResponse", + "ConfigurationDocument", + "ConfigurationDocumentFullDetails", + "CreatePipeline", + "DataRepositories", + "DataRepository", + "DataRepositoryPerFilterSearchResult", + "DataRepositorySearchResult", + "DataRepositorySearchResults", + "DataRepositoryType", + "DataRepositoryWithDocuments", + "DenseRetrievalScoringConfiguration", + "DetailsErrorResponse", + "Document", + "DocumentBulkDeleteRequest", + "DocumentBulkDeleteResponse", + "DocumentCreateRequest", + "DocumentInput", + "DocumentKeyValueListPair", + "DocumentMetadata", + "DocumentMetadataBatchRequest", + "DocumentMetadataUpdate", + "DocumentMetadataUpdateError", + "DocumentOutput", + "DocumentResponse", + "DocumentStatus", + "DocumentUpdateRequest", + "DocumentWithoutChunks", + "Documents", + "DocumentsChunk", + "DocumentsListResponse", + "DocumentsStatusResponse", + "DocumentsStatusResponseResourcesInner", + "EmbeddingConfig", + "ErrorResponse", + "Filter", + "FilterMatchModeEnum", + "FiltersInner", + "GenericError", + "GetAllPipelines400Response", + "GetCollectionCreationStatus200Response", + "GetCollectionDeletionStatus200Response", + "GetPipeline", + "GetPipelineExecutionById", + "GetPipelineExecutions", + "GetPipelineStatus", + "GetPipelines", + "GoogleDriveConfig", + "GoogleDriveConfigurationMinimal", + "GoogleDriveConfigurationStruct", + "GoogleDrivePipelineCreateRequest", + "GoogleDrivePipelineGetResponse", + "GoogleDrivePipelineMinimalResponse", + "GoogleDriveResourceDetail", + "HTTPValidationError", + "KeyValueListPair", + "KeyWordRetrievalScoringConfiguration", + "Left", + "Left1", + "ListConfigurationDocuments", + "ListConfigurationDocumentsFullDetails", + "ListMetadataConfigurations", + "LocationInner", + "MSSharePointConfiguration", + "MSSharePointConfigurationGetResponse", + "MSSharePointConfigurationMinimal", + "MSSharePointPipelineCreateRequest", + "MSSharePointPipelineGetResponse", + "MSSharePointPipelineMinimalResponse", + "ManualPipelineTrigger", + "MergeStrategyReranker", + "MergeStrategyRerankerBoostingInner", + "MergeStrategyScoreReuse", + "MergeStrategyType", + "MessageResponse", + "MetaData", + "MetaDataDataRepositoryMetadataInner", + "MetaDataKeyValuePairStrict", + "MetadataConfiguration", + "MetadataConfigurationMetadata", + "MetadataConfigurationRequest", + "MetadataConfigurationRequestLabelsInner", + "MetadataConfigurationResponse", + "MetadataConfigurationStruct", + "MetadataItem", + "MetadataKeyUpdate", + "MetadataOperation", + "MetadataOperationEnum", + "MetadataResponse", + "MetadataUpdateItem", + "MetadataUpdates", + "PatchPipeline", + "PatchPipelineConfiguration", + "PatchPipelineMetadata", + "PerFilterSearchResult", + "PerFilterSearchResultError", + "PerFilterSearchResultWithError", + "PipelineDocumentResponse", + "PipelineExecutionData", + "PipelineExecutionStatus", + "PipelineId", + "PipelineMinimalResponse", + "PostProcessingObjectReference", + "PostProcessingOperation", + "ResultsInner", + "ResultsInner1", + "ResultsInner2", + "RetrievalBinaryBooleanFilter", + "RetrievalChunk", + "RetrievalDataRepositorySearchResult", + "RetrievalDocumentKeyValueListPair", + "RetrievalKeyValueListPair", + "RetrievalPerFilterSearchResult", + "RetrievalPerFilterSearchResultError", + "RetrievalPerFilterSearchResultWithError", + "RetrievalScopedKeyValueListPair", + "RetrievalSearchConfiguration", + "RetrievalSearchDocumentKeyValueListPair", + "RetrievalSearchFilter", + "RetrievalSearchInput", + "RetrievalSearchInputPostProcessingInner", + "RetrievalSearchInputPostProcessingInnerInputsInner", + "RetrievalSearchInputPostProcessingInnerStrategy", + "RetrievalSearchResults", + "RetrievalSearchSelectOptionEnum", + "RetrievalVectorSearchFilter", + "RetrievalVectorSearchFilterFilter", + "Right", + "Right1", + "S3Configuration", + "S3ConfigurationMinimal", + "S3PipelineCreateRequest", + "S3PipelineGetResponse", + "S3PipelineMinimalResponse", + "SDMPipelineCreateRequest", + "SDMPipelineGetResponse", + "SDMPipelineMinimalResponse", + "SFTPConfiguration", + "SFTPConfigurationMinimal", + "SFTPPipelineCreateRequest", + "SFTPPipelineGetResponse", + "SFTPPipelineMinimalResponse", + "ScopedKeyValueListPair", + "Score", + "ScoresAggregationStrategy", + "SearchConfiguration", + "SearchDocumentKeyValueListPair", + "SearchFilter", + "SearchPipeline", + "SearchPipelinesResponse", + "SearchResults", + "SearchScores", + "SearchScoresAggregatedScore", + "SearchSelectOptionEnum", + "ServiceNowConfig", + "ServiceNowConfigurationMinimal", + "ServiceNowConfigurationMinimalServiceNow", + "ServiceNowConfigurationStruct", + "ServiceNowPipelineCreateRequest", + "ServiceNowPipelineGetResponse", + "ServiceNowPipelineMinimalResponse", + "SharePointConfig", + "SharePointConfigGetResponse", + "SharePointSite", + "SharePointSiteDetail", + "SharePointSiteGetResponse", + "Strategy", + "TextOnlyBaseChunk", + "TextOnlyBaseChunkCreate", + "TextSearchRequest", + "ValidationError", + "VectorChunk", + "VectorDocumentKeyValueListPair", + "VectorKeyValueListPair", + "VectorPerFilterSearchResult", + "VectorScoringConfiguration", + "VectorSearchConfiguration", + "VectorSearchDocumentKeyValueListPair", + "VectorSearchFilter", + "VectorSearchResults", + "VectorSearchSelectOptionEnum", + "WorkZonePipelineCreateRequest", + "WorkZonePipelineGetResponse", + "WorkZonePipelineMinimalResponse", +] + +# import apis into sdk package +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi as MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi as PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi as RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi as VectorApi + +# import ApiClient +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse as ApiResponse +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient as ApiClient +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration as Configuration +from gen_ai_hub.document_grounding_generation.generated.exceptions import OpenApiException as OpenApiException +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiTypeError as ApiTypeError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiValueError as ApiValueError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiKeyError as ApiKeyError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiAttributeError as ApiAttributeError +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException as ApiException + +# import models into sdk package +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError as ApiError +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument as BaseDocument +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_minimal_response import BasePipelineMinimalResponse as BasePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_response import BasePipelineResponse as BasePipelineResponse +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_document_success import BatchUpdateDocumentSuccess as BatchUpdateDocumentSuccess +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner as BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter as BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy as BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration as BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner as BoostingScoringConfigurationMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.chunk import Chunk as Chunk +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection as Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse as CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse as CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse as CollectionPendingResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest as CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse as CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument as ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails as ConfigurationDocumentFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline as CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories as DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository as DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult as DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult as DataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_results import DataRepositorySearchResults as DataRepositorySearchResults +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType as DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments as DataRepositoryWithDocuments +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration as DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse as DetailsErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.document import Document as Document +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest as DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse as DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest as DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput as DocumentInput +from gen_ai_hub.document_grounding_generation.generated.models.document_key_value_list_pair import DocumentKeyValueListPair as DocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata as DocumentMetadata +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest as DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate as DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError as DocumentMetadataUpdateError +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput as DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse as DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus as DocumentStatus +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest as DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks as DocumentWithoutChunks +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents as Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk as DocumentsChunk +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse as DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse as DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner as DocumentsStatusResponseResourcesInner +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig as EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.error_response import ErrorResponse as ErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter as Filter +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum as FilterMatchModeEnum +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner as FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.generic_error import GenericError as GenericError +from gen_ai_hub.document_grounding_generation.generated.models.get_all_pipelines400_response import GetAllPipelines400Response as GetAllPipelines400Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response as GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response as GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline as GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById as GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions as GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus as GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines as GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig as GoogleDriveConfig +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal as GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct as GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest as GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse as GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse as GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail as GoogleDriveResourceDetail +from gen_ai_hub.document_grounding_generation.generated.models.http_validation_error import HTTPValidationError as HTTPValidationError +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair as KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration as KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.left import Left as Left +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 as Left1 +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments as ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents_full_details import ListConfigurationDocumentsFullDetails as ListConfigurationDocumentsFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations as ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner as LocationInner +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration as MSSharePointConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse as MSSharePointConfigurationGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal as MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest as MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse as MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse as MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger as ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker as MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner as MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse as MergeStrategyScoreReuse +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType as MergeStrategyType +from gen_ai_hub.document_grounding_generation.generated.models.message_response import MessageResponse as MessageResponse +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData as MetaData +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner as MetaDataDataRepositoryMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict as MetaDataKeyValuePairStrict +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration as MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata as MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest as MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner as MetadataConfigurationRequestLabelsInner +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse as MetadataConfigurationResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct as MetadataConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem as MetadataItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate as MetadataKeyUpdate +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation as MetadataOperation +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum as MetadataOperationEnum +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse as MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem as MetadataUpdateItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates as MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline as PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration as PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata as PatchPipelineMetadata +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult as PerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError as PerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError as PerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse as PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData as PipelineExecutionData +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus as PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId as PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse as PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference as PostProcessingObjectReference +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation as PostProcessingOperation +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner as ResultsInner +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 as ResultsInner1 +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 as ResultsInner2 +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter as RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk as RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult as RetrievalDataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair as RetrievalDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair as RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult as RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError as RetrievalPerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError as RetrievalPerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair as RetrievalScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration as RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair as RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter as RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput as RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner as RetrievalSearchInputPostProcessingInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner as RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy as RetrievalSearchInputPostProcessingInnerStrategy +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults as RetrievalSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum as RetrievalSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter as RetrievalVectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter as RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.right import Right as Right +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 as Right1 +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration as S3Configuration +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal as S3ConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest as S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse as S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse as S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest as SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse as SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse as SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration as SFTPConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal as SFTPConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest as SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse as SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse as SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair as ScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score as Score +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy as ScoresAggregationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration as SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair as SearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_filter import SearchFilter as SearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline as SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse as SearchPipelinesResponse +from gen_ai_hub.document_grounding_generation.generated.models.search_results import SearchResults as SearchResults +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores as SearchScores +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore as SearchScoresAggregatedScore +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum as SearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig as ServiceNowConfig +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal as ServiceNowConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow as ServiceNowConfigurationMinimalServiceNow +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct as ServiceNowConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest as ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse as ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse as ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig as SharePointConfig +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse as SharePointConfigGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite as SharePointSite +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail as SharePointSiteDetail +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse as SharePointSiteGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy as Strategy +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk as TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate as TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest as TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError as ValidationError +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk as VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair as VectorDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair as VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult as VectorPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration as VectorScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration as VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair as VectorSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter as VectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults as VectorSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum as VectorSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest as WorkZonePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse as WorkZonePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse as WorkZonePipelineMinimalResponse + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py new file mode 100644 index 0000000..2f6ec93 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/__init__.py @@ -0,0 +1,8 @@ +# flake8: noqa + +# import apis into api package +from gen_ai_hub.document_grounding_generation.generated.api.metadata_configurations_api import MetadataConfigurationsApi +from gen_ai_hub.document_grounding_generation.generated.api.pipelines_api import PipelinesApi +from gen_ai_hub.document_grounding_generation.generated.api.retrieval_api import RetrievalApi +from gen_ai_hub.document_grounding_generation.generated.api.vector_api import VectorApi + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py new file mode 100644 index 0000000..4eb8aa5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/metadata_configurations_api.py @@ -0,0 +1,2817 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync + + +class MetadataConfigurationsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def batch_update_documents_metadata( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BatchUpdateDocumentsResponseInner]: + """Batch update metadata for multiple documents + + Patch the documents of a configuration in batch + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_metadata_batch_request: (required) + :type document_metadata_batch_request: DocumentMetadataBatchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_documents_metadata_serialize( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BatchUpdateDocumentsResponseInner]", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def batch_update_documents_metadata_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BatchUpdateDocumentsResponseInner]]: + """Batch update metadata for multiple documents + + Patch the documents of a configuration in batch + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_metadata_batch_request: (required) + :type document_metadata_batch_request: DocumentMetadataBatchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_documents_metadata_serialize( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BatchUpdateDocumentsResponseInner]", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def batch_update_documents_metadata_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Batch update metadata for multiple documents + + Patch the documents of a configuration in batch + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_metadata_batch_request: (required) + :type document_metadata_batch_request: DocumentMetadataBatchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._batch_update_documents_metadata_serialize( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BatchUpdateDocumentsResponseInner]", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def batch_update_documents_metadata_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BatchUpdateDocumentsResponseInner]: + """Batch update metadata for multiple documents (synchronous) + + Synchronous variant of :meth:`batch_update_documents_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.batch_update_documents_metadata( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def batch_update_documents_metadata_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BatchUpdateDocumentsResponseInner]]: + """Batch update metadata for multiple documents (synchronous) + + Synchronous variant of :meth:`batch_update_documents_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.batch_update_documents_metadata_with_http_info( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def batch_update_documents_metadata_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_metadata_batch_request: DocumentMetadataBatchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Batch update metadata for multiple documents (synchronous) + + Synchronous variant of :meth:`batch_update_documents_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.batch_update_documents_metadata_without_preload_content( + metadata_config_id=metadata_config_id, + document_metadata_batch_request=document_metadata_batch_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _batch_update_documents_metadata_serialize( + self, + metadata_config_id, + document_metadata_batch_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if document_metadata_batch_request is not None: + _body_params = document_metadata_batch_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/merge-patch+json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_metadata_configuration( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create a metadata configuration + + Creates a new metadata configuration. + + :param metadata_configuration_request: (required) + :type metadata_configuration_request: MetadataConfigurationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metadata_configuration_serialize( + metadata_configuration_request=metadata_configuration_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_metadata_configuration_with_http_info( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create a metadata configuration + + Creates a new metadata configuration. + + :param metadata_configuration_request: (required) + :type metadata_configuration_request: MetadataConfigurationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metadata_configuration_serialize( + metadata_configuration_request=metadata_configuration_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_metadata_configuration_without_preload_content( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a metadata configuration + + Creates a new metadata configuration. + + :param metadata_configuration_request: (required) + :type metadata_configuration_request: MetadataConfigurationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_metadata_configuration_serialize( + metadata_configuration_request=metadata_configuration_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def create_metadata_configuration_sync( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create a metadata configuration (synchronous) + + Synchronous variant of :meth:`create_metadata_configuration`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_metadata_configuration( + metadata_configuration_request=metadata_configuration_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_metadata_configuration_sync_with_http_info( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create a metadata configuration (synchronous) + + Synchronous variant of :meth:`create_metadata_configuration_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_metadata_configuration_with_http_info( + metadata_configuration_request=metadata_configuration_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_metadata_configuration_sync_without_preload_content( + self, + metadata_configuration_request: MetadataConfigurationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a metadata configuration (synchronous) + + Synchronous variant of :meth:`create_metadata_configuration_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_metadata_configuration_without_preload_content( + metadata_configuration_request=metadata_configuration_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _create_metadata_configuration_serialize( + self, + metadata_configuration_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if metadata_configuration_request is not None: + _body_params = metadata_configuration_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/metadata/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_metadata_configuration_by_id( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a configuration by ID + + Delete a metadata configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '404': "ErrorResponse", + '500': "ErrorResponse", + '409': "ErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_metadata_configuration_by_id_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a configuration by ID + + Delete a metadata configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '404': "ErrorResponse", + '500': "ErrorResponse", + '409': "ErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_metadata_configuration_by_id_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a configuration by ID + + Delete a metadata configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '404': "ErrorResponse", + '500': "ErrorResponse", + '409': "ErrorResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def delete_metadata_configuration_by_id_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a configuration by ID (synchronous) + + Synchronous variant of :meth:`delete_metadata_configuration_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_metadata_configuration_by_id( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_metadata_configuration_by_id_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a configuration by ID (synchronous) + + Synchronous variant of :meth:`delete_metadata_configuration_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_metadata_configuration_by_id_with_http_info( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_metadata_configuration_by_id_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a configuration by ID (synchronous) + + Synchronous variant of :meth:`delete_metadata_configuration_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_metadata_configuration_by_id_without_preload_content( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _delete_metadata_configuration_by_id_serialize( + self, + metadata_config_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_metadata_configuration_by_id( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataConfigurationResponse: + """Get a configuration by ID + + Get the details of a configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataConfigurationResponse", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_metadata_configuration_by_id_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataConfigurationResponse]: + """Get a configuration by ID + + Get the details of a configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataConfigurationResponse", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_metadata_configuration_by_id_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a configuration by ID + + Get the details of a configuration by ID + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_configuration_by_id_serialize( + metadata_config_id=metadata_config_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataConfigurationResponse", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_metadata_configuration_by_id_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataConfigurationResponse: + """Get a configuration by ID (synchronous) + + Synchronous variant of :meth:`get_metadata_configuration_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_configuration_by_id( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_configuration_by_id_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataConfigurationResponse]: + """Get a configuration by ID (synchronous) + + Synchronous variant of :meth:`get_metadata_configuration_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_configuration_by_id_with_http_info( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_configuration_by_id_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a configuration by ID (synchronous) + + Synchronous variant of :meth:`get_metadata_configuration_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_configuration_by_id_without_preload_content( + metadata_config_id=metadata_config_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_metadata_configuration_by_id_serialize( + self, + metadata_config_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_metadata_document_details( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ConfigurationDocument: + """Get document details + + Get the details of a document by document id + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_id: Document ID (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_document_details_serialize( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigurationDocument", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_metadata_document_details_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ConfigurationDocument]: + """Get document details + + Get the details of a document by document id + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_id: Document ID (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_document_details_serialize( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigurationDocument", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_metadata_document_details_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document details + + Get the details of a document by document id + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param document_id: Document ID (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_metadata_document_details_serialize( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigurationDocument", + '404': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_metadata_document_details_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ConfigurationDocument: + """Get document details (synchronous) + + Synchronous variant of :meth:`get_metadata_document_details`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_document_details( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_document_details_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ConfigurationDocument]: + """Get document details (synchronous) + + Synchronous variant of :meth:`get_metadata_document_details_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_document_details_with_http_info( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_metadata_document_details_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + document_id: Annotated[StrictStr, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document details (synchronous) + + Synchronous variant of :meth:`get_metadata_document_details_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_metadata_document_details_without_preload_content( + metadata_config_id=metadata_config_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_metadata_document_details_serialize( + self, + metadata_config_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_metadata_configuration_documents( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListConfigurationDocuments: + """List documents of a configuration + + List the documents for a configuration + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param absolute_path: Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + :type absolute_path: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configuration_documents_serialize( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConfigurationDocuments", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_metadata_configuration_documents_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListConfigurationDocuments]: + """List documents of a configuration + + List the documents for a configuration + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param absolute_path: Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + :type absolute_path: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configuration_documents_serialize( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConfigurationDocuments", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_metadata_configuration_documents_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List documents of a configuration + + List the documents for a configuration + + :param metadata_config_id: Metadata Configuration ID (required) + :type metadata_config_id: str + :param absolute_path: Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + :type absolute_path: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configuration_documents_serialize( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListConfigurationDocuments", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def list_metadata_configuration_documents_sync( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListConfigurationDocuments: + """List documents of a configuration (synchronous) + + Synchronous variant of :meth:`list_metadata_configuration_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configuration_documents( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configuration_documents_sync_with_http_info( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListConfigurationDocuments]: + """List documents of a configuration (synchronous) + + Synchronous variant of :meth:`list_metadata_configuration_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configuration_documents_with_http_info( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configuration_documents_sync_without_preload_content( + self, + metadata_config_id: Annotated[StrictStr, Field(description="Metadata Configuration ID")], + absolute_path: Annotated[Optional[StrictStr], Field(description="Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). ")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List documents of a configuration (synchronous) + + Synchronous variant of :meth:`list_metadata_configuration_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configuration_documents_without_preload_content( + metadata_config_id=metadata_config_id, + absolute_path=absolute_path, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _list_metadata_configuration_documents_serialize( + self, + metadata_config_id, + absolute_path, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if metadata_config_id is not None: + _path_params['metadataConfigId'] = metadata_config_id + # process the query parameters + if absolute_path is not None: + + _query_params.append(('absolutePath', absolute_path)) + + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations/{metadataConfigId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_metadata_configurations( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListMetadataConfigurations: + """List metadata configurations + + List all metadata configurations + + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configurations_serialize( + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMetadataConfigurations", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_metadata_configurations_with_http_info( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListMetadataConfigurations]: + """List metadata configurations + + List all metadata configurations + + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configurations_serialize( + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMetadataConfigurations", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_metadata_configurations_without_preload_content( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List metadata configurations + + List all metadata configurations + + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_metadata_configurations_serialize( + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMetadataConfigurations", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def list_metadata_configurations_sync( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListMetadataConfigurations: + """List metadata configurations (synchronous) + + Synchronous variant of :meth:`list_metadata_configurations`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configurations( + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configurations_sync_with_http_info( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListMetadataConfigurations]: + """List metadata configurations (synchronous) + + Synchronous variant of :meth:`list_metadata_configurations_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configurations_with_http_info( + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def list_metadata_configurations_sync_without_preload_content( + self, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List metadata configurations (synchronous) + + Synchronous variant of :meth:`list_metadata_configurations_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.list_metadata_configurations_without_preload_content( + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _list_metadata_configurations_serialize( + self, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/metadata/configurations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py new file mode 100644 index 0000000..3df1aa4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/pipelines_api.py @@ -0,0 +1,5985 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync + + +class PipelinesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def create_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineId: + """Pipeline Creation + + Create a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param create_pipeline: (required) + :type create_pipeline: CreatePipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_pipeline_serialize( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PipelineId", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineId]: + """Pipeline Creation + + Create a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param create_pipeline: (required) + :type create_pipeline: CreatePipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_pipeline_serialize( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PipelineId", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Creation + + Create a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param create_pipeline: (required) + :type create_pipeline: CreatePipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_pipeline_serialize( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PipelineId", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def create_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineId: + """Pipeline Creation (synchronous) + + Synchronous variant of :meth:`create_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_pipeline( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineId]: + """Pipeline Creation (synchronous) + + Synchronous variant of :meth:`create_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + create_pipeline: CreatePipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Creation (synchronous) + + Synchronous variant of :meth:`create_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + create_pipeline=create_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _create_pipeline_serialize( + self, + ai_resource_group, + create_pipeline, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if create_pipeline is not None: + _body_params = create_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_pipeline_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete pipeline + + Delete a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to delete. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_pipeline_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete pipeline + + Delete a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to delete. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_pipeline_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete pipeline + + Delete a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to delete. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def delete_pipeline_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete pipeline (synchronous) + + Synchronous variant of :meth:`delete_pipeline_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_pipeline_by_id( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_pipeline_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete pipeline (synchronous) + + Synchronous variant of :meth:`delete_pipeline_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_pipeline_by_id_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_pipeline_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to delete.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete pipeline (synchronous) + + Synchronous variant of :meth:`delete_pipeline_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_pipeline_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _delete_pipeline_by_id_serialize( + self, + ai_resource_group, + pipeline_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/pipelines/{pipelineId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_all_documents_for_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline + + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_all_documents_for_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline + + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_all_documents_for_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline + + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_all_documents_for_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_all_documents_for_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_for_pipeline( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_for_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_all_documents_for_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_for_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_for_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_all_documents_for_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_for_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_documents_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_all_executions_for_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutions: + """Get Pipeline Executions + + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param last_execution: Filter to get the last execution + :type last_execution: bool + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_executions_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutions", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_all_executions_for_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutions]: + """Get Pipeline Executions + + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param last_execution: Filter to get the last execution + :type last_execution: bool + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_executions_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutions", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_all_executions_for_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Executions + + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param last_execution: Filter to get the last execution + :type last_execution: bool + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_executions_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutions", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_all_executions_for_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutions: + """Get Pipeline Executions (synchronous) + + Synchronous variant of :meth:`get_all_executions_for_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_executions_for_pipeline( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_executions_for_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutions]: + """Get Pipeline Executions (synchronous) + + Synchronous variant of :meth:`get_all_executions_for_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_executions_for_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_executions_for_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + last_execution: Annotated[Optional[StrictBool], Field(description="Filter to get the last execution")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Executions (synchronous) + + Synchronous variant of :meth:`get_all_executions_for_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_executions_for_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + last_execution=last_execution, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_executions_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + last_execution, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + if last_execution is not None: + + _query_params.append(('lastExecution', last_execution)) + + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_all_pipelines( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelines: + """Get Pipelines + + Get all pipelines + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_config_id: Filter pipelines based on metadataConfigId + :type metadata_config_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_pipelines_serialize( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelines", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_all_pipelines_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelines]: + """Get Pipelines + + Get all pipelines + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_config_id: Filter pipelines based on metadataConfigId + :type metadata_config_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_pipelines_serialize( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelines", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_all_pipelines_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipelines + + Get all pipelines + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_config_id: Filter pipelines based on metadataConfigId + :type metadata_config_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_pipelines_serialize( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelines", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_all_pipelines_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelines: + """Get Pipelines (synchronous) + + Synchronous variant of :meth:`get_all_pipelines`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_pipelines( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_pipelines_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelines]: + """Get Pipelines (synchronous) + + Synchronous variant of :meth:`get_all_pipelines_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_pipelines_with_http_info( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_pipelines_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_config_id: Annotated[Optional[StrictStr], Field(description="Filter pipelines based on metadataConfigId")] = None, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipelines (synchronous) + + Synchronous variant of :meth:`get_all_pipelines_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_pipelines_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_config_id=metadata_config_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_pipelines_serialize( + self, + ai_resource_group, + metadata_config_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if metadata_config_id is not None: + + _query_params.append(('metadataConfigId', metadata_config_id)) + + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_document_by_id_for_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline + + Retrieve details of a specific document associated with a pipeline. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_document_by_id_for_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline + + Retrieve details of a specific document associated with a pipeline. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_document_by_id_for_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline + + Retrieve details of a specific document associated with a pipeline. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_document_by_id_for_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_document_by_id_for_pipeline_serialize( + self, + ai_resource_group, + pipeline_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_document_by_id_for_pipeline_execution( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline Execution + + Retrieve details of a specific document associated with a pipeline execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_document_by_id_for_pipeline_execution_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline Execution + + Retrieve details of a specific document associated with a pipeline execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_document_by_id_for_pipeline_execution_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline Execution + + Retrieve details of a specific document associated with a pipeline execution. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param document_id: The ID of the document to get. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PipelineDocumentResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_document_by_id_for_pipeline_execution_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PipelineDocumentResponse: + """Get Document by ID for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_execution`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_execution( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_execution_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PipelineDocumentResponse]: + """Get Document by ID for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_execution_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_execution_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_for_pipeline_execution_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + document_id: Annotated[StrictStr, Field(description="The ID of the document to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Document by ID for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_document_by_id_for_pipeline_execution_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_for_pipeline_execution_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_document_by_id_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if execution_id is not None: + _path_params['executionId'] = execution_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions/{executionId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_documents_for_pipeline_execution( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline Execution + + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_documents_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_documents_for_pipeline_execution_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline Execution + + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_documents_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_documents_for_pipeline_execution_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline Execution + + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_documents_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsStatusResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_documents_for_pipeline_execution_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsStatusResponse: + """Get Documents for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_documents_for_pipeline_execution`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_documents_for_pipeline_execution( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_documents_for_pipeline_execution_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsStatusResponse]: + """Get Documents for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_documents_for_pipeline_execution_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_documents_for_pipeline_execution_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_documents_for_pipeline_execution_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Documents for a Pipeline Execution (synchronous) + + Synchronous variant of :meth:`get_documents_for_pipeline_execution_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_documents_for_pipeline_execution_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_documents_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if execution_id is not None: + _path_params['executionId'] = execution_id + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions/{executionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_execution_details_by_id_for_pipeline_execution( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutionById: + """Get Pipeline Execution by ID + + Retrieve details of a specific pipeline execution by its execution ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_execution_details_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutionById", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_execution_details_by_id_for_pipeline_execution_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutionById]: + """Get Pipeline Execution by ID + + Retrieve details of a specific pipeline execution by its execution ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_execution_details_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutionById", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_execution_details_by_id_for_pipeline_execution_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Execution by ID + + Retrieve details of a specific pipeline execution by its execution ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline (required) + :type pipeline_id: str + :param execution_id: The ID of the execution (required) + :type execution_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_execution_details_by_id_for_pipeline_execution_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineExecutionById", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineExecutionById: + """Get Pipeline Execution by ID (synchronous) + + Synchronous variant of :meth:`get_execution_details_by_id_for_pipeline_execution`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_execution_details_by_id_for_pipeline_execution( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineExecutionById]: + """Get Pipeline Execution by ID (synchronous) + + Synchronous variant of :meth:`get_execution_details_by_id_for_pipeline_execution_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_execution_details_by_id_for_pipeline_execution_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_execution_details_by_id_for_pipeline_execution_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline")], + execution_id: Annotated[StrictStr, Field(description="The ID of the execution")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Pipeline Execution by ID (synchronous) + + Synchronous variant of :meth:`get_execution_details_by_id_for_pipeline_execution_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_execution_details_by_id_for_pipeline_execution_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + execution_id=execution_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_execution_details_by_id_for_pipeline_execution_serialize( + self, + ai_resource_group, + pipeline_id, + execution_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + if execution_id is not None: + _path_params['executionId'] = execution_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/executions/{executionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_pipeline_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipeline: + """Get details of a Pipeline + + Get details of a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipeline", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_pipeline_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipeline]: + """Get details of a Pipeline + + Get details of a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipeline", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_pipeline_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get details of a Pipeline + + Get details of a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipeline", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_pipeline_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipeline: + """Get details of a Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_by_id( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipeline]: + """Get details of a Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_by_id_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get details of a Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_pipeline_by_id_serialize( + self, + ai_resource_group, + pipeline_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_pipeline_status( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineStatus: + """Get status of Pipeline + + Get pipeline status by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get status. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_status_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_pipeline_status_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineStatus]: + """Get status of Pipeline + + Get pipeline status by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get status. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_status_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_pipeline_status_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get status of Pipeline + + Get pipeline status by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to get status. (required) + :type pipeline_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_pipeline_status_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetPipelineStatus", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_pipeline_status_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPipelineStatus: + """Get status of Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_status`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_status( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_status_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPipelineStatus]: + """Get status of Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_status_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_status_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_pipeline_status_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to get status.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get status of Pipeline (synchronous) + + Synchronous variant of :meth:`get_pipeline_status_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_pipeline_status_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_pipeline_status_serialize( + self, + ai_resource_group, + pipeline_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/pipelines/{pipelineId}/status', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def manual_trigger_pipeline( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Pipeline Trigger + + Manually trigger a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param manual_pipeline_trigger: (required) + :type manual_pipeline_trigger: ManualPipelineTrigger + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._manual_trigger_pipeline_serialize( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def manual_trigger_pipeline_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Pipeline Trigger + + Manually trigger a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param manual_pipeline_trigger: (required) + :type manual_pipeline_trigger: ManualPipelineTrigger + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._manual_trigger_pipeline_serialize( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def manual_trigger_pipeline_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Trigger + + Manually trigger a pipeline + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param manual_pipeline_trigger: (required) + :type manual_pipeline_trigger: ManualPipelineTrigger + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._manual_trigger_pipeline_serialize( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def manual_trigger_pipeline_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Pipeline Trigger (synchronous) + + Synchronous variant of :meth:`manual_trigger_pipeline`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.manual_trigger_pipeline( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def manual_trigger_pipeline_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Pipeline Trigger (synchronous) + + Synchronous variant of :meth:`manual_trigger_pipeline_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.manual_trigger_pipeline_with_http_info( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def manual_trigger_pipeline_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + manual_pipeline_trigger: ManualPipelineTrigger, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Trigger (synchronous) + + Synchronous variant of :meth:`manual_trigger_pipeline_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.manual_trigger_pipeline_without_preload_content( + ai_resource_group=ai_resource_group, + manual_pipeline_trigger=manual_pipeline_trigger, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _manual_trigger_pipeline_serialize( + self, + ai_resource_group, + manual_pipeline_trigger, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if manual_pipeline_trigger is not None: + _body_params = manual_pipeline_trigger + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/trigger', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def patch_pipeline_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Patch pipeline + + Patch a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to patch. (required) + :type pipeline_id: str + :param patch_pipeline: (required) + :type patch_pipeline: PatchPipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._patch_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def patch_pipeline_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Patch pipeline + + Patch a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to patch. (required) + :type pipeline_id: str + :param patch_pipeline: (required) + :type patch_pipeline: PatchPipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._patch_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def patch_pipeline_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch pipeline + + Patch a pipeline by pipeline id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param pipeline_id: The ID of the pipeline to patch. (required) + :type pipeline_id: str + :param patch_pipeline: (required) + :type patch_pipeline: PatchPipeline + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._patch_pipeline_by_id_serialize( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def patch_pipeline_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Patch pipeline (synchronous) + + Synchronous variant of :meth:`patch_pipeline_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.patch_pipeline_by_id( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def patch_pipeline_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Patch pipeline (synchronous) + + Synchronous variant of :meth:`patch_pipeline_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.patch_pipeline_by_id_with_http_info( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def patch_pipeline_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + pipeline_id: Annotated[StrictStr, Field(description="The ID of the pipeline to patch.")], + patch_pipeline: PatchPipeline, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch pipeline (synchronous) + + Synchronous variant of :meth:`patch_pipeline_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.patch_pipeline_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + pipeline_id=pipeline_id, + patch_pipeline=patch_pipeline, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _patch_pipeline_by_id_serialize( + self, + ai_resource_group, + pipeline_id, + patch_pipeline, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if pipeline_id is not None: + _path_params['pipelineId'] = pipeline_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if patch_pipeline is not None: + _body_params = patch_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/pipelines/{pipelineId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def search_pipelines_by_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SearchPipelinesResponse: + """Pipeline Search by Metadata + + Search for pipelines based on metadata + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param search_pipeline: (required) + :type search_pipeline: SearchPipeline + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_pipelines_by_metadata_serialize( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SearchPipelinesResponse", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def search_pipelines_by_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SearchPipelinesResponse]: + """Pipeline Search by Metadata + + Search for pipelines based on metadata + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param search_pipeline: (required) + :type search_pipeline: SearchPipeline + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_pipelines_by_metadata_serialize( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SearchPipelinesResponse", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def search_pipelines_by_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Search by Metadata + + Search for pipelines based on metadata + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param search_pipeline: (required) + :type search_pipeline: SearchPipeline + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_pipelines_by_metadata_serialize( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SearchPipelinesResponse", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def search_pipelines_by_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SearchPipelinesResponse: + """Pipeline Search by Metadata (synchronous) + + Synchronous variant of :meth:`search_pipelines_by_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_pipelines_by_metadata( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_pipelines_by_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SearchPipelinesResponse]: + """Pipeline Search by Metadata (synchronous) + + Synchronous variant of :meth:`search_pipelines_by_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_pipelines_by_metadata_with_http_info( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_pipelines_by_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + search_pipeline: SearchPipeline, + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Pipeline Search by Metadata (synchronous) + + Synchronous variant of :meth:`search_pipelines_by_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_pipelines_by_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + search_pipeline=search_pipeline, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _search_pipelines_by_metadata_serialize( + self, + ai_resource_group, + search_pipeline, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if search_pipeline is not None: + _body_params = search_pipeline + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pipelines/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py new file mode 100644 index 0000000..e8ad827 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/retrieval_api.py @@ -0,0 +1,1294 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync + + +class RetrievalApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def get_data_repositories( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepositories: + """List all DataRepository objects. + + List all Data Repositories + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repositories_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepositories", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_data_repositories_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepositories]: + """List all DataRepository objects. + + List all Data Repositories + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repositories_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepositories", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_data_repositories_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all DataRepository objects. + + List all Data Repositories + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repositories_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepositories", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_data_repositories_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepositories: + """List all DataRepository objects. (synchronous) + + Synchronous variant of :meth:`get_data_repositories`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repositories( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repositories_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepositories]: + """List all DataRepository objects. (synchronous) + + Synchronous variant of :meth:`get_data_repositories_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repositories_with_http_info( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repositories_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all DataRepository objects. (synchronous) + + Synchronous variant of :meth:`get_data_repositories_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repositories_without_preload_content( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_data_repositories_serialize( + self, + ai_resource_group, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/retrieval/dataRepositories', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_data_repository_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepository: + """List single DataRepository object. + + List data repository by id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param repository_id: Repository ID (required) + :type repository_id: UUID + :param remote_name: Remote name if DataRepository is from remote DG. + :type remote_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repository_by_id_serialize( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepository", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_data_repository_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepository]: + """List single DataRepository object. + + List data repository by id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param repository_id: Repository ID (required) + :type repository_id: UUID + :param remote_name: Remote name if DataRepository is from remote DG. + :type remote_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repository_by_id_serialize( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepository", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_data_repository_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List single DataRepository object. + + List data repository by id + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param repository_id: Repository ID (required) + :type repository_id: UUID + :param remote_name: Remote name if DataRepository is from remote DG. + :type remote_name: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_data_repository_by_id_serialize( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DataRepository", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_data_repository_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DataRepository: + """List single DataRepository object. (synchronous) + + Synchronous variant of :meth:`get_data_repository_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repository_by_id( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repository_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DataRepository]: + """List single DataRepository object. (synchronous) + + Synchronous variant of :meth:`get_data_repository_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repository_by_id_with_http_info( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_data_repository_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + repository_id: Annotated[UUID, Field(description="Repository ID")], + remote_name: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Remote name if DataRepository is from remote DG.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List single DataRepository object. (synchronous) + + Synchronous variant of :meth:`get_data_repository_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_data_repository_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + repository_id=repository_id, + remote_name=remote_name, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_data_repository_by_id_serialize( + self, + ai_resource_group, + repository_id, + remote_name, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if repository_id is not None: + _path_params['repositoryId'] = repository_id + # process the query parameters + if remote_name is not None: + + _query_params.append(('remoteName', remote_name)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/retrieval/dataRepositories/{repositoryId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def search( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RetrievalSearchResults: + """Retrieve relevant content + + Retrieve relevant content given a query string. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param retrieval_search_input: (required) + :type retrieval_search_input: RetrievalSearchInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetrievalSearchResults", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def search_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RetrievalSearchResults]: + """Retrieve relevant content + + Retrieve relevant content given a query string. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param retrieval_search_input: (required) + :type retrieval_search_input: RetrievalSearchInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetrievalSearchResults", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def search_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve relevant content + + Retrieve relevant content given a query string. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param retrieval_search_input: (required) + :type retrieval_search_input: RetrievalSearchInput + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetrievalSearchResults", + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def search_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RetrievalSearchResults: + """Retrieve relevant content (synchronous) + + Synchronous variant of :meth:`search`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RetrievalSearchResults]: + """Retrieve relevant content (synchronous) + + Synchronous variant of :meth:`search_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_with_http_info( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + retrieval_search_input: RetrievalSearchInput, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve relevant content (synchronous) + + Synchronous variant of :meth:`search_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_without_preload_content( + ai_resource_group=ai_resource_group, + retrieval_search_input=retrieval_search_input, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _search_serialize( + self, + ai_resource_group, + retrieval_search_input, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if retrieval_search_input is not None: + _body_params = retrieval_search_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/retrieval/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py new file mode 100644 index 0000000..87c910d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api/vector_api.py @@ -0,0 +1,6623 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults + +from gen_ai_hub.document_grounding_generation.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse +from gen_ai_hub.document_grounding_generation.generated.rest import RESTResponseType +from gen_ai_hub.document_grounding_generation.generated.sync_helper import run_sync + + +class VectorApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def create_collection( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create collection + + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_request: (required) + :type collection_request: CollectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_collection_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create collection + + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_request: (required) + :type collection_request: CollectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_collection_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create collection + + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_request: (required) + :type collection_request: CollectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_collection_serialize( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def create_collection_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Create collection (synchronous) + + Synchronous variant of :meth:`create_collection`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_collection( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_collection_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Create collection (synchronous) + + Synchronous variant of :meth:`create_collection_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_collection_with_http_info( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_collection_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_request: CollectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create collection (synchronous) + + Synchronous variant of :meth:`create_collection_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_collection_without_preload_content( + ai_resource_group=ai_resource_group, + collection_request=collection_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _create_collection_serialize( + self, + ai_resource_group, + collection_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if collection_request is not None: + _body_params = collection_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vector/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Create documents in collection + + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-gen_ai_hub.document_grounding_generation.generated. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_create_request: (required) + :type document_create_request: DocumentCreateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Create documents in collection + + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-gen_ai_hub.document_grounding_generation.generated. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_create_request: (required) + :type document_create_request: DocumentCreateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create documents in collection + + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-gen_ai_hub.document_grounding_generation.generated. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_create_request: (required) + :type document_create_request: DocumentCreateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def create_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Create documents in collection (synchronous) + + Synchronous variant of :meth:`create_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_documents( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Create documents in collection (synchronous) + + Synchronous variant of :meth:`create_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_documents_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def create_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_create_request: DocumentCreateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create documents in collection (synchronous) + + Synchronous variant of :meth:`create_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.create_documents_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_create_request=document_create_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _create_documents_serialize( + self, + ai_resource_group, + collection_id, + document_create_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if document_create_request is not None: + _body_params = document_create_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vector/collections/{collectionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_all_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentBulkDeleteResponse: + """Delete list of documents across collections + + Deletes list of documents across collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param document_bulk_delete_request: (required) + :type document_bulk_delete_request: DocumentBulkDeleteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_documents_serialize( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentBulkDeleteResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_all_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentBulkDeleteResponse]: + """Delete list of documents across collections + + Deletes list of documents across collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param document_bulk_delete_request: (required) + :type document_bulk_delete_request: DocumentBulkDeleteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_documents_serialize( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentBulkDeleteResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_all_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete list of documents across collections + + Deletes list of documents across collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param document_bulk_delete_request: (required) + :type document_bulk_delete_request: DocumentBulkDeleteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_documents_serialize( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentBulkDeleteResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def delete_all_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentBulkDeleteResponse: + """Delete list of documents across collections (synchronous) + + Synchronous variant of :meth:`delete_all_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_all_documents( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_all_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentBulkDeleteResponse]: + """Delete list of documents across collections (synchronous) + + Synchronous variant of :meth:`delete_all_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_all_documents_with_http_info( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_all_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + document_bulk_delete_request: DocumentBulkDeleteRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete list of documents across collections (synchronous) + + Synchronous variant of :meth:`delete_all_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_all_documents_without_preload_content( + ai_resource_group=ai_resource_group, + document_bulk_delete_request=document_bulk_delete_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _delete_all_documents_serialize( + self, + ai_resource_group, + document_bulk_delete_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if document_bulk_delete_request is not None: + _body_params = document_bulk_delete_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vector/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_collection_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete collection by ID + + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_collection_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete collection by ID + + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_collection_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete collection by ID + + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def delete_collection_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete collection by ID (synchronous) + + Synchronous variant of :meth:`delete_collection_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_collection_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_collection_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete collection by ID (synchronous) + + Synchronous variant of :meth:`delete_collection_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_collection_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_collection_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[StrictStr, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete collection by ID (synchronous) + + Synchronous variant of :meth:`delete_collection_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_collection_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _delete_collection_by_id_serialize( + self, + ai_resource_group, + collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vector/collections/{collectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_document_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a document + + Deletes a specific document of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_document_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a document + + Deletes a specific document of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_document_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a document + + Deletes a specific document of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def delete_document_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete a document (synchronous) + + Synchronous variant of :meth:`delete_document_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_document_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_document_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete a document (synchronous) + + Synchronous variant of :meth:`delete_document_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_document_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def delete_document_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a document (synchronous) + + Synchronous variant of :meth:`delete_document_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.delete_document_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _delete_document_by_id_serialize( + self, + ai_resource_group, + collection_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/vector/collections/{collectionId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_all_collections( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CollectionsListResponse: + """Get collections + + Gets a list of collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_collections_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionsListResponse", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_all_collections_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CollectionsListResponse]: + """Get collections + + Gets a list of collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_collections_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionsListResponse", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_all_collections_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collections + + Gets a list of collections. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_collections_serialize( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionsListResponse", + '400': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_all_collections_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CollectionsListResponse: + """Get collections (synchronous) + + Synchronous variant of :meth:`get_all_collections`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_collections( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_collections_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CollectionsListResponse]: + """Get collections (synchronous) + + Synchronous variant of :meth:`get_all_collections_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_collections_with_http_info( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_collections_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collections (synchronous) + + Synchronous variant of :meth:`get_all_collections_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_collections_without_preload_content( + ai_resource_group=ai_resource_group, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_collections_serialize( + self, + ai_resource_group, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_all_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Documents: + """Get documents + + Gets a list of documents of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Documents", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_all_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Documents]: + """Get documents + + Gets a list of documents of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Documents", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_all_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get documents + + Gets a list of documents of a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param top: Number of results to display + :type top: int + :param skip: Number of results to be skipped from the ordered list of results + :type skip: int + :param count: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + :type count: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Documents", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_all_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Documents: + """Get documents (synchronous) + + Synchronous variant of :meth:`get_all_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Documents]: + """Get documents (synchronous) + + Synchronous variant of :meth:`get_all_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_all_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + top: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to display")] = None, + skip: Annotated[Optional[Annotated[int, Field(strict=True, ge=0)]], Field(description="Number of results to be skipped from the ordered list of results")] = None, + count: Annotated[Optional[StrictBool], Field(description="When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get documents (synchronous) + + Synchronous variant of :meth:`get_all_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_all_documents_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + top=top, + skip=skip, + count=count, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_all_documents_serialize( + self, + ai_resource_group, + collection_id, + top, + skip, + count, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + if top is not None: + + _query_params.append(('$top', top)) + + if skip is not None: + + _query_params.append(('$skip', skip)) + + if count is not None: + + _query_params.append(('$count', count)) + + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{collectionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_collection_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Get collection by ID + + Gets a specific collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_collection_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Get collection by ID + + Gets a specific collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_collection_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection by ID + + Gets a specific collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Collection", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_collection_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Collection: + """Get collection by ID (synchronous) + + Synchronous variant of :meth:`get_collection_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Collection]: + """Get collection by ID (synchronous) + + Synchronous variant of :meth:`get_collection_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection by ID (synchronous) + + Synchronous variant of :meth:`get_collection_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_collection_by_id_serialize( + self, + ai_resource_group, + collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{collectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_collection_creation_status( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionCreationStatus200Response: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_creation_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionCreationStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_collection_creation_status_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionCreationStatus200Response]: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_creation_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionCreationStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_collection_creation_status_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_creation_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionCreationStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_collection_creation_status_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionCreationStatus200Response: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_creation_status`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_creation_status( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_creation_status_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionCreationStatus200Response]: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_creation_status_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_creation_status_with_http_info( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_creation_status_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_creation_status_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_creation_status_without_preload_content( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_collection_creation_status_serialize( + self, + ai_resource_group, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{id}/creationStatus', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_collection_deletion_status( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionDeletionStatus200Response: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_deletion_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionDeletionStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_collection_deletion_status_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionDeletionStatus200Response]: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_deletion_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionDeletionStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_collection_deletion_status_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID + + Gets a specific collection status from monitor by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param id: Collection ID (required) + :type id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_collection_deletion_status_serialize( + ai_resource_group=ai_resource_group, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetCollectionDeletionStatus200Response", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_collection_deletion_status_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCollectionDeletionStatus200Response: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_deletion_status`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_deletion_status( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_deletion_status_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCollectionDeletionStatus200Response]: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_deletion_status_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_deletion_status_with_http_info( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_collection_deletion_status_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + id: Annotated[UUID, Field(description="Collection ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get collection status by ID (synchronous) + + Synchronous variant of :meth:`get_collection_deletion_status_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_collection_deletion_status_without_preload_content( + ai_resource_group=ai_resource_group, + id=id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_collection_deletion_status_serialize( + self, + ai_resource_group, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{id}/deletionStatus', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_document_by_id( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentResponse: + """Get document by ID + + Gets a specific document in a collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_document_by_id_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentResponse]: + """Get document by ID + + Gets a specific document in a collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_document_by_id_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document by ID + + Gets a specific document in a collection by ID. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_id: Document ID (required) + :type document_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_document_by_id_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def get_document_by_id_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentResponse: + """Get document by ID (synchronous) + + Synchronous variant of :meth:`get_document_by_id`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentResponse]: + """Get document by ID (synchronous) + + Synchronous variant of :meth:`get_document_by_id_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def get_document_by_id_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_id: Annotated[UUID, Field(description="Document ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get document by ID (synchronous) + + Synchronous variant of :meth:`get_document_by_id_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.get_document_by_id_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_id=document_id, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _get_document_by_id_serialize( + self, + ai_resource_group, + collection_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + if document_id is not None: + _path_params['documentId'] = document_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/vector/collections/{collectionId}/documents/{documentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def search( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VectorSearchResults: + """Search chunk by vector + + Search chunks + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param text_search_request: (required) + :type text_search_request: TextSearchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VectorSearchResults", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def search_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VectorSearchResults]: + """Search chunk by vector + + Search chunks + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param text_search_request: (required) + :type text_search_request: TextSearchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VectorSearchResults", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def search_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search chunk by vector + + Search chunks + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param text_search_request: (required) + :type text_search_request: TextSearchRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._search_serialize( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "VectorSearchResults", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def search_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VectorSearchResults: + """Search chunk by vector (synchronous) + + Synchronous variant of :meth:`search`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VectorSearchResults]: + """Search chunk by vector (synchronous) + + Synchronous variant of :meth:`search_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_with_http_info( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def search_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + text_search_request: TextSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search chunk by vector (synchronous) + + Synchronous variant of :meth:`search_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.search_without_preload_content( + ai_resource_group=ai_resource_group, + text_search_request=text_search_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _search_serialize( + self, + ai_resource_group, + text_search_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if text_search_request is not None: + _body_params = text_search_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/vector/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_chunks_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch chunks metadata + + Allows to add, remove and modify the chunks metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_chunks_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch chunks metadata + + Allows to add, remove and modify the chunks metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_chunks_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch chunks metadata + + Allows to add, remove and modify the chunks metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_chunks_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def update_chunks_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch chunks metadata (synchronous) + + Synchronous variant of :meth:`update_chunks_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_chunks_metadata( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_chunks_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch chunks metadata (synchronous) + + Synchronous variant of :meth:`update_chunks_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_chunks_metadata_with_http_info( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_chunks_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch chunks metadata (synchronous) + + Synchronous variant of :meth:`update_chunks_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_chunks_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _update_chunks_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/chunks/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_collections_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch collections metadata + + Allows to add, remove and modify the collections metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_collections_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_collections_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch collections metadata + + Allows to add, remove and modify the collections metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_collections_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_collections_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch collections metadata + + Allows to add, remove and modify the collections metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_collections_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def update_collections_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch collections metadata (synchronous) + + Synchronous variant of :meth:`update_collections_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_collections_metadata( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_collections_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch collections metadata (synchronous) + + Synchronous variant of :meth:`update_collections_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_collections_metadata_with_http_info( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_collections_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch collections metadata (synchronous) + + Synchronous variant of :meth:`update_collections_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_collections_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _update_collections_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/collections/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_documents( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Upsert documents in collection + + Upserts the data of multiple documents into a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_update_request: (required) + :type document_update_request: DocumentUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_documents_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Upsert documents in collection + + Upserts the data of multiple documents into a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_update_request: (required) + :type document_update_request: DocumentUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_documents_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upsert documents in collection + + Upserts the data of multiple documents into a collection. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param collection_id: Collection ID (required) + :type collection_id: UUID + :param document_update_request: (required) + :type document_update_request: DocumentUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_serialize( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentsListResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def update_documents_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DocumentsListResponse: + """Upsert documents in collection (synchronous) + + Synchronous variant of :meth:`update_documents`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DocumentsListResponse]: + """Upsert documents in collection (synchronous) + + Synchronous variant of :meth:`update_documents_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_with_http_info( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + collection_id: Annotated[UUID, Field(description="Collection ID")], + document_update_request: DocumentUpdateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upsert documents in collection (synchronous) + + Synchronous variant of :meth:`update_documents_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_without_preload_content( + ai_resource_group=ai_resource_group, + collection_id=collection_id, + document_update_request=document_update_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _update_documents_serialize( + self, + ai_resource_group, + collection_id, + document_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if collection_id is not None: + _path_params['collectionId'] = collection_id + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if document_update_request is not None: + _body_params = document_update_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/collections/{collectionId}/documents', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_documents_metadata( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch documents metadata + + Allows to add, remove and modify the documents metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_documents_metadata_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch documents metadata + + Allows to add, remove and modify the documents metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_documents_metadata_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch documents metadata + + Allows to add, remove and modify the documents metadata. + + :param ai_resource_group: Resource Group ID (required) + :type ai_resource_group: str + :param metadata_updates: (required) + :type metadata_updates: MetadataUpdates + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_documents_metadata_serialize( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MetadataResponse", + '400': "GetAllPipelines400Response", + '404': "GetAllPipelines400Response", + '422': "GetAllPipelines400Response", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def update_documents_metadata_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MetadataResponse: + """Patch documents metadata (synchronous) + + Synchronous variant of :meth:`update_documents_metadata`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_metadata( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_metadata_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MetadataResponse]: + """Patch documents metadata (synchronous) + + Synchronous variant of :meth:`update_documents_metadata_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_metadata_with_http_info( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def update_documents_metadata_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="Resource Group ID")], + metadata_updates: MetadataUpdates, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Patch documents metadata (synchronous) + + Synchronous variant of :meth:`update_documents_metadata_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.update_documents_metadata_without_preload_content( + ai_resource_group=ai_resource_group, + metadata_updates=metadata_updates, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _update_documents_metadata_serialize( + self, + ai_resource_group, + metadata_updates, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['AI-Resource-Group'] = ai_resource_group + # process the form parameters + # process the body parameter + if metadata_updates is not None: + _body_params = metadata_updates + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/vector/documents/metadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py new file mode 100644 index 0000000..04e2478 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_client.py @@ -0,0 +1,836 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile +import uuid + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from gen_ai_hub.document_grounding_generation.generated.configuration import Configuration +from gen_ai_hub.document_grounding_generation.generated.api_response import ApiResponse, T as ApiResponseT +import gen_ai_hub.document_grounding_generation.generated.models +from gen_ai_hub.document_grounding_generation.generated import rest +from gen_ai_hub.document_grounding_generation.generated.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = await self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + + # deserialize response data + response_text = None + return_data = None + try: + if response_type in ("bytearray", "bytes"): + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.headers, + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + elif isinstance(obj, dict): + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return self.sanitize_for_serialization(obj_dict) + + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('Optional['): + m = re.match(r'Optional\[(.*)]', klass) + assert m is not None, "Malformed Optional type definition" + # data is not None here, so the optionality is already resolved + return self.__deserialize(data, m.group(1)) + + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(gen_ai_hub.document_grounding_generation.generated.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, str(value).lower() if isinstance(value, bool) else value) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + str(value).lower() if isinstance(value, bool) else str(value) + for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, quote(str(value).lower() if isinstance(value, bool) else str(value))) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + quote(str(value).lower() if isinstance(value, bool) else str(value)) + for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters, excluding base64 delimiters + cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=") + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py new file mode 100644 index 0000000..b827a34 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/configuration.py @@ -0,0 +1,604 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import base64 +import copy +import http.client as httplib +import logging +from logging import FileHandler +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self + + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "Oauth2": OAuth2AuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: int - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. + + :Example: + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "/lm/document-grounding" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("generated") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = verify_ssl + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file + """client certificate file + """ + self.key_file = key_file + """client key file + """ + self.assert_hostname = assert_hostname + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = tls_server_name + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100 + """This value is passed to the aiohttp to limit simultaneous connections. + None in the constructor is coerced to default 100. + """ + + self.proxy = proxy + """Proxy URL + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.safe_chars_for_path_param = safe_chars_for_path_param + """Safe chars for path_param + """ + self.retries = retries + """Retry configuration + """ + # Enable client side validation + self.client_side_validation = client_side_validation + + self.socket_options = socket_options + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = datetime_format + """datetime format + """ + + self.date_format = date_format + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setter to re-create the file handler (excluded from __dict__ copy) + result.logger_file = self.logger_file + + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + if self.access_token is not None: + auth['Oauth2'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.1.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "/lm/document-grounding", + 'description': "No description provided", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and variable['enum_values'] \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py new file mode 100644 index 0000000..f5e8536 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/exceptions.py @@ -0,0 +1,218 @@ +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py new file mode 100644 index 0000000..8f51586 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/__init__.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +# flake8: noqa +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_minimal_response import BasePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.base_pipeline_response import BasePipelineResponse +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_document_success import BatchUpdateDocumentSuccess +from gen_ai_hub.document_grounding_generation.generated.models.batch_update_documents_response_inner import BatchUpdateDocumentsResponseInner +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.chunk import Chunk +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_request import CollectionRequest +from gen_ai_hub.document_grounding_generation.generated.models.collections_list_response import CollectionsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.create_pipeline import CreatePipeline +from gen_ai_hub.document_grounding_generation.generated.models.data_repositories import DataRepositories +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_results import DataRepositorySearchResults +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.document import Document +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_request import DocumentBulkDeleteRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_bulk_delete_response import DocumentBulkDeleteResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_create_request import DocumentCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput +from gen_ai_hub.document_grounding_generation.generated.models.document_key_value_list_pair import DocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_batch_request import DocumentMetadataBatchRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.document_response import DocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from gen_ai_hub.document_grounding_generation.generated.models.document_update_request import DocumentUpdateRequest +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from gen_ai_hub.document_grounding_generation.generated.models.documents import Documents +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from gen_ai_hub.document_grounding_generation.generated.models.documents_list_response import DocumentsListResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response import DocumentsStatusResponse +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.error_response import ErrorResponse +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.generic_error import GenericError +from gen_ai_hub.document_grounding_generation.generated.models.get_all_pipelines400_response import GetAllPipelines400Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_creation_status200_response import GetCollectionCreationStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_collection_deletion_status200_response import GetCollectionDeletionStatus200Response +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_execution_by_id import GetPipelineExecutionById +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_executions import GetPipelineExecutions +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline_status import GetPipelineStatus +from gen_ai_hub.document_grounding_generation.generated.models.get_pipelines import GetPipelines +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail +from gen_ai_hub.document_grounding_generation.generated.models.http_validation_error import HTTPValidationError +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.left import Left +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents import ListConfigurationDocuments +from gen_ai_hub.document_grounding_generation.generated.models.list_configuration_documents_full_details import ListConfigurationDocumentsFullDetails +from gen_ai_hub.document_grounding_generation.generated.models.list_metadata_configurations import ListMetadataConfigurations +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.manual_pipeline_trigger import ManualPipelineTrigger +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from gen_ai_hub.document_grounding_generation.generated.models.message_response import MessageResponse +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request import MetadataConfigurationRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum +from gen_ai_hub.document_grounding_generation.generated.models.metadata_response import MetadataResponse +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem +from gen_ai_hub.document_grounding_generation.generated.models.metadata_updates import MetadataUpdates +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline import PatchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_document_response import PipelineDocumentResponse +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_id import PipelineId +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input import RetrievalSearchInput +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_results import RetrievalSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.right import Right +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_filter import SearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.search_pipeline import SearchPipeline +from gen_ai_hub.document_grounding_generation.generated.models.search_pipelines_response import SearchPipelinesResponse +from gen_ai_hub.document_grounding_generation.generated.models.search_results import SearchResults +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.text_search_request import TextSearchRequest +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_results import VectorSearchResults +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py new file mode 100644 index 0000000..8b713d3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/api_error.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.details_error_response import DetailsErrorResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ApiError(BaseModel): + """ + ApiError + """ # noqa: E501 + code: StrictStr = Field(description="Descriptive error code (not http status code).") + message: StrictStr = Field(description="plaintext error description") + request_id: Optional[StrictStr] = Field(default=None, description="id of individual request", serialization_alias="requestId") + target: Optional[StrictStr] = Field(default=None, description="url that has been called") + details: Optional[List[DetailsErrorResponse]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "requestId", "target", "details"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in details (list) + _items = [] + if self.details: + for _item_details in self.details: + _items.append(_item_details.to_dict() if _item_details is not None else None) + _dict['details'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "requestId": obj.get("requestId"), + "target": obj.get("target"), + "details": [DetailsErrorResponse.from_dict(_item) for _item in obj["details"]] if obj.get("details") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py new file mode 100644 index 0000000..924e366 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_document.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BaseDocument(BaseModel): + """ + Base class for documents, document requests and responses. + """ # noqa: E501 + chunks: List[TextOnlyBaseChunkCreate] + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["chunks", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BaseDocument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseDocument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chunks": [TextOnlyBaseChunkCreate.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py new file mode 100644 index 0000000..daa9f76 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_minimal_response.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BasePipelineMinimalResponse(BaseModel): + """ + BasePipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BasePipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BasePipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py new file mode 100644 index 0000000..83dd613 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/base_pipeline_response.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BasePipelineResponse(BaseModel): + """ + BasePipelineResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BasePipelineResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BasePipelineResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py new file mode 100644 index 0000000..44503d5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_document_success.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BatchUpdateDocumentSuccess(BaseModel): + """ + BatchUpdateDocumentSuccess + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of the document.") + metadata: List[DocumentMetadata] = Field(description="Metadata updates for this document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchUpdateDocumentSuccess from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchUpdateDocumentSuccess from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py new file mode 100644 index 0000000..a77202a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/batch_update_documents_response_inner.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update_error import DocumentMetadataUpdateError +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +BATCHUPDATEDOCUMENTSRESPONSEINNER_ONE_OF_SCHEMAS = ["DocumentMetadataUpdate", "DocumentMetadataUpdateError"] + +class BatchUpdateDocumentsResponseInner(BaseModel): + """ + BatchUpdateDocumentsResponseInner + """ + # data type: DocumentMetadataUpdate + oneof_schema_1_validator: Optional[DocumentMetadataUpdate] = None + # data type: DocumentMetadataUpdateError + oneof_schema_2_validator: Optional[DocumentMetadataUpdateError] = None + actual_instance: Optional[Union[DocumentMetadataUpdate, DocumentMetadataUpdateError]] = None + one_of_schemas: Set[str] = { "DocumentMetadataUpdate", "DocumentMetadataUpdateError" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = BatchUpdateDocumentsResponseInner.model_construct() + error_messages = [] + match = 0 + # validate data type: DocumentMetadataUpdate + if not isinstance(v, DocumentMetadataUpdate): + error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentMetadataUpdate`") + else: + match += 1 + # validate data type: DocumentMetadataUpdateError + if not isinstance(v, DocumentMetadataUpdateError): + error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentMetadataUpdateError`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into DocumentMetadataUpdate + try: + instance.actual_instance = DocumentMetadataUpdate.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DocumentMetadataUpdateError + try: + instance.actual_instance = DocumentMetadataUpdateError.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into BatchUpdateDocumentsResponseInner with oneOf schemas: DocumentMetadataUpdate, DocumentMetadataUpdateError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], DocumentMetadataUpdate, DocumentMetadataUpdateError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py new file mode 100644 index 0000000..8fa468a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/binary_boolean_filter.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BinaryBooleanFilter(BaseModel): + """ + BinaryBooleanFilter + """ # noqa: E501 + operator: StrictStr = Field(description="Boolean operator for combining filter conditions") + left: Left1 + right: Right1 + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["operator", "left", "right"] + + @field_validator('operator') + def operator_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['and', 'or']): + raise ValueError("must be one of enum values ('and', 'or')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BinaryBooleanFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of left + if self.left: + _dict['left'] = self.left.to_dict() + # override the default output from pydantic by calling `to_dict()` of right + if self.right: + _dict['right'] = self.right.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BinaryBooleanFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "operator": obj.get("operator"), + "left": Left1.from_dict(obj["left"]) if obj.get("left") is not None else None, + "right": Right1.from_dict(obj["right"]) if obj.get("right") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.left1 import Left1 +from gen_ai_hub.document_grounding_generation.generated.models.right1 import Right1 +# TODO: Rewrite to not use raise_errors +BinaryBooleanFilter.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py new file mode 100644 index 0000000..681ac48 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_score_computation_strategy.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class BoostingScoreComputationStrategy(str, Enum): + """ + BoostingScoreComputationStrategy + """ + + """ + allowed enum values + """ + MATCH_COUNT = 'match_count' + EMBEDDING = 'embedding' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BoostingScoreComputationStrategy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py new file mode 100644 index 0000000..02218b9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.boosting_score_computation_strategy import BoostingScoreComputationStrategy +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration_metadata_inner import BoostingScoringConfigurationMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BoostingScoringConfiguration(BaseModel): + """ + BoostingScoringConfiguration + """ # noqa: E501 + enabled: Optional[StrictBool] = Field(default=True, description="Enable metadata-based boosting.") + metadata: Optional[List[BoostingScoringConfigurationMetadataInner]] = None + weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + score_computation_strategy: Optional[BoostingScoreComputationStrategy] = Field(default=None, serialization_alias="scoreComputationStrategy") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["enabled", "metadata", "weight", "scoreComputationStrategy"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoostingScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoostingScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "metadata": [BoostingScoringConfigurationMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "weight": obj.get("weight") if "weight" in obj else 1, + "scoreComputationStrategy": obj.get("scoreComputationStrategy") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py new file mode 100644 index 0000000..7b645b8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/boosting_scoring_configuration_metadata_inner.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BoostingScoringConfigurationMetadataInner(BaseModel): + """ + BoostingScoringConfigurationMetadataInner + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: Optional[StrictStr] = 'document' + weight: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "scope", "weight"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['repository', 'document', 'chunk']): + raise ValueError("must be one of enum values ('repository', 'document', 'chunk')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoostingScoringConfigurationMetadataInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoostingScoringConfigurationMetadataInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") if obj.get("scope") is not None else 'document', + "weight": obj.get("weight") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py new file mode 100644 index 0000000..4721934 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/chunk.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Chunk(BaseModel): + """ + Chunk + """ # noqa: E501 + id: StrictStr + content: StrictStr + metadata: Optional[List[KeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "content", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Chunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Chunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [KeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py new file mode 100644 index 0000000..25544aa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Collection(BaseModel): + """ + A logical grouping of content. + """ # noqa: E501 + title: Optional[StrictStr] = None + embedding_config: EmbeddingConfig = Field(serialization_alias="embeddingConfig") + metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") + id: UUID = Field(description="Unique identifier of a collection.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Collection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of embedding_config + if self.embedding_config: + _dict['embeddingConfig'] = self.embedding_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Collection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "embeddingConfig": EmbeddingConfig.from_dict(obj["embeddingConfig"]) if obj.get("embeddingConfig") is not None else None, + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py new file mode 100644 index 0000000..d7dcc4a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_created_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionCreatedResponse(BaseModel): + """ + CollectionCreatedResponse + """ # noqa: E501 + collection_url: StrictStr = Field(serialization_alias="collectionURL") + status: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collectionURL", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionCreatedResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionCreatedResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collectionURL": obj.get("collectionURL"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py new file mode 100644 index 0000000..20e6162 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_deleted_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionDeletedResponse(BaseModel): + """ + CollectionDeletedResponse + """ # noqa: E501 + collection_url: StrictStr = Field(serialization_alias="collectionURL") + status: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collectionURL", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionDeletedResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionDeletedResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collectionURL": obj.get("collectionURL"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py new file mode 100644 index 0000000..c65b30a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_pending_response.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionPendingResponse(BaseModel): + """ + CollectionPendingResponse + """ # noqa: E501 + monitor_url: StrictStr = Field(serialization_alias="monitorURL") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["monitorURL"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionPendingResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionPendingResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "monitorURL": obj.get("monitorURL") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py new file mode 100644 index 0000000..c82d586 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collection_request.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.embedding_config import EmbeddingConfig +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionRequest(BaseModel): + """ + A request for creating a new, single collection. + """ # noqa: E501 + title: Optional[StrictStr] = None + embedding_config: EmbeddingConfig = Field(serialization_alias="embeddingConfig") + metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Metadata attached to collection. Useful to restrict search to a subset of collections.") + id: Optional[UUID] = Field(default=None, description="Unique identifier of a collection.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "embeddingConfig", "metadata", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of embedding_config + if self.embedding_config: + _dict['embeddingConfig'] = self.embedding_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "embeddingConfig": EmbeddingConfig.from_dict(obj["embeddingConfig"]) if obj.get("embeddingConfig") is not None else None, + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py new file mode 100644 index 0000000..7dd6df8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/collections_list_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection import Collection +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CollectionsListResponse(BaseModel): + """ + A response containing collections retrieved from the server. + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[Collection] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [Collection.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py new file mode 100644 index 0000000..177c530 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ConfigurationDocument(BaseModel): + """ + ConfigurationDocument + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document.", json_schema_extra={"examples": ["3cba7512-b07a-58e6-a442-c83996a0b3bb"]}) + title: Optional[StrictStr] = Field(default=None, description="Title of the document.", json_schema_extra={"examples": ["Quarterly Report"]}) + absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", serialization_alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) + created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + type: Optional[StrictStr] = Field(default=None, description="Type of the resource. Can be FOLDER, DOCUMENT.") + metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['FOLDER', 'DOCUMENT']): + raise ValueError("must be one of enum values ('FOLDER', 'DOCUMENT')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConfigurationDocument from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigurationDocument from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "absoluteFilePath": obj.get("absoluteFilePath"), + "createdTimestamp": obj.get("createdTimestamp"), + "type": obj.get("type"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py new file mode 100644 index 0000000..87f9039 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/configuration_document_full_details.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ConfigurationDocumentFullDetails(BaseModel): + """ + ConfigurationDocumentFullDetails + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the document.", json_schema_extra={"examples": ["3cba7512-b07a-58e6-a442-c83996a0b3bb"]}) + title: Optional[StrictStr] = Field(default=None, description="Title of the document.", json_schema_extra={"examples": ["Quarterly Report"]}) + absolute_file_path: Optional[StrictStr] = Field(default=None, description="Absolute file path of the document in the repository.", serialization_alias="absoluteFilePath", json_schema_extra={"examples": ["/sites/team/finance/Q1/report.pdf"]}) + created_timestamp: Optional[datetime] = Field(default=None, description="UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z)", serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2025-08-28T06:15:30Z"]}) + resource_uri: Optional[StrictStr] = Field(default=None, description="URI of the resource.", serialization_alias="resourceUri", json_schema_extra={"examples": ["https://example.com/resource/123"]}) + web_url: Optional[StrictStr] = Field(default=None, description="Web URL of the document.", serialization_alias="webUrl", json_schema_extra={"examples": ["https://example.com/web/123"]}) + document_etag: Optional[StrictStr] = Field(default=None, description="ETag of the document.", serialization_alias="documentEtag", json_schema_extra={"examples": ["abc123etag"]}) + file_suffix: Optional[StrictStr] = Field(default=None, description="File suffix of the document.", serialization_alias="fileSuffix", json_schema_extra={"examples": [".pdf"]}) + view_location: Optional[StrictStr] = Field(default=None, description="View location of the document.", serialization_alias="viewLocation", json_schema_extra={"examples": ["https://example.com/view/123"]}) + download_location: Optional[StrictStr] = Field(default=None, description="Download location of the document.", serialization_alias="downloadLocation", json_schema_extra={"examples": ["https://example.com/download/123"]}) + mime_type: Optional[StrictStr] = Field(default=None, description="MIME type of the document.", serialization_alias="mimeType", json_schema_extra={"examples": ["application/pdf"]}) + file_size_mb: Optional[StrictStr] = Field(default=None, description="File size of the document in megabytes.", serialization_alias="fileSizeMb", json_schema_extra={"examples": ["1.5"]}) + metadata: Optional[List[DocumentMetadata]] = Field(default=None, description="Metadata key-value pairs associated with the document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "absoluteFilePath", "createdTimestamp", "resourceUri", "webUrl", "documentEtag", "fileSuffix", "viewLocation", "downloadLocation", "mimeType", "fileSizeMb", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConfigurationDocumentFullDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigurationDocumentFullDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "absoluteFilePath": obj.get("absoluteFilePath"), + "createdTimestamp": obj.get("createdTimestamp"), + "resourceUri": obj.get("resourceUri"), + "webUrl": obj.get("webUrl"), + "documentEtag": obj.get("documentEtag"), + "fileSuffix": obj.get("fileSuffix"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "mimeType": obj.get("mimeType"), + "fileSizeMb": obj.get("fileSizeMb"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py new file mode 100644 index 0000000..51bae01 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/create_pipeline.py @@ -0,0 +1,270 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration import MetadataConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_create_request import S3PipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_create_request import SDMPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_create_request import SFTPPipelineCreateRequest +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +CREATEPIPELINE_ONE_OF_SCHEMAS = ["GoogleDrivePipelineCreateRequest", "MSSharePointPipelineCreateRequest", "MetadataConfiguration", "S3PipelineCreateRequest", "SDMPipelineCreateRequest", "SFTPPipelineCreateRequest", "ServiceNowPipelineCreateRequest", "WorkZonePipelineCreateRequest"] + +class CreatePipeline(BaseModel): + """ + CreatePipeline + """ + # data type: MSSharePointPipelineCreateRequest + oneof_schema_1_validator: Optional[MSSharePointPipelineCreateRequest] = None + # data type: S3PipelineCreateRequest + oneof_schema_2_validator: Optional[S3PipelineCreateRequest] = None + # data type: SFTPPipelineCreateRequest + oneof_schema_3_validator: Optional[SFTPPipelineCreateRequest] = None + # data type: SDMPipelineCreateRequest + oneof_schema_4_validator: Optional[SDMPipelineCreateRequest] = None + # data type: WorkZonePipelineCreateRequest + oneof_schema_5_validator: Optional[WorkZonePipelineCreateRequest] = None + # data type: ServiceNowPipelineCreateRequest + oneof_schema_6_validator: Optional[ServiceNowPipelineCreateRequest] = None + # data type: GoogleDrivePipelineCreateRequest + oneof_schema_7_validator: Optional[GoogleDrivePipelineCreateRequest] = None + # data type: MetadataConfiguration + oneof_schema_8_validator: Optional[MetadataConfiguration] = None + actual_instance: Optional[Union[GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest]] = None + one_of_schemas: Set[str] = { "GoogleDrivePipelineCreateRequest", "MSSharePointPipelineCreateRequest", "MetadataConfiguration", "S3PipelineCreateRequest", "SDMPipelineCreateRequest", "SFTPPipelineCreateRequest", "ServiceNowPipelineCreateRequest", "WorkZonePipelineCreateRequest" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreatePipeline.model_construct() + error_messages = [] + match = 0 + # validate data type: MSSharePointPipelineCreateRequest + if not isinstance(v, MSSharePointPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `MSSharePointPipelineCreateRequest`") + else: + match += 1 + # validate data type: S3PipelineCreateRequest + if not isinstance(v, S3PipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `S3PipelineCreateRequest`") + else: + match += 1 + # validate data type: SFTPPipelineCreateRequest + if not isinstance(v, SFTPPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `SFTPPipelineCreateRequest`") + else: + match += 1 + # validate data type: SDMPipelineCreateRequest + if not isinstance(v, SDMPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `SDMPipelineCreateRequest`") + else: + match += 1 + # validate data type: WorkZonePipelineCreateRequest + if not isinstance(v, WorkZonePipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `WorkZonePipelineCreateRequest`") + else: + match += 1 + # validate data type: ServiceNowPipelineCreateRequest + if not isinstance(v, ServiceNowPipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `ServiceNowPipelineCreateRequest`") + else: + match += 1 + # validate data type: GoogleDrivePipelineCreateRequest + if not isinstance(v, GoogleDrivePipelineCreateRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleDrivePipelineCreateRequest`") + else: + match += 1 + # validate data type: MetadataConfiguration + if not isinstance(v, MetadataConfiguration): + error_messages.append(f"Error! Input type `{type(v)}` is not `MetadataConfiguration`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # use oneOf discriminator to lookup the data type + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) + if not _data_type: + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") + + # check if data type is `GoogleDrivePipelineCreateRequest` + if _data_type == "GoogleDrive": + instance.actual_instance = GoogleDrivePipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `MSSharePointPipelineCreateRequest` + if _data_type == "MSSharePoint": + instance.actual_instance = MSSharePointPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `S3PipelineCreateRequest` + if _data_type == "S3": + instance.actual_instance = S3PipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `SDMPipelineCreateRequest` + if _data_type == "SDM": + instance.actual_instance = SDMPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `SFTPPipelineCreateRequest` + if _data_type == "SFTP": + instance.actual_instance = SFTPPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `ServiceNowPipelineCreateRequest` + if _data_type == "ServiceNow": + instance.actual_instance = ServiceNowPipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `WorkZonePipelineCreateRequest` + if _data_type == "WorkZone": + instance.actual_instance = WorkZonePipelineCreateRequest.from_json(json_str) + return instance + + # check if data type is `MetadataConfiguration` + if _data_type == "metadata": + instance.actual_instance = MetadataConfiguration.from_json(json_str) + return instance + + # deserialize data into MSSharePointPipelineCreateRequest + try: + instance.actual_instance = MSSharePointPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineCreateRequest + try: + instance.actual_instance = S3PipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineCreateRequest + try: + instance.actual_instance = SFTPPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineCreateRequest + try: + instance.actual_instance = SDMPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineCreateRequest + try: + instance.actual_instance = WorkZonePipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineCreateRequest + try: + instance.actual_instance = ServiceNowPipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineCreateRequest + try: + instance.actual_instance = GoogleDrivePipelineCreateRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MetadataConfiguration + try: + instance.actual_instance = MetadataConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreatePipeline with oneOf schemas: GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineCreateRequest, MSSharePointPipelineCreateRequest, MetadataConfiguration, S3PipelineCreateRequest, SDMPipelineCreateRequest, SFTPPipelineCreateRequest, ServiceNowPipelineCreateRequest, WorkZonePipelineCreateRequest]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py new file mode 100644 index 0000000..832e608 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repositories.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository import DataRepository +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositories(BaseModel): + """ + DataRepositories + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[DataRepository] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositories from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositories from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [DataRepository.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py new file mode 100644 index 0000000..f508fae --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepository(BaseModel): + """ + DataRepository schema expected by Retrieval. + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of this DataRepository.") + title: StrictStr + metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories.") + remote_grounding_name: Optional[StrictStr] = Field(default=None, serialization_alias="remoteGroundingName") + message: Optional[StrictStr] = None + type: DataRepositoryType + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepository from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepository from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName"), + "message": obj.get("message"), + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py new file mode 100644 index 0000000..8a1fd3e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_per_filter_search_result.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_search_result import DataRepositorySearchResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositoryPerFilterSearchResult(BaseModel): + """ + DataRepositoryPerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(serialization_alias="filterId") + results: Optional[List[DataRepositorySearchResult]] = Field(default=None, description="List of returned results.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositoryPerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositoryPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py new file mode 100644 index 0000000..3270bd2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositorySearchResult(BaseModel): + """ + DataRepositorySearchResult + """ # noqa: E501 + data_repository: DataRepositoryWithDocuments = Field(serialization_alias="dataRepository") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dataRepository"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositorySearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data_repository + if self.data_repository: + _dict['dataRepository'] = self.data_repository.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositorySearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py new file mode 100644 index 0000000..d61f552 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_search_results.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.results_inner2 import ResultsInner2 +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositorySearchResults(BaseModel): + """ + DataRepositorySearchResults + """ # noqa: E501 + results: List[ResultsInner2] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositorySearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositorySearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ResultsInner2.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py new file mode 100644 index 0000000..a290173 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_type.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DataRepositoryType(str, Enum): + """ + Only include DataRepositories with the given type. + """ + + """ + allowed enum values + """ + VECTOR = 'vector' + HELP_DOT_SAP_DOT_COM = 'help.sap.com' + REMOTE_COLON_DG = 'remote:dg' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DataRepositoryType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py new file mode 100644 index 0000000..6a96eed --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/data_repository_with_documents.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document import Document +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DataRepositoryWithDocuments(BaseModel): + """ + DataRepository schema returned by the Vector search endpoint + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of this DataRepository.") + title: StrictStr + metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories.") + remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly destination Name (grounding.name) of remote instance.", serialization_alias="remoteGroundingName") + message: Optional[StrictStr] = Field(default=None, description="Optional message.") + documents: List[Document] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "remoteGroundingName", "message", "documents"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataRepositoryWithDocuments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataRepositoryWithDocuments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName"), + "message": obj.get("message"), + "documents": [Document.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py new file mode 100644 index 0000000..f191899 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/dense_retrieval_scoring_configuration.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DenseRetrievalScoringConfiguration(BaseModel): + """ + DenseRetrievalScoringConfiguration + """ # noqa: E501 + enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") + weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["enabled", "weight"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DenseRetrievalScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DenseRetrievalScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "weight": obj.get("weight") if "weight" in obj else 1 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py new file mode 100644 index 0000000..c5fc742 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/details_error_response.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DetailsErrorResponse(BaseModel): + """ + DetailsErrorResponse + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Descriptive error code (not http status code)") + message: Optional[StrictStr] = Field(default=None, description="Plaintext error description") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetailsErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetailsErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py new file mode 100644 index 0000000..ed450fd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_chunk import RetrievalChunk +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Document(BaseModel): + """ + Document + """ # noqa: E501 + id: StrictStr + metadata: Optional[List[RetrievalDocumentKeyValueListPair]] = None + chunks: List[RetrievalChunk] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Document from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Document from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [RetrievalDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "chunks": [RetrievalChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py new file mode 100644 index 0000000..dfe650e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_request.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentBulkDeleteRequest(BaseModel): + """ + A request to delete documents by their IDs. + """ # noqa: E501 + ids: Annotated[List[UUID], Field(min_length=1, max_length=100)] = Field(description="List of document IDs to delete") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ids"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py new file mode 100644 index 0000000..97c8eb0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_bulk_delete_response.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentBulkDeleteResponse(BaseModel): + """ + Response after deleting documents in bulk. + """ # noqa: E501 + deleted: List[UUID] = Field(description="List of successfully deleted document IDs") + not_found: List[UUID] = Field(description="List of document IDs that were not found", serialization_alias="notFound") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deleted", "notFound"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentBulkDeleteResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deleted": obj.get("deleted"), + "notFound": obj.get("notFound") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py new file mode 100644 index 0000000..e3d7c20 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_create_request.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.base_document import BaseDocument +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentCreateRequest(BaseModel): + """ + A create request containing one or more new documents to create and store in a collection. + """ # noqa: E501 + documents: List[BaseDocument] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "documents": [BaseDocument.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py new file mode 100644 index 0000000..8d08420 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_input.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk_create import TextOnlyBaseChunkCreate +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentInput(BaseModel): + """ + A single document stored in a collection by ID. + """ # noqa: E501 + chunks: List[TextOnlyBaseChunkCreate] + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + id: UUID = Field(description="Unique identifier of a document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentInput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chunks": [TextOnlyBaseChunkCreate.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py new file mode 100644 index 0000000..5846b99 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_key_value_list_pair.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentKeyValueListPair(BaseModel): + """ + DocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, serialization_alias="matchMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py new file mode 100644 index 0000000..4532c52 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadata(BaseModel): + """ + DocumentMetadata + """ # noqa: E501 + key: StrictStr = Field(description="Metadata key name.", json_schema_extra={"examples": ["contentObjectId"]}) + value: Optional[List[StrictStr]] = Field(description="An array of string values associated with the metadata key. If the key already exists, its values will be overwritten. Setting the value to null will delete the metadata key-value pair.") + match_mode: Optional[StrictStr] = Field(default=None, description="Match mode for the metadata key (ANY or ALL).", serialization_alias="matchMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + @field_validator('match_mode') + def match_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ANY', 'ALL']): + raise ValueError("must be one of enum values ('ANY', 'ALL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + # set to None if match_mode (nullable) is None + # and model_fields_set contains the field + if self.match_mode is None and "match_mode" in self.model_fields_set: + _dict['matchMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py new file mode 100644 index 0000000..6e698cd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_batch_request.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata_update import DocumentMetadataUpdate +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadataBatchRequest(BaseModel): + """ + DocumentMetadataBatchRequest + """ # noqa: E501 + value: Annotated[List[DocumentMetadataUpdate], Field(max_length=1000)] = Field(description="List of document metadata updates to be applied in batch.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadataBatchRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in value (list) + _items = [] + if self.value: + for _item_value in self.value: + _items.append(_item_value.to_dict() if _item_value is not None else None) + _dict['value'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadataBatchRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": [DocumentMetadataUpdate.from_dict(_item) for _item in obj["value"]] if obj.get("value") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py new file mode 100644 index 0000000..548c88b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document_metadata import DocumentMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadataUpdate(BaseModel): + """ + DocumentMetadataUpdate + """ # noqa: E501 + id: UUID = Field(description="Unique identifier of the document to update.", json_schema_extra={"examples": ["550e8400-e29b-41d4-a716-446655440000"]}) + metadata: Annotated[List[DocumentMetadata], Field(max_length=10)] = Field(description="Metadata updates for this document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [DocumentMetadata.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py new file mode 100644 index 0000000..38a555c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_metadata_update_error.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentMetadataUpdateError(BaseModel): + """ + DocumentMetadataUpdateError + """ # noqa: E501 + target: StrictStr = Field(description="Document ID that caused the error.", json_schema_extra={"examples": ["550e8400-e29b-41d4-a716-446655440000"]}) + code: StrictInt = Field(description="HTTP error status code.", json_schema_extra={"examples": [500]}) + message: StrictStr = Field(description="Error message.", json_schema_extra={"examples": ["Some unexpected error occurred."]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["target", "code", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdateError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentMetadataUpdateError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "target": obj.get("target"), + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py new file mode 100644 index 0000000..1b11251 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_output.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_chunk import VectorChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentOutput(BaseModel): + """ + DocumentOutput + """ # noqa: E501 + id: UUID + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + chunks: List[VectorChunk] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata", "chunks"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentOutput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentOutput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "chunks": [VectorChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py new file mode 100644 index 0000000..bd057d1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.text_only_base_chunk import TextOnlyBaseChunk +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentResponse(BaseModel): + """ + A response containing information about a newly created, single document. + """ # noqa: E501 + chunks: List[TextOnlyBaseChunk] + metadata: Optional[List[VectorDocumentKeyValueListPair]] = None + id: UUID = Field(description="Unique identifier of a document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["chunks", "metadata", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in chunks (list) + _items = [] + if self.chunks: + for _item_chunks in self.chunks: + _items.append(_item_chunks.to_dict() if _item_chunks is not None else None) + _dict['chunks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chunks": [TextOnlyBaseChunk.from_dict(_item) for _item in obj["chunks"]] if obj.get("chunks") is not None else None, + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py new file mode 100644 index 0000000..96120a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_status.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DocumentStatus(str, Enum): + """ + DocumentStatus + """ + + """ + allowed enum values + """ + TO_BE_PROCESSED = 'TO_BE_PROCESSED' + INDEXED = 'INDEXED' + REINDEXED = 'REINDEXED' + DEINDEXED = 'DEINDEXED' + FAILED = 'FAILED' + FAILED_TO_BE_RETRIED = 'FAILED_TO_BE_RETRIED' + TO_BE_SCHEDULED = 'TO_BE_SCHEDULED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DocumentStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py new file mode 100644 index 0000000..249fc27 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_update_request.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.document_input import DocumentInput +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentUpdateRequest(BaseModel): + """ + An update request containing one or more documents to update existing documents in a collection by ID. + """ # noqa: E501 + documents: List[DocumentInput] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentUpdateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentUpdateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "documents": [DocumentInput.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py new file mode 100644 index 0000000..b69b469 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/document_without_chunks.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_document_key_value_list_pair import VectorDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentWithoutChunks(BaseModel): + """ + A single document stored in a collection by ID without exposing its chunks. + """ # noqa: E501 + metadata: List[VectorDocumentKeyValueListPair] + id: UUID = Field(description="Unique identifier of a document.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["metadata", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentWithoutChunks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentWithoutChunks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": [VectorDocumentKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py new file mode 100644 index 0000000..00803d3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Documents(BaseModel): + """ + A response containing documents retrieved from the server. + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[DocumentWithoutChunks] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Documents from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Documents from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [DocumentWithoutChunks.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py new file mode 100644 index 0000000..5f53cf8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_chunk.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.document_output import DocumentOutput +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsChunk(BaseModel): + """ + DocumentsChunk + """ # noqa: E501 + id: UUID + title: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + documents: List[DocumentOutput] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "title", "metadata", "documents"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "documents": [DocumentOutput.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py new file mode 100644 index 0000000..5086d8a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_list_response.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.document_without_chunks import DocumentWithoutChunks +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsListResponse(BaseModel): + """ + A response containing documents retrieved from the server. + """ # noqa: E501 + documents: List[DocumentWithoutChunks] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["documents"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in documents (list) + _items = [] + if self.documents: + for _item_documents in self.documents: + _items.append(_item_documents.to_dict() if _item_documents is not None else None) + _dict['documents'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "documents": [DocumentWithoutChunks.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py new file mode 100644 index 0000000..c4e871a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.documents_status_response_resources_inner import DocumentsStatusResponseResourcesInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsStatusResponse(BaseModel): + """ + DocumentsStatusResponse + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1]}) + resources: Optional[List[DocumentsStatusResponseResourcesInner]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsStatusResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsStatusResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [DocumentsStatusResponseResourcesInner.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py new file mode 100644 index 0000000..616f350 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/documents_status_response_resources_inner.py @@ -0,0 +1,147 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class DocumentsStatusResponseResourcesInner(BaseModel): + """ + DocumentsStatusResponseResourcesInner + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + status: Optional[DocumentStatus] = None + view_location: Optional[StrictStr] = Field(default=None, serialization_alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, serialization_alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, serialization_alias="absoluteUrl") + title: Optional[StrictStr] = None + metadata_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DocumentsStatusResponseResourcesInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if view_location (nullable) is None + # and model_fields_set contains the field + if self.view_location is None and "view_location" in self.model_fields_set: + _dict['viewLocation'] = None + + # set to None if download_location (nullable) is None + # and model_fields_set contains the field + if self.download_location is None and "download_location" in self.model_fields_set: + _dict['downloadLocation'] = None + + # set to None if absolute_url (nullable) is None + # and model_fields_set contains the field + if self.absolute_url is None and "absolute_url" in self.model_fields_set: + _dict['absoluteUrl'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if metadata_id (nullable) is None + # and model_fields_set contains the field + if self.metadata_id is None and "metadata_id" in self.model_fields_set: + _dict['metadataId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DocumentsStatusResponseResourcesInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "absoluteUrl": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadataId": obj.get("metadataId"), + "createdTimestamp": obj.get("createdTimestamp"), + "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py new file mode 100644 index 0000000..4d8e433 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/embedding_config.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class EmbeddingConfig(BaseModel): + """ + EmbeddingConfig + """ # noqa: E501 + model_name: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(default='text-embedding-ada-002', serialization_alias="modelName") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["modelName"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EmbeddingConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EmbeddingConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modelName": obj.get("modelName") if obj.get("modelName") is not None else 'text-embedding-ada-002' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py new file mode 100644 index 0000000..5c7cd6b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/error_response.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ErrorResponse(BaseModel): + """ + ErrorResponse + """ # noqa: E501 + error: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Error occurred during tenant onboarding"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py new file mode 100644 index 0000000..35b332b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTER_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Filter(BaseModel): + """ + Advanced filter expression for combining metadata filters with boolean logic + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Filter.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Filter with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Filter with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py new file mode 100644 index 0000000..1e2216f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filter_match_mode_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class FilterMatchModeEnum(str, Enum): + """ + FilterMatchModeEnum + """ + + """ + allowed enum values + """ + ANY = 'ANY' + ALL = 'ALL' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of FilterMatchModeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py new file mode 100644 index 0000000..caf9005 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/filters_inner.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_filter import RetrievalSearchFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter import RetrievalVectorSearchFilter +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTERSINNER_ANY_OF_SCHEMAS = ["RetrievalSearchFilter", "RetrievalVectorSearchFilter"] + +class FiltersInner(BaseModel): + """ + FiltersInner + """ + + # data type: RetrievalSearchFilter + anyof_schema_1_validator: Optional[RetrievalSearchFilter] = None + # data type: RetrievalVectorSearchFilter + anyof_schema_2_validator: Optional[RetrievalVectorSearchFilter] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalSearchFilter, RetrievalVectorSearchFilter]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalSearchFilter", "RetrievalVectorSearchFilter" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = FiltersInner.model_construct() + error_messages = [] + # validate data type: RetrievalSearchFilter + if not isinstance(v, RetrievalSearchFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalSearchFilter`") + else: + return v + + # validate data type: RetrievalVectorSearchFilter + if not isinstance(v, RetrievalVectorSearchFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalVectorSearchFilter`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in FiltersInner with anyOf schemas: RetrievalSearchFilter, RetrievalVectorSearchFilter. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalSearchFilter] = None + try: + instance.actual_instance = RetrievalSearchFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalVectorSearchFilter] = None + try: + instance.actual_instance = RetrievalVectorSearchFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into FiltersInner with anyOf schemas: RetrievalSearchFilter, RetrievalVectorSearchFilter. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalSearchFilter, RetrievalVectorSearchFilter]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py new file mode 100644 index 0000000..65e4e93 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/generic_error.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GenericError(BaseModel): + """ + GenericError + """ # noqa: E501 + error: StrictStr = Field(description="Human-readable error message") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GenericError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GenericError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py new file mode 100644 index 0000000..165811d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_all_pipelines400_response.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.api_error import ApiError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetAllPipelines400Response(BaseModel): + """ + GetAllPipelines400Response + """ # noqa: E501 + error: Optional[ApiError] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetAllPipelines400Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetAllPipelines400Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": ApiError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py new file mode 100644 index 0000000..3a90f73 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_creation_status200_response.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection_created_response import CollectionCreatedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETCOLLECTIONCREATIONSTATUS200RESPONSE_ONE_OF_SCHEMAS = ["CollectionCreatedResponse", "CollectionPendingResponse"] + +class GetCollectionCreationStatus200Response(BaseModel): + """ + GetCollectionCreationStatus200Response + """ + # data type: CollectionCreatedResponse + oneof_schema_1_validator: Optional[CollectionCreatedResponse] = None + # data type: CollectionPendingResponse + oneof_schema_2_validator: Optional[CollectionPendingResponse] = None + actual_instance: Optional[Union[CollectionCreatedResponse, CollectionPendingResponse]] = None + one_of_schemas: Set[str] = { "CollectionCreatedResponse", "CollectionPendingResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetCollectionCreationStatus200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: CollectionCreatedResponse + if not isinstance(v, CollectionCreatedResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionCreatedResponse`") + else: + match += 1 + # validate data type: CollectionPendingResponse + if not isinstance(v, CollectionPendingResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionPendingResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into CollectionCreatedResponse + try: + instance.actual_instance = CollectionCreatedResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CollectionPendingResponse + try: + instance.actual_instance = CollectionPendingResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetCollectionCreationStatus200Response with oneOf schemas: CollectionCreatedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], CollectionCreatedResponse, CollectionPendingResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py new file mode 100644 index 0000000..8f248f5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_collection_deletion_status200_response.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.collection_deleted_response import CollectionDeletedResponse +from gen_ai_hub.document_grounding_generation.generated.models.collection_pending_response import CollectionPendingResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETCOLLECTIONDELETIONSTATUS200RESPONSE_ONE_OF_SCHEMAS = ["CollectionDeletedResponse", "CollectionPendingResponse"] + +class GetCollectionDeletionStatus200Response(BaseModel): + """ + GetCollectionDeletionStatus200Response + """ + # data type: CollectionDeletedResponse + oneof_schema_1_validator: Optional[CollectionDeletedResponse] = None + # data type: CollectionPendingResponse + oneof_schema_2_validator: Optional[CollectionPendingResponse] = None + actual_instance: Optional[Union[CollectionDeletedResponse, CollectionPendingResponse]] = None + one_of_schemas: Set[str] = { "CollectionDeletedResponse", "CollectionPendingResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetCollectionDeletionStatus200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: CollectionDeletedResponse + if not isinstance(v, CollectionDeletedResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionDeletedResponse`") + else: + match += 1 + # validate data type: CollectionPendingResponse + if not isinstance(v, CollectionPendingResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `CollectionPendingResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into CollectionDeletedResponse + try: + instance.actual_instance = CollectionDeletedResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CollectionPendingResponse + try: + instance.actual_instance = CollectionPendingResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetCollectionDeletionStatus200Response with oneOf schemas: CollectionDeletedResponse, CollectionPendingResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], CollectionDeletedResponse, CollectionPendingResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py new file mode 100644 index 0000000..cb29093 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline.py @@ -0,0 +1,251 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_get_response import MSSharePointPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_get_response import S3PipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_get_response import SDMPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_get_response import SFTPPipelineGetResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +GETPIPELINE_ONE_OF_SCHEMAS = ["GoogleDrivePipelineGetResponse", "MSSharePointPipelineGetResponse", "S3PipelineGetResponse", "SDMPipelineGetResponse", "SFTPPipelineGetResponse", "ServiceNowPipelineGetResponse", "WorkZonePipelineGetResponse"] + +class GetPipeline(BaseModel): + """ + GetPipeline + """ + # data type: MSSharePointPipelineGetResponse + oneof_schema_1_validator: Optional[MSSharePointPipelineGetResponse] = None + # data type: S3PipelineGetResponse + oneof_schema_2_validator: Optional[S3PipelineGetResponse] = None + # data type: SFTPPipelineGetResponse + oneof_schema_3_validator: Optional[SFTPPipelineGetResponse] = None + # data type: SDMPipelineGetResponse + oneof_schema_4_validator: Optional[SDMPipelineGetResponse] = None + # data type: WorkZonePipelineGetResponse + oneof_schema_5_validator: Optional[WorkZonePipelineGetResponse] = None + # data type: ServiceNowPipelineGetResponse + oneof_schema_6_validator: Optional[ServiceNowPipelineGetResponse] = None + # data type: GoogleDrivePipelineGetResponse + oneof_schema_7_validator: Optional[GoogleDrivePipelineGetResponse] = None + actual_instance: Optional[Union[GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse]] = None + one_of_schemas: Set[str] = { "GoogleDrivePipelineGetResponse", "MSSharePointPipelineGetResponse", "S3PipelineGetResponse", "SDMPipelineGetResponse", "SFTPPipelineGetResponse", "ServiceNowPipelineGetResponse", "WorkZonePipelineGetResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GetPipeline.model_construct() + error_messages = [] + match = 0 + # validate data type: MSSharePointPipelineGetResponse + if not isinstance(v, MSSharePointPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MSSharePointPipelineGetResponse`") + else: + match += 1 + # validate data type: S3PipelineGetResponse + if not isinstance(v, S3PipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `S3PipelineGetResponse`") + else: + match += 1 + # validate data type: SFTPPipelineGetResponse + if not isinstance(v, SFTPPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SFTPPipelineGetResponse`") + else: + match += 1 + # validate data type: SDMPipelineGetResponse + if not isinstance(v, SDMPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SDMPipelineGetResponse`") + else: + match += 1 + # validate data type: WorkZonePipelineGetResponse + if not isinstance(v, WorkZonePipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `WorkZonePipelineGetResponse`") + else: + match += 1 + # validate data type: ServiceNowPipelineGetResponse + if not isinstance(v, ServiceNowPipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `ServiceNowPipelineGetResponse`") + else: + match += 1 + # validate data type: GoogleDrivePipelineGetResponse + if not isinstance(v, GoogleDrivePipelineGetResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleDrivePipelineGetResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # use oneOf discriminator to lookup the data type + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) + if not _data_type: + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") + + # check if data type is `GoogleDrivePipelineGetResponse` + if _data_type == "GoogleDrive": + instance.actual_instance = GoogleDrivePipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `MSSharePointPipelineGetResponse` + if _data_type == "MSSharePoint": + instance.actual_instance = MSSharePointPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `S3PipelineGetResponse` + if _data_type == "S3": + instance.actual_instance = S3PipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `SDMPipelineGetResponse` + if _data_type == "SDM": + instance.actual_instance = SDMPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `SFTPPipelineGetResponse` + if _data_type == "SFTP": + instance.actual_instance = SFTPPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `ServiceNowPipelineGetResponse` + if _data_type == "ServiceNow": + instance.actual_instance = ServiceNowPipelineGetResponse.from_json(json_str) + return instance + + # check if data type is `WorkZonePipelineGetResponse` + if _data_type == "WorkZone": + instance.actual_instance = WorkZonePipelineGetResponse.from_json(json_str) + return instance + + # deserialize data into MSSharePointPipelineGetResponse + try: + instance.actual_instance = MSSharePointPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineGetResponse + try: + instance.actual_instance = S3PipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineGetResponse + try: + instance.actual_instance = SFTPPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineGetResponse + try: + instance.actual_instance = SDMPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineGetResponse + try: + instance.actual_instance = WorkZonePipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineGetResponse + try: + instance.actual_instance = ServiceNowPipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineGetResponse + try: + instance.actual_instance = GoogleDrivePipelineGetResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GetPipeline with oneOf schemas: GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, SFTPPipelineGetResponse, ServiceNowPipelineGetResponse, WorkZonePipelineGetResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py new file mode 100644 index 0000000..805806e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_execution_by_id.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelineExecutionById(BaseModel): + """ + GetPipelineExecutionById + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + created_at: Optional[StrictStr] = Field(default=None, serialization_alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[StrictStr] = Field(default=None, serialization_alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + status: Optional[PipelineExecutionStatus] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "createdAt", "modifiedAt", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelineExecutionById from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineExecutionById from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "createdAt": obj.get("createdAt"), + "modifiedAt": obj.get("modifiedAt"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py new file mode 100644 index 0000000..75c79fc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_executions.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_data import PipelineExecutionData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelineExecutions(BaseModel): + """ + GetPipelineExecutions + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [2]}) + resources: Optional[List[PipelineExecutionData]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelineExecutions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineExecutions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [PipelineExecutionData.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py new file mode 100644 index 0000000..e6fd411 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipeline_status.py @@ -0,0 +1,153 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelineStatus(BaseModel): + """ + GetPipelineStatus + """ # noqa: E501 + last_started: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="lastStarted", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + last_completed_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="lastCompletedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00.000Z"]}) + status: Optional[PipelineExecutionStatus] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["lastStarted", "createdAt", "lastCompletedAt", "status"] + + @field_validator('last_started', mode="before") + def last_started_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + @field_validator('created_at', mode="before") + def created_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + @field_validator('last_completed_at', mode="before") + def last_completed_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelineStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['createdAt'] = None + + # set to None if last_completed_at (nullable) is None + # and model_fields_set contains the field + if self.last_completed_at is None and "last_completed_at" in self.model_fields_set: + _dict['lastCompletedAt'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelineStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "lastStarted": obj.get("lastStarted"), + "createdAt": obj.get("createdAt"), + "lastCompletedAt": obj.get("lastCompletedAt"), + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py new file mode 100644 index 0000000..efd6e62 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/get_pipelines.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.get_pipeline import GetPipeline +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GetPipelines(BaseModel): + """ + GetPipelines + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[GetPipeline] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetPipelines from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetPipelines from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [GetPipeline.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py new file mode 100644 index 0000000..a089ad0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_config.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveConfig(BaseModel): + """ + GoogleDriveConfig + """ # noqa: E501 + resource_type: StrictStr = Field(serialization_alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, serialization_alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["resourceType", "resourceId", "includePaths"] + + @field_validator('resource_type') + def resource_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SHARED_FOLDER', 'SHARED_DRIVE']): + raise ValueError("must be one of enum values ('SHARED_FOLDER', 'SHARED_DRIVE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resourceType": obj.get("resourceType"), + "resourceId": obj.get("resourceId"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py new file mode 100644 index 0000000..0bcdf6d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_minimal.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_resource_detail import GoogleDriveResourceDetail +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveConfigurationMinimal(BaseModel): + """ + GoogleDriveConfigurationMinimal + """ # noqa: E501 + google_drive: GoogleDriveResourceDetail = Field(serialization_alias="googleDrive") + __properties: ClassVar[List[str]] = ["googleDrive"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "googleDrive": GoogleDriveResourceDetail.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py new file mode 100644 index 0000000..09dc60a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_configuration_struct.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_config import GoogleDriveConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveConfigurationStruct(BaseModel): + """ + GoogleDriveConfigurationStruct + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + google_drive: GoogleDriveConfig = Field(serialization_alias="googleDrive") + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", serialization_alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + metadata_config_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "googleDrive", "cronExpression", "metadataConfigId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of google_drive + if self.google_drive: + _dict['googleDrive'] = self.google_drive.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "googleDrive": GoogleDriveConfig.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None, + "cronExpression": obj.get("cronExpression"), + "metadataConfigId": obj.get("metadataConfigId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py new file mode 100644 index 0000000..3667fc2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_create_request.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_struct import GoogleDriveConfigurationStruct +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDrivePipelineCreateRequest(BaseModel): + """ + GoogleDrivePipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: Optional[MetaData] = None + configuration: GoogleDriveConfigurationStruct + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['GoogleDrive']): + raise ValueError("must be one of enum values ('GoogleDrive')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": GoogleDriveConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py new file mode 100644 index 0000000..f187586 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_get_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDrivePipelineGetResponse(BaseModel): + """ + GoogleDrivePipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: GoogleDriveConfigurationMinimal + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['GoogleDrive']): + raise ValueError("must be one of enum values ('GoogleDrive')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": GoogleDriveConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py new file mode 100644 index 0000000..357bc53 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_pipeline_minimal_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_configuration_minimal import GoogleDriveConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDrivePipelineMinimalResponse(BaseModel): + """ + GoogleDrivePipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: Optional[GoogleDriveConfigurationMinimal] = None + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['GoogleDrive']): + raise ValueError("must be one of enum values ('GoogleDrive')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDrivePipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": GoogleDriveConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py new file mode 100644 index 0000000..9c360f5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/google_drive_resource_detail.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleDriveResourceDetail(BaseModel): + """ + GoogleDriveResourceDetail + """ # noqa: E501 + resource_type: Optional[StrictStr] = Field(default=None, serialization_alias="resourceType", json_schema_extra={"examples": ["SHARED_DRIVE"]}) + resource_id: Optional[StrictStr] = Field(default=None, serialization_alias="resourceId", json_schema_extra={"examples": ["0AGVUFpXcXc5Uk9PVA"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["resourceType", "resourceId", "includePaths"] + + @field_validator('resource_type') + def resource_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SHARED_FOLDER', 'SHARED_DRIVE']): + raise ValueError("must be one of enum values ('SHARED_FOLDER', 'SHARED_DRIVE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleDriveResourceDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleDriveResourceDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resourceType": obj.get("resourceType"), + "resourceId": obj.get("resourceId"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py new file mode 100644 index 0000000..10e9fc3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/http_validation_error.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.validation_error import ValidationError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class HTTPValidationError(BaseModel): + """ + HTTPValidationError + """ # noqa: E501 + detail: Optional[List[ValidationError]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["detail"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HTTPValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in detail (list) + _items = [] + if self.detail: + for _item_detail in self.detail: + _items.append(_item_detail.to_dict() if _item_detail is not None else None) + _dict['detail'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HTTPValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py new file mode 100644 index 0000000..1a5f716 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_value_list_pair.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class KeyValueListPair(BaseModel): + """ + KeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of KeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of KeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py new file mode 100644 index 0000000..e56a83d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/key_word_retrieval_scoring_configuration.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class KeyWordRetrievalScoringConfiguration(BaseModel): + """ + KeyWordRetrievalScoringConfiguration + """ # noqa: E501 + enabled: Optional[StrictBool] = Field(default=True, description="Enable dense retrieval.") + weight: Optional[StrictInt] = Field(default=1, description="Contribution to final score.") + extract_key_words_from_query: Optional[StrictBool] = Field(default=False, description="Extract Keywords from Query.", serialization_alias="extractKeyWordsFromQuery") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["enabled", "weight", "extractKeyWordsFromQuery"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of KeyWordRetrievalScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if enabled (nullable) is None + # and model_fields_set contains the field + if self.enabled is None and "enabled" in self.model_fields_set: + _dict['enabled'] = None + + # set to None if weight (nullable) is None + # and model_fields_set contains the field + if self.weight is None and "weight" in self.model_fields_set: + _dict['weight'] = None + + # set to None if extract_key_words_from_query (nullable) is None + # and model_fields_set contains the field + if self.extract_key_words_from_query is None and "extract_key_words_from_query" in self.model_fields_set: + _dict['extractKeyWordsFromQuery'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of KeyWordRetrievalScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if "enabled" in obj else True, + "weight": obj.get("weight") if "weight" in obj else 1, + "extractKeyWordsFromQuery": obj.get("extractKeyWordsFromQuery") if "extractKeyWordsFromQuery" in obj else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py new file mode 100644 index 0000000..d6e6183 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LEFT_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class Left(BaseModel): + """ + Left + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Left.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Left with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Left with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Left.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py new file mode 100644 index 0000000..81ae7aa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/left1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LEFT1_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Left1(BaseModel): + """ + Left operand of the boolean expression + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Left1.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Left1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Left1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Left1.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py new file mode 100644 index 0000000..8f3c87b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document import ConfigurationDocument +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListConfigurationDocuments(BaseModel): + """ + ListConfigurationDocuments + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of documents returned.", json_schema_extra={"examples": [1]}) + resources: Optional[List[ConfigurationDocument]] = Field(default=None, description="List of document objects. It will be empty array if no records found.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListConfigurationDocuments from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListConfigurationDocuments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [ConfigurationDocument.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py new file mode 100644 index 0000000..99bfc32 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_configuration_documents_full_details.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.configuration_document_full_details import ConfigurationDocumentFullDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListConfigurationDocumentsFullDetails(BaseModel): + """ + ListConfigurationDocumentsFullDetails + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of documents returned.", json_schema_extra={"examples": [1]}) + resources: Optional[List[ConfigurationDocumentFullDetails]] = Field(default=None, description="List of document objects. It will be empty array if no records found.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListConfigurationDocumentsFullDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListConfigurationDocumentsFullDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [ConfigurationDocumentFullDetails.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py new file mode 100644 index 0000000..0a5f37b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/list_metadata_configurations.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_response import MetadataConfigurationResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ListMetadataConfigurations(BaseModel): + """ + ListMetadataConfigurations + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="Total number of metadata configurations returned.", json_schema_extra={"examples": [1]}) + resources: Optional[List[MetadataConfigurationResponse]] = Field(default=None, description="List of metadata configuration objects. It will be empty array if no records found.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListMetadataConfigurations from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListMetadataConfigurations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [MetadataConfigurationResponse.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py new file mode 100644 index 0000000..3d1fa35 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/location_inner.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"] + +class LocationInner(BaseModel): + """ + LocationInner + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: int + anyof_schema_2_validator: Optional[StrictInt] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "int", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LocationInner.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: int + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into int + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py new file mode 100644 index 0000000..69db704 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/manual_pipeline_trigger.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ManualPipelineTrigger(BaseModel): + """ + ManualPipelineTrigger + """ # noqa: E501 + pipeline_id: Optional[StrictStr] = Field(default=None, serialization_alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + metadata_only: Optional[StrictBool] = Field(default=None, serialization_alias="metadataOnly", json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["pipelineId", "metadataOnly"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ManualPipelineTrigger from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ManualPipelineTrigger from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pipelineId": obj.get("pipelineId"), + "metadataOnly": obj.get("metadataOnly") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py new file mode 100644 index 0000000..c60ece8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker_boosting_inner import MergeStrategyRerankerBoostingInner +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MergeStrategyReranker(BaseModel): + """ + The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult instances. This strategy adds latency, but yields good results. + """ # noqa: E501 + type: Optional[MergeStrategyType] = None + model: Optional[StrictStr] = Field(default='cohere-3.5', description="The RerankerModel to use.") + boosting: Optional[List[MergeStrategyRerankerBoostingInner]] = Field(default=None, description="Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true.") + include_all_meta_data: Optional[StrictBool] = Field(default=False, description="If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk.", serialization_alias="includeAllMetaData") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "model", "boosting", "includeAllMetaData"] + + @field_validator('model') + def model_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['cohere-3.5']): + raise ValueError("must be one of enum values ('cohere-3.5')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MergeStrategyReranker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in boosting (list) + _items = [] + if self.boosting: + for _item_boosting in self.boosting: + _items.append(_item_boosting.to_dict() if _item_boosting is not None else None) + _dict['boosting'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if model (nullable) is None + # and model_fields_set contains the field + if self.model is None and "model" in self.model_fields_set: + _dict['model'] = None + + # set to None if boosting (nullable) is None + # and model_fields_set contains the field + if self.boosting is None and "boosting" in self.model_fields_set: + _dict['boosting'] = None + + # set to None if include_all_meta_data (nullable) is None + # and model_fields_set contains the field + if self.include_all_meta_data is None and "include_all_meta_data" in self.model_fields_set: + _dict['includeAllMetaData'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyReranker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "model": obj.get("model") if "model" in obj else 'cohere-3.5', + "boosting": [MergeStrategyRerankerBoostingInner.from_dict(_item) for _item in obj["boosting"]] if obj.get("boosting") is not None else None, + "includeAllMetaData": obj.get("includeAllMetaData") if "includeAllMetaData" in obj else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py new file mode 100644 index 0000000..63a2d07 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_reranker_boosting_inner.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MergeStrategyRerankerBoostingInner(BaseModel): + """ + MergeStrategyRerankerBoostingInner + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: List[StrictStr] = Field(description="PerFilterSearchResult ID or a new ID for each PostProcessingOperation.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MergeStrategyRerankerBoostingInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyRerankerBoostingInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py new file mode 100644 index 0000000..2ba3499 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_score_reuse.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_type import MergeStrategyType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MergeStrategyScoreReuse(BaseModel): + """ + The MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the scores returned by the downstream retrieval process. It is important that the scores are comparable, meaning they should come from the same embedding model or reranker model. + """ # noqa: E501 + type: Optional[MergeStrategyType] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MergeStrategyScoreReuse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MergeStrategyScoreReuse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py new file mode 100644 index 0000000..85e49ed --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/merge_strategy_type.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MergeStrategyType(str, Enum): + """ + MergeStrategyType + """ + + """ + allowed enum values + """ + RERANKER = 'reranker' + SCOREREUSE = 'scoreReuse' + RECIPROCALRANKFUSION = 'reciprocalRankFusion' + RANDOM = 'random' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MergeStrategyType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py new file mode 100644 index 0000000..7464e90 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/message_response.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MessageResponse(BaseModel): + """ + MessageResponse + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Tenant onboarding request accepted"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py new file mode 100644 index 0000000..685321c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetaData(BaseModel): + """ + MetaData + """ # noqa: E501 + destination: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["destination-name"]}) + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "dataRepositoryMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py new file mode 100644 index 0000000..e423d2c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_data_repository_metadata_inner.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetaDataDataRepositoryMetadataInner(BaseModel): + """ + MetaDataDataRepositoryMetadataInner + """ # noqa: E501 + key: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] + value: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=1024)]], Field(min_length=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaDataDataRepositoryMetadataInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaDataDataRepositoryMetadataInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py new file mode 100644 index 0000000..450d237 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/meta_data_key_value_pair_strict.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetaDataKeyValuePairStrict(BaseModel): + """ + MetaDataKeyValuePairStrict + """ # noqa: E501 + key: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] + value: Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=1024)]], Field(min_length=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetaDataKeyValuePairStrict from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetaDataKeyValuePairStrict from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py new file mode 100644 index 0000000..13c414b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_metadata import MetadataConfigurationMetadata +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_struct import MetadataConfigurationStruct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfiguration(BaseModel): + """ + MetadataConfiguration + """ # noqa: E501 + type: StrictStr + configuration: MetadataConfigurationStruct + metadata: Optional[MetadataConfigurationMetadata] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['metadata']): + raise ValueError("must be one of enum values ('metadata')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": MetadataConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetadataConfigurationMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py new file mode 100644 index 0000000..011051f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationMetadata(BaseModel): + """ + MetadataConfigurationMetadata + """ # noqa: E501 + data_repository_metadata: List[MetaDataKeyValuePairStrict] = Field(serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataKeyValuePairStrict.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py new file mode 100644 index 0000000..6d48a49 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationRequest(BaseModel): + """ + MetadataConfigurationRequest + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be gen_ai_hub.document_grounding_generation.generated.") + name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") + destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", serialization_alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", serialization_alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels"] + + @field_validator('data_repository_type') + def data_repository_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint', 'S3', 'SFTP']): + raise ValueError("must be one of enum values ('MSSharePoint', 'S3', 'SFTP')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in labels (list) + _items = [] + if self.labels: + for _item_labels in self.labels: + _items.append(_item_labels.to_dict() if _item_labels is not None else None) + _dict['labels'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "destinationName": obj.get("destinationName"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "includePaths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py new file mode 100644 index 0000000..14c27d5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_request_labels_inner.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationRequestLabelsInner(BaseModel): + """ + MetadataConfigurationRequestLabelsInner + """ # noqa: E501 + key: StrictStr = Field(json_schema_extra={"examples": ["department"]}) + value: StrictStr = Field(json_schema_extra={"examples": ["finance"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequestLabelsInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationRequestLabelsInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py new file mode 100644 index 0000000..a9b2dec --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_response.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.metadata_configuration_request_labels_inner import MetadataConfigurationRequestLabelsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationResponse(BaseModel): + """ + MetadataConfigurationResponse + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid UUID. If not provided, a new UUID will be gen_ai_hub.document_grounding_generation.generated.") + name: Optional[StrictStr] = Field(default=None, description="If provided, must be a valid string. If not provided, will be same as id.") + destination_name: StrictStr = Field(description="Contains destination name containing credentials to access the data repository.", serialization_alias="destinationName") + data_repository_type: StrictStr = Field(description="The data repository type for which this configuration is being created.", serialization_alias="dataRepositoryType", json_schema_extra={"examples": ["MSSharePoint"]}) + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/site/documents", "/shared/team"]]}) + labels: Optional[List[MetadataConfigurationRequestLabelsInner]] = None + enumeration_status: Optional[StrictStr] = Field(default=None, description="Status of metadata enumeration for the configuration.", serialization_alias="enumerationStatus") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "destinationName", "dataRepositoryType", "includePaths", "labels", "enumerationStatus"] + + @field_validator('data_repository_type') + def data_repository_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint', 'S3', 'SFTP']): + raise ValueError("must be one of enum values ('MSSharePoint', 'S3', 'SFTP')") + return value + + @field_validator('enumeration_status') + def enumeration_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['NEW', 'IN_PROGRESS', 'COMPLETED', 'ERROR']): + raise ValueError("must be one of enum values ('NEW', 'IN_PROGRESS', 'COMPLETED', 'ERROR')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in labels (list) + _items = [] + if self.labels: + for _item_labels in self.labels: + _items.append(_item_labels.to_dict() if _item_labels is not None else None) + _dict['labels'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if enumeration_status (nullable) is None + # and model_fields_set contains the field + if self.enumeration_status is None and "enumeration_status" in self.model_fields_set: + _dict['enumerationStatus'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "destinationName": obj.get("destinationName"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "includePaths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None, + "enumerationStatus": obj.get("enumerationStatus") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py new file mode 100644 index 0000000..c5079a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_configuration_struct.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataConfigurationStruct(BaseModel): + """ + MetadataConfigurationStruct + """ # noqa: E501 + metadata_config_id: Annotated[str, Field(min_length=1, strict=True)] = Field(serialization_alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", serialization_alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["metadataConfigId", "cronExpression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadataConfigId": obj.get("metadataConfigId"), + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py new file mode 100644 index 0000000..2c4670f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_item.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataItem(BaseModel): + """ + MetadataItem + """ # noqa: E501 + id: UUID = Field(description="ID of collection") + metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="List of metadata of the collections or documents or chunks") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py new file mode 100644 index 0000000..5b0e1a2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_key_update.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation import MetadataOperation +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataKeyUpdate(BaseModel): + """ + MetadataKeyUpdate + """ # noqa: E501 + key: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Key to update") + operations: Optional[List[MetadataOperation]] = Field(default=None, description="Update operation executed for the key") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "operations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataKeyUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in operations (list) + _items = [] + if self.operations: + for _item_operations in self.operations: + _items.append(_item_operations.to_dict() if _item_operations is not None else None) + _dict['operations'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if operations (nullable) is None + # and model_fields_set contains the field + if self.operations is None and "operations" in self.model_fields_set: + _dict['operations'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataKeyUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "operations": [MetadataOperation.from_dict(_item) for _item in obj["operations"]] if obj.get("operations") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py new file mode 100644 index 0000000..6d44f8a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_operation_enum import MetadataOperationEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataOperation(BaseModel): + """ + MetadataOperation + """ # noqa: E501 + op: MetadataOperationEnum + values: Optional[List[StrictStr]] = Field(default=None, description="List of values to update.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["op", "values"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataOperation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if values (nullable) is None + # and model_fields_set contains the field + if self.values is None and "values" in self.model_fields_set: + _dict['values'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "op": obj.get("op"), + "values": obj.get("values") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py new file mode 100644 index 0000000..ef99f22 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_operation_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class MetadataOperationEnum(str, Enum): + """ + MetadataOperationEnum + """ + + """ + allowed enum values + """ + ADD = 'add' + REMOVE = 'remove' + REPLACE = 'replace' + DELETE_KEY = 'delete_key' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of MetadataOperationEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py new file mode 100644 index 0000000..b492b49 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_response.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.metadata_item import MetadataItem +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataResponse(BaseModel): + """ + MetadataResponse + """ # noqa: E501 + current_metadata: Optional[List[MetadataItem]] = Field(default=None, description="List of metadata after updates.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["current_metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in current_metadata (list) + _items = [] + if self.current_metadata: + for _item_current_metadata in self.current_metadata: + _items.append(_item_current_metadata.to_dict() if _item_current_metadata is not None else None) + _dict['current_metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if current_metadata (nullable) is None + # and model_fields_set contains the field + if self.current_metadata is None and "current_metadata" in self.model_fields_set: + _dict['current_metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "current_metadata": [MetadataItem.from_dict(_item) for _item in obj["current_metadata"]] if obj.get("current_metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py new file mode 100644 index 0000000..88b42b5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_update_item.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.metadata_key_update import MetadataKeyUpdate +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataUpdateItem(BaseModel): + """ + MetadataUpdateItem + """ # noqa: E501 + ids: List[UUID] = Field(description="List of collection or document or chunk ids for which the metadata should be updated") + metadata_updates: List[MetadataKeyUpdate] = Field(description="List of metadata updates for the given resource ids", serialization_alias="metadataUpdates") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ids", "metadataUpdates"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataUpdateItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata_updates (list) + _items = [] + if self.metadata_updates: + for _item_metadata_updates in self.metadata_updates: + _items.append(_item_metadata_updates.to_dict() if _item_metadata_updates is not None else None) + _dict['metadataUpdates'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataUpdateItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "metadataUpdates": [MetadataKeyUpdate.from_dict(_item) for _item in obj["metadataUpdates"]] if obj.get("metadataUpdates") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py new file mode 100644 index 0000000..99b4f71 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/metadata_updates.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.metadata_update_item import MetadataUpdateItem +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MetadataUpdates(BaseModel): + """ + MetadataUpdates + """ # noqa: E501 + updates: List[MetadataUpdateItem] = Field(description="List of metadata updates.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["updates"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MetadataUpdates from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in updates (list) + _items = [] + if self.updates: + for _item_updates in self.updates: + _items.append(_item_updates.to_dict() if _item_updates is not None else None) + _dict['updates'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MetadataUpdates from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "updates": [MetadataUpdateItem.from_dict(_item) for _item in obj["updates"]] if obj.get("updates") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py new file mode 100644 index 0000000..719d672 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config import SharePointConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointConfiguration(BaseModel): + """ + MSSharePointConfiguration + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) + share_point: SharePointConfig = Field(serialization_alias="sharePoint") + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sharePoint", "cronExpression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sharePoint": SharePointConfig.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py new file mode 100644 index 0000000..59e1f6c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_get_response.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_config_get_response import SharePointConfigGetResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointConfigurationGetResponse(BaseModel): + """ + MSSharePointConfigurationGetResponse + """ # noqa: E501 + destination: StrictStr + share_point: SharePointConfigGetResponse = Field(serialization_alias="sharePoint") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sharePoint"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sharePoint": SharePointConfigGetResponse.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py new file mode 100644 index 0000000..4465c00 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_configuration_minimal.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_detail import SharePointSiteDetail +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointConfigurationMinimal(BaseModel): + """ + MSSharePointConfigurationMinimal + """ # noqa: E501 + share_point: SharePointSiteDetail = Field(serialization_alias="sharePoint") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sharePoint"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of share_point + if self.share_point: + _dict['sharePoint'] = self.share_point.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sharePoint": SharePointSiteDetail.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py new file mode 100644 index 0000000..c729668 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_create_request.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration import MSSharePointConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointPipelineCreateRequest(BaseModel): + """ + MSSharePointPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + configuration: MSSharePointConfiguration + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint']): + raise ValueError("must be one of enum values ('MSSharePoint')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": MSSharePointConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py new file mode 100644 index 0000000..84aa819 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_get_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_get_response import MSSharePointConfigurationGetResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointPipelineGetResponse(BaseModel): + """ + MSSharePointPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: MSSharePointConfigurationGetResponse + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint']): + raise ValueError("must be one of enum values ('MSSharePoint')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": MSSharePointConfigurationGetResponse.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py new file mode 100644 index 0000000..385c21c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/ms_share_point_pipeline_minimal_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_configuration_minimal import MSSharePointConfigurationMinimal +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MSSharePointPipelineMinimalResponse(BaseModel): + """ + MSSharePointPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: MSSharePointConfigurationMinimal + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MSSharePoint']): + raise ValueError("must be one of enum values ('MSSharePoint')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MSSharePointPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MSSharePointPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": MSSharePointConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py new file mode 100644 index 0000000..404cf1a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_configuration import PatchPipelineConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.patch_pipeline_metadata import PatchPipelineMetadata +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PatchPipeline(BaseModel): + """ + PatchPipeline + """ # noqa: E501 + metadata: Optional[PatchPipelineMetadata] = None + configuration: Optional[PatchPipelineConfiguration] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["metadata", "configuration"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchPipeline from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipeline from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": PatchPipelineMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": PatchPipelineConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py new file mode 100644 index 0000000..7f57778 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_configuration.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PatchPipelineConfiguration(BaseModel): + """ + PatchPipelineConfiguration + """ # noqa: E501 + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["cronExpression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchPipelineConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipelineConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py new file mode 100644 index 0000000..7d4a412 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/patch_pipeline_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PatchPipelineMetadata(BaseModel): + """ + PatchPipelineMetadata + """ # noqa: E501 + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Patch for metadata happens at key level. Value for the specific key would be inserted/replaced.", serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchPipelineMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchPipelineMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py new file mode 100644 index 0000000..24778e1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PerFilterSearchResult(BaseModel): + """ + PerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(serialization_alias="filterId") + results: List[DocumentsChunk] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py new file mode 100644 index 0000000..86628c8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_error.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PerFilterSearchResultError(BaseModel): + """ + Error message if any. + """ # noqa: E501 + message: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerFilterSearchResultError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResultError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") if obj.get("message") is not None else 'Unknown Error Occurred' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py new file mode 100644 index 0000000..7ef91f3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/per_filter_search_result_with_error.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_error import PerFilterSearchResultError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PerFilterSearchResultWithError(BaseModel): + """ + PerFilterSearchResultWithError + """ # noqa: E501 + filter_id: StrictStr = Field(serialization_alias="filterId") + error: Optional[PerFilterSearchResultError] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filterId", "error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PerFilterSearchResultWithError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PerFilterSearchResultWithError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "error": PerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py new file mode 100644 index 0000000..5158f44 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_document_response.py @@ -0,0 +1,147 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.document_status import DocumentStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PipelineDocumentResponse(BaseModel): + """ + PipelineDocumentResponse + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + status: Optional[DocumentStatus] = None + view_location: Optional[StrictStr] = Field(default=None, serialization_alias="viewLocation", json_schema_extra={"examples": ["location"]}) + download_location: Optional[StrictStr] = Field(default=None, serialization_alias="downloadLocation", json_schema_extra={"examples": ["location"]}) + absolute_url: Optional[StrictStr] = Field(default=None, serialization_alias="absoluteUrl") + title: Optional[StrictStr] = None + metadata_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataId") + created_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="createdTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + last_updated_timestamp: Optional[StrictStr] = Field(default=None, serialization_alias="lastUpdatedTimestamp", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "viewLocation", "downloadLocation", "absoluteUrl", "title", "metadataId", "createdTimestamp", "lastUpdatedTimestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PipelineDocumentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if view_location (nullable) is None + # and model_fields_set contains the field + if self.view_location is None and "view_location" in self.model_fields_set: + _dict['viewLocation'] = None + + # set to None if download_location (nullable) is None + # and model_fields_set contains the field + if self.download_location is None and "download_location" in self.model_fields_set: + _dict['downloadLocation'] = None + + # set to None if absolute_url (nullable) is None + # and model_fields_set contains the field + if self.absolute_url is None and "absolute_url" in self.model_fields_set: + _dict['absoluteUrl'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if metadata_id (nullable) is None + # and model_fields_set contains the field + if self.metadata_id is None and "metadata_id" in self.model_fields_set: + _dict['metadataId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineDocumentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "viewLocation": obj.get("viewLocation"), + "downloadLocation": obj.get("downloadLocation"), + "absoluteUrl": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadataId": obj.get("metadataId"), + "createdTimestamp": obj.get("createdTimestamp"), + "lastUpdatedTimestamp": obj.get("lastUpdatedTimestamp") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py new file mode 100644 index 0000000..688b57e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_data.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PipelineExecutionData(BaseModel): + """ + PipelineExecutionData + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] = None + created_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="createdAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + modified_at: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, serialization_alias="modifiedAt", json_schema_extra={"examples": ["2024-02-15T12:45:00Z"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "createdAt", "modifiedAt"] + + @field_validator('created_at', mode="before") + def created_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + @field_validator('modified_at', mode="before") + def modified_at_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if isinstance(value, str) and not re.match(r"^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$", value): + raise ValueError(r"must validate the regular expression /^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PipelineExecutionData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['createdAt'] = None + + # set to None if modified_at (nullable) is None + # and model_fields_set contains the field + if self.modified_at is None and "modified_at" in self.model_fields_set: + _dict['modifiedAt'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineExecutionData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "createdAt": obj.get("createdAt"), + "modifiedAt": obj.get("modifiedAt") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py new file mode 100644 index 0000000..1b7eae7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_execution_status.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class PipelineExecutionStatus(str, Enum): + """ + PipelineExecutionStatus + """ + + """ + allowed enum values + """ + NEW = 'NEW' + CREATING = 'CREATING' + CREATED = 'CREATED' + CREATION_FAILED = 'CREATION_FAILED' + UNKNOWN = 'UNKNOWN' + INPROGRESS = 'INPROGRESS' + FINISHED = 'FINISHED' + FINISHEDWITHERRORS = 'FINISHEDWITHERRORS' + TIMEOUT = 'TIMEOUT' + DELETION_INPROGRESS = 'DELETION_INPROGRESS' + DELETION_FAILED = 'DELETION_FAILED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PipelineExecutionStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py new file mode 100644 index 0000000..66f260e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_id.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PipelineId(BaseModel): + """ + PipelineId + """ # noqa: E501 + pipeline_id: Optional[StrictStr] = Field(default=None, serialization_alias="pipelineId", json_schema_extra={"examples": ["uuid"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["pipelineId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PipelineId from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PipelineId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pipelineId": obj.get("pipelineId") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py new file mode 100644 index 0000000..9ef685f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/pipeline_minimal_response.py @@ -0,0 +1,251 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.ms_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.s3_pipeline_minimal_response import S3PipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sdm_pipeline_minimal_response import SDMPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.sftp_pipeline_minimal_response import SFTPPipelineMinimalResponse +from gen_ai_hub.document_grounding_generation.generated.models.work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +PIPELINEMINIMALRESPONSE_ONE_OF_SCHEMAS = ["GoogleDrivePipelineMinimalResponse", "MSSharePointPipelineMinimalResponse", "S3PipelineMinimalResponse", "SDMPipelineMinimalResponse", "SFTPPipelineMinimalResponse", "ServiceNowPipelineMinimalResponse", "WorkZonePipelineMinimalResponse"] + +class PipelineMinimalResponse(BaseModel): + """ + PipelineMinimalResponse + """ + # data type: MSSharePointPipelineMinimalResponse + oneof_schema_1_validator: Optional[MSSharePointPipelineMinimalResponse] = None + # data type: S3PipelineMinimalResponse + oneof_schema_2_validator: Optional[S3PipelineMinimalResponse] = None + # data type: SFTPPipelineMinimalResponse + oneof_schema_3_validator: Optional[SFTPPipelineMinimalResponse] = None + # data type: SDMPipelineMinimalResponse + oneof_schema_4_validator: Optional[SDMPipelineMinimalResponse] = None + # data type: WorkZonePipelineMinimalResponse + oneof_schema_5_validator: Optional[WorkZonePipelineMinimalResponse] = None + # data type: ServiceNowPipelineMinimalResponse + oneof_schema_6_validator: Optional[ServiceNowPipelineMinimalResponse] = None + # data type: GoogleDrivePipelineMinimalResponse + oneof_schema_7_validator: Optional[GoogleDrivePipelineMinimalResponse] = None + actual_instance: Optional[Union[GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse]] = None + one_of_schemas: Set[str] = { "GoogleDrivePipelineMinimalResponse", "MSSharePointPipelineMinimalResponse", "S3PipelineMinimalResponse", "SDMPipelineMinimalResponse", "SFTPPipelineMinimalResponse", "ServiceNowPipelineMinimalResponse", "WorkZonePipelineMinimalResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = PipelineMinimalResponse.model_construct() + error_messages = [] + match = 0 + # validate data type: MSSharePointPipelineMinimalResponse + if not isinstance(v, MSSharePointPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MSSharePointPipelineMinimalResponse`") + else: + match += 1 + # validate data type: S3PipelineMinimalResponse + if not isinstance(v, S3PipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `S3PipelineMinimalResponse`") + else: + match += 1 + # validate data type: SFTPPipelineMinimalResponse + if not isinstance(v, SFTPPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SFTPPipelineMinimalResponse`") + else: + match += 1 + # validate data type: SDMPipelineMinimalResponse + if not isinstance(v, SDMPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SDMPipelineMinimalResponse`") + else: + match += 1 + # validate data type: WorkZonePipelineMinimalResponse + if not isinstance(v, WorkZonePipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `WorkZonePipelineMinimalResponse`") + else: + match += 1 + # validate data type: ServiceNowPipelineMinimalResponse + if not isinstance(v, ServiceNowPipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `ServiceNowPipelineMinimalResponse`") + else: + match += 1 + # validate data type: GoogleDrivePipelineMinimalResponse + if not isinstance(v, GoogleDrivePipelineMinimalResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleDrivePipelineMinimalResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # use oneOf discriminator to lookup the data type + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) + if not _data_type: + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") + + # check if data type is `GoogleDrivePipelineMinimalResponse` + if _data_type == "GoogleDrive": + instance.actual_instance = GoogleDrivePipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `MSSharePointPipelineMinimalResponse` + if _data_type == "MSSharePoint": + instance.actual_instance = MSSharePointPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `S3PipelineMinimalResponse` + if _data_type == "S3": + instance.actual_instance = S3PipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `SDMPipelineMinimalResponse` + if _data_type == "SDM": + instance.actual_instance = SDMPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `SFTPPipelineMinimalResponse` + if _data_type == "SFTP": + instance.actual_instance = SFTPPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `ServiceNowPipelineMinimalResponse` + if _data_type == "ServiceNow": + instance.actual_instance = ServiceNowPipelineMinimalResponse.from_json(json_str) + return instance + + # check if data type is `WorkZonePipelineMinimalResponse` + if _data_type == "WorkZone": + instance.actual_instance = WorkZonePipelineMinimalResponse.from_json(json_str) + return instance + + # deserialize data into MSSharePointPipelineMinimalResponse + try: + instance.actual_instance = MSSharePointPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into S3PipelineMinimalResponse + try: + instance.actual_instance = S3PipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SFTPPipelineMinimalResponse + try: + instance.actual_instance = SFTPPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SDMPipelineMinimalResponse + try: + instance.actual_instance = SDMPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WorkZonePipelineMinimalResponse + try: + instance.actual_instance = WorkZonePipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ServiceNowPipelineMinimalResponse + try: + instance.actual_instance = ServiceNowPipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GoogleDrivePipelineMinimalResponse + try: + instance.actual_instance = GoogleDrivePipelineMinimalResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into PipelineMinimalResponse with oneOf schemas: GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, SFTPPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, WorkZonePipelineMinimalResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py new file mode 100644 index 0000000..0fd6625 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_object_reference.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PostProcessingObjectReference(BaseModel): + """ + PostProcessingObjectReference + """ # noqa: E501 + id: Optional[StrictStr] = Field(default='6d3eeafd-f3db-4e8e-949a-0e40e50eab64', description="PerFilterSearchResult ID or PostProcessingOperation ID.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PostProcessingObjectReference from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostProcessingObjectReference from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else '6d3eeafd-f3db-4e8e-949a-0e40e50eab64' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py new file mode 100644 index 0000000..b131ccc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/post_processing_operation.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.strategy import Strategy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PostProcessingOperation(BaseModel): + """ + PostProcessingOperation + """ # noqa: E501 + id: Optional[StrictStr] = Field(default='ae9eee48-4671-4321-a3e5-640adaaf26ae', description="New ID for each PostProcessingOperation.") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", serialization_alias="maxChunkCount") + strategy: Strategy + inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PostProcessingOperation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of strategy + if self.strategy: + _dict['strategy'] = self.strategy.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in inputs (list) + _items = [] + if self.inputs: + for _item_inputs in self.inputs: + _items.append(_item_inputs.to_dict() if _item_inputs is not None else None) + _dict['inputs'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostProcessingOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else 'ae9eee48-4671-4321-a3e5-640adaaf26ae', + "maxChunkCount": obj.get("maxChunkCount") if "maxChunkCount" in obj else 5, + "strategy": Strategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, + "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +# TODO: Rewrite to not use raise_errors +PostProcessingOperation.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py new file mode 100644 index 0000000..fb68357 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result import PerFilterSearchResult +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER_ANY_OF_SCHEMAS = ["PerFilterSearchResult"] + +class ResultsInner(BaseModel): + """ + ResultsInner + """ + + # data type: PerFilterSearchResult + anyof_schema_1_validator: Optional[PerFilterSearchResult] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[PerFilterSearchResult]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "PerFilterSearchResult" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner.model_construct() + error_messages = [] + # validate data type: PerFilterSearchResult + if not isinstance(v, PerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `PerFilterSearchResult`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner with anyOf schemas: PerFilterSearchResult. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[PerFilterSearchResult] = None + try: + instance.actual_instance = PerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner with anyOf schemas: PerFilterSearchResult. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PerFilterSearchResult]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py new file mode 100644 index 0000000..68e9338 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner1.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result import RetrievalPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER1_ANY_OF_SCHEMAS = ["RetrievalPerFilterSearchResult", "RetrievalPerFilterSearchResultWithError"] + +class ResultsInner1(BaseModel): + """ + ResultsInner1 + """ + + # data type: RetrievalPerFilterSearchResult + anyof_schema_1_validator: Optional[RetrievalPerFilterSearchResult] = None + # data type: RetrievalPerFilterSearchResultWithError + anyof_schema_2_validator: Optional[RetrievalPerFilterSearchResultWithError] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalPerFilterSearchResult", "RetrievalPerFilterSearchResultWithError" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner1.model_construct() + error_messages = [] + # validate data type: RetrievalPerFilterSearchResult + if not isinstance(v, RetrievalPerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalPerFilterSearchResult`") + else: + return v + + # validate data type: RetrievalPerFilterSearchResultWithError + if not isinstance(v, RetrievalPerFilterSearchResultWithError): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalPerFilterSearchResultWithError`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner1 with anyOf schemas: RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalPerFilterSearchResult] = None + try: + instance.actual_instance = RetrievalPerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalPerFilterSearchResultWithError] = None + try: + instance.actual_instance = RetrievalPerFilterSearchResultWithError.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner1 with anyOf schemas: RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py new file mode 100644 index 0000000..fad5461 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/results_inner2.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_per_filter_search_result import DataRepositoryPerFilterSearchResult +from gen_ai_hub.document_grounding_generation.generated.models.per_filter_search_result_with_error import PerFilterSearchResultWithError +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RESULTSINNER2_ANY_OF_SCHEMAS = ["DataRepositoryPerFilterSearchResult", "PerFilterSearchResultWithError"] + +class ResultsInner2(BaseModel): + """ + ResultsInner2 + """ + + # data type: DataRepositoryPerFilterSearchResult + anyof_schema_1_validator: Optional[DataRepositoryPerFilterSearchResult] = None + # data type: PerFilterSearchResultWithError + anyof_schema_2_validator: Optional[PerFilterSearchResultWithError] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "DataRepositoryPerFilterSearchResult", "PerFilterSearchResultWithError" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ResultsInner2.model_construct() + error_messages = [] + # validate data type: DataRepositoryPerFilterSearchResult + if not isinstance(v, DataRepositoryPerFilterSearchResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `DataRepositoryPerFilterSearchResult`") + else: + return v + + # validate data type: PerFilterSearchResultWithError + if not isinstance(v, PerFilterSearchResultWithError): + error_messages.append(f"Error! Input type `{type(v)}` is not `PerFilterSearchResultWithError`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ResultsInner2 with anyOf schemas: DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[DataRepositoryPerFilterSearchResult] = None + try: + instance.actual_instance = DataRepositoryPerFilterSearchResult.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[PerFilterSearchResultWithError] = None + try: + instance.actual_instance = PerFilterSearchResultWithError.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ResultsInner2 with anyOf schemas: DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], DataRepositoryPerFilterSearchResult, PerFilterSearchResultWithError]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py new file mode 100644 index 0000000..72ab68e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_binary_boolean_filter.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalBinaryBooleanFilter(BaseModel): + """ + RetrievalBinaryBooleanFilter + """ # noqa: E501 + operator: StrictStr + left: Left + right: Right + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["operator", "left", "right"] + + @field_validator('operator') + def operator_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['and', 'or']): + raise ValueError("must be one of enum values ('and', 'or')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalBinaryBooleanFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of left + if self.left: + _dict['left'] = self.left.to_dict() + # override the default output from pydantic by calling `to_dict()` of right + if self.right: + _dict['right'] = self.right.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalBinaryBooleanFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "operator": obj.get("operator"), + "left": Left.from_dict(obj["left"]) if obj.get("left") is not None else None, + "right": Right.from_dict(obj["right"]) if obj.get("right") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +from gen_ai_hub.document_grounding_generation.generated.models.left import Left +from gen_ai_hub.document_grounding_generation.generated.models.right import Right +# TODO: Rewrite to not use raise_errors +RetrievalBinaryBooleanFilter.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py new file mode 100644 index 0000000..bed4a27 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_chunk.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.score import Score +from gen_ai_hub.document_grounding_generation.generated.models.search_scores import SearchScores +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalChunk(BaseModel): + """ + RetrievalChunk + """ # noqa: E501 + id: StrictStr + content: StrictStr + metadata: Optional[List[RetrievalKeyValueListPair]] = None + search_scores: Optional[SearchScores] = Field(default=None, serialization_alias="searchScores") + post_processing_score: Optional[Score] = Field(default=None, serialization_alias="postProcessingScore") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "content", "metadata", "searchScores", "postProcessingScore"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # override the default output from pydantic by calling `to_dict()` of search_scores + if self.search_scores: + _dict['searchScores'] = self.search_scores.to_dict() + # override the default output from pydantic by calling `to_dict()` of post_processing_score + if self.post_processing_score: + _dict['postProcessingScore'] = self.post_processing_score.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "searchScores": SearchScores.from_dict(obj["searchScores"]) if obj.get("searchScores") is not None else None, + "postProcessingScore": Score.from_dict(obj["postProcessingScore"]) if obj.get("postProcessingScore") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py new file mode 100644 index 0000000..047ed72 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_data_repository_search_result.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_with_documents import DataRepositoryWithDocuments +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalDataRepositorySearchResult(BaseModel): + """ + RetrievalDataRepositorySearchResult + """ # noqa: E501 + data_repository: DataRepositoryWithDocuments = Field(serialization_alias="dataRepository") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dataRepository"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalDataRepositorySearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data_repository + if self.data_repository: + _dict['dataRepository'] = self.data_repository.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalDataRepositorySearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepository": DataRepositoryWithDocuments.from_dict(obj["dataRepository"]) if obj.get("dataRepository") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py new file mode 100644 index 0000000..3253ebf --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_document_key_value_list_pair.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalDocumentKeyValueListPair(BaseModel): + """ + RetrievalDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, serialization_alias="matchMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py new file mode 100644 index 0000000..56b36ad --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_key_value_list_pair.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalKeyValueListPair(BaseModel): + """ + RetrievalKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py new file mode 100644 index 0000000..79d19a8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalPerFilterSearchResult(BaseModel): + """ + RetrievalPerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(serialization_alias="filterId") + results: Optional[List[RetrievalDataRepositorySearchResult]] = Field(default=None, description="List of returned results.") + remote_grounding_name: Optional[StrictStr] = Field(default=None, description="Friendly Destination Name of remote instance (grounding.name). Only present if dataRepositoryType = remote:dg.", serialization_alias="remoteGroundingName") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filterId", "results", "remoteGroundingName"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if remote_grounding_name (nullable) is None + # and model_fields_set contains the field + if self.remote_grounding_name is None and "remote_grounding_name" in self.model_fields_set: + _dict['remoteGroundingName'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [RetrievalDataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "remoteGroundingName": obj.get("remoteGroundingName") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py new file mode 100644 index 0000000..6f71292 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_error.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalPerFilterSearchResultError(BaseModel): + """ + Error message if any. + """ # noqa: E501 + message: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") if obj.get("message") is not None else 'Unknown Error Occurred' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py new file mode 100644 index 0000000..2f8da51 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_per_filter_search_result_with_error.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalPerFilterSearchResultWithError(BaseModel): + """ + RetrievalPerFilterSearchResultWithError + """ # noqa: E501 + filter_id: StrictStr = Field(serialization_alias="filterId") + error: Optional[RetrievalPerFilterSearchResultError] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filterId", "error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultWithError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalPerFilterSearchResultWithError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "error": RetrievalPerFilterSearchResultError.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py new file mode 100644 index 0000000..1cf9bb9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_scoped_key_value_list_pair.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalScopedKeyValueListPair(BaseModel): + """ + RetrievalScopedKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: Optional[StrictStr] = 'document' + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['repository', 'document', 'chunk']): + raise ValueError("must be one of enum values ('repository', 'document', 'chunk')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalScopedKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalScopedKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") if obj.get("scope") is not None else 'document' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py new file mode 100644 index 0000000..a606bc6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_configuration.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchConfiguration(BaseModel): + """ + RetrievalSearchConfiguration + """ # noqa: E501 + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", serialization_alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", serialization_alias="maxDocumentCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py new file mode 100644 index 0000000..d2fade0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_document_key_value_list_pair.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchDocumentKeyValueListPair(BaseModel): + """ + RetrievalSearchDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + select_mode: Optional[List[RetrievalSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", serialization_alias="selectMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if select_mode (nullable) is None + # and model_fields_set contains the field + if self.select_mode is None and "select_mode" in self.model_fields_set: + _dict['selectMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py new file mode 100644 index 0000000..c63c1b6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_filter.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchFilter(BaseModel): + """ + Limit scope of search to certain DataRepositories, Documents or Chunks. + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this RetrievalSearchFilter - unique per request.") + search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, serialization_alias="searchConfiguration") + data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", serialization_alias="dataRepositories") + data_repository_type: DataRepositoryType = Field(serialization_alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", serialization_alias="remoteName") + data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", serialization_alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of search_configuration + if self.search_configuration: + _dict['searchConfiguration'] = self.search_configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if search_configuration (nullable) is None + # and model_fields_set contains the field + if self.search_configuration is None and "search_configuration" in self.model_fields_set: + _dict['searchConfiguration'] = None + + # set to None if remote_name (nullable) is None + # and model_fields_set contains the field + if self.remote_name is None and "remote_name" in self.model_fields_set: + _dict['remoteName'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "searchConfiguration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "dataRepositories": obj.get("dataRepositories"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "remoteName": obj.get("remoteName"), + "dataRepositoryMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py new file mode 100644 index 0000000..d4472a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filters_inner import FiltersInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner import RetrievalSearchInputPostProcessingInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchInput(BaseModel): + """ + RetrievalSearchInput + """ # noqa: E501 + query: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(description="Query string") + filters: List[FiltersInner] + post_processing: Optional[List[RetrievalSearchInputPostProcessingInner]] = Field(default=None, description="List of operations to be performed across PerFilterSearchResults.", serialization_alias="postProcessing") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["query", "filters", "postProcessing"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchInput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item_filters in self.filters: + _items.append(_item_filters.to_dict() if _item_filters is not None else None) + _dict['filters'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in post_processing (list) + _items = [] + if self.post_processing: + for _item_post_processing in self.post_processing: + _items.append(_item_post_processing.to_dict() if _item_post_processing is not None else None) + _dict['postProcessing'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if query (nullable) is None + # and model_fields_set contains the field + if self.query is None and "query" in self.model_fields_set: + _dict['query'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "filters": [FiltersInner.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None, + "postProcessing": [RetrievalSearchInputPostProcessingInner.from_dict(_item) for _item in obj["postProcessing"]] if obj.get("postProcessing") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py new file mode 100644 index 0000000..5164f45 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_inputs_inner import RetrievalSearchInputPostProcessingInnerInputsInner +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_input_post_processing_inner_strategy import RetrievalSearchInputPostProcessingInnerStrategy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchInputPostProcessingInner(BaseModel): + """ + RetrievalSearchInputPostProcessingInner + """ # noqa: E501 + id: Optional[StrictStr] = Field(default='ae9eee48-4671-4321-a3e5-640adaaf26ae', description="New ID for each PostProcessingOperation.") + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=5, description="Maximum number of chunks to be retained in final PerSearchFilterResult.", serialization_alias="maxChunkCount") + strategy: RetrievalSearchInputPostProcessingInnerStrategy + inputs: List[RetrievalSearchInputPostProcessingInnerInputsInner] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "maxChunkCount", "strategy", "inputs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchInputPostProcessingInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of strategy + if self.strategy: + _dict['strategy'] = self.strategy.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in inputs (list) + _items = [] + if self.inputs: + for _item_inputs in self.inputs: + _items.append(_item_inputs.to_dict() if _item_inputs is not None else None) + _dict['inputs'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchInputPostProcessingInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") if "id" in obj else 'ae9eee48-4671-4321-a3e5-640adaaf26ae', + "maxChunkCount": obj.get("maxChunkCount") if "maxChunkCount" in obj else 5, + "strategy": RetrievalSearchInputPostProcessingInnerStrategy.from_dict(obj["strategy"]) if obj.get("strategy") is not None else None, + "inputs": [RetrievalSearchInputPostProcessingInnerInputsInner.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py new file mode 100644 index 0000000..1383487 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_inputs_inner.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_object_reference import PostProcessingObjectReference +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RETRIEVALSEARCHINPUTPOSTPROCESSINGINNERINPUTSINNER_ONE_OF_SCHEMAS = ["PostProcessingObjectReference", "PostProcessingOperation"] + +class RetrievalSearchInputPostProcessingInnerInputsInner(BaseModel): + """ + RetrievalSearchInputPostProcessingInnerInputsInner + """ + # data type: PostProcessingObjectReference + oneof_schema_1_validator: Optional[PostProcessingObjectReference] = None + # data type: PostProcessingOperation + oneof_schema_2_validator: Optional[PostProcessingOperation] = None + actual_instance: Optional[Union[PostProcessingObjectReference, PostProcessingOperation]] = None + one_of_schemas: Set[str] = { "PostProcessingObjectReference", "PostProcessingOperation" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RetrievalSearchInputPostProcessingInnerInputsInner.model_construct() + error_messages = [] + match = 0 + # validate data type: PostProcessingObjectReference + if not isinstance(v, PostProcessingObjectReference): + error_messages.append(f"Error! Input type `{type(v)}` is not `PostProcessingObjectReference`") + else: + match += 1 + # validate data type: PostProcessingOperation + if not isinstance(v, PostProcessingOperation): + error_messages.append(f"Error! Input type `{type(v)}` is not `PostProcessingOperation`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into PostProcessingObjectReference + try: + instance.actual_instance = PostProcessingObjectReference.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PostProcessingOperation + try: + instance.actual_instance = PostProcessingOperation.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerInputsInner with oneOf schemas: PostProcessingObjectReference, PostProcessingOperation. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PostProcessingObjectReference, PostProcessingOperation]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.post_processing_operation import PostProcessingOperation +# TODO: Rewrite to not use raise_errors +RetrievalSearchInputPostProcessingInnerInputsInner.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py new file mode 100644 index 0000000..61c1879 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_input_post_processing_inner_strategy.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RETRIEVALSEARCHINPUTPOSTPROCESSINGINNERSTRATEGY_ONE_OF_SCHEMAS = ["MergeStrategyReranker", "MergeStrategyScoreReuse"] + +class RetrievalSearchInputPostProcessingInnerStrategy(BaseModel): + """ + Merging and scoring strategy to derive final PerSearchFilterResult. + """ + # data type: MergeStrategyScoreReuse + oneof_schema_1_validator: Optional[MergeStrategyScoreReuse] = None + # data type: MergeStrategyReranker + oneof_schema_2_validator: Optional[MergeStrategyReranker] = None + actual_instance: Optional[Union[MergeStrategyReranker, MergeStrategyScoreReuse]] = None + one_of_schemas: Set[str] = { "MergeStrategyReranker", "MergeStrategyScoreReuse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RetrievalSearchInputPostProcessingInnerStrategy.model_construct() + error_messages = [] + match = 0 + # validate data type: MergeStrategyScoreReuse + if not isinstance(v, MergeStrategyScoreReuse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyScoreReuse`") + else: + match += 1 + # validate data type: MergeStrategyReranker + if not isinstance(v, MergeStrategyReranker): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyReranker`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MergeStrategyScoreReuse + try: + instance.actual_instance = MergeStrategyScoreReuse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MergeStrategyReranker + try: + instance.actual_instance = MergeStrategyReranker.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalSearchInputPostProcessingInnerStrategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MergeStrategyReranker, MergeStrategyScoreReuse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py new file mode 100644 index 0000000..02c4a54 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_results.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.results_inner1 import ResultsInner1 +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalSearchResults(BaseModel): + """ + RetrievalSearchResults + """ # noqa: E501 + results: List[ResultsInner1] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalSearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalSearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ResultsInner1.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py new file mode 100644 index 0000000..31e9eea --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class RetrievalSearchSelectOptionEnum(str, Enum): + """ + RetrievalSearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RetrievalSearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py new file mode 100644 index 0000000..735bba4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.data_repository_type import DataRepositoryType +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_key_value_list_pair import RetrievalKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_configuration import RetrievalSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_vector_search_filter_filter import RetrievalVectorSearchFilterFilter +from gen_ai_hub.document_grounding_generation.generated.models.vector_scoring_configuration import VectorScoringConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class RetrievalVectorSearchFilter(BaseModel): + """ + RetrievalVectorSearchFilter + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this RetrievalSearchFilter - unique per request.") + search_configuration: Optional[RetrievalSearchConfiguration] = Field(default=None, serialization_alias="searchConfiguration") + data_repositories: Optional[List[StrictStr]] = Field(default=None, description="Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids.", serialization_alias="dataRepositories") + data_repository_type: Optional[DataRepositoryType] = Field(default=None, serialization_alias="dataRepositoryType") + remote_name: Optional[StrictStr] = Field(default=None, description="Destination Name of remote instance.", serialization_alias="remoteName") + data_repository_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*']", serialization_alias="dataRepositoryMetadata") + document_metadata: Optional[List[RetrievalSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[List[RetrievalKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") + filter: Optional[RetrievalVectorSearchFilterFilter] = None + scoring_configuration: Optional[VectorScoringConfiguration] = Field(default=None, serialization_alias="scoringConfiguration") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "searchConfiguration", "dataRepositories", "dataRepositoryType", "remoteName", "dataRepositoryMetadata", "documentMetadata", "chunkMetadata", "filter", "scoringConfiguration"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RetrievalVectorSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of search_configuration + if self.search_configuration: + _dict['searchConfiguration'] = self.search_configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # override the default output from pydantic by calling `to_dict()` of scoring_configuration + if self.scoring_configuration: + _dict['scoringConfiguration'] = self.scoring_configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if search_configuration (nullable) is None + # and model_fields_set contains the field + if self.search_configuration is None and "search_configuration" in self.model_fields_set: + _dict['searchConfiguration'] = None + + # set to None if remote_name (nullable) is None + # and model_fields_set contains the field + if self.remote_name is None and "remote_name" in self.model_fields_set: + _dict['remoteName'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RetrievalVectorSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "searchConfiguration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "dataRepositories": obj.get("dataRepositories"), + "dataRepositoryType": obj.get("dataRepositoryType"), + "remoteName": obj.get("remoteName"), + "dataRepositoryMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "documentMetadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, + "filter": RetrievalVectorSearchFilterFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "scoringConfiguration": VectorScoringConfiguration.from_dict(obj["scoringConfiguration"]) if obj.get("scoringConfiguration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py new file mode 100644 index 0000000..3ea17cc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/retrieval_vector_search_filter_filter.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RETRIEVALVECTORSEARCHFILTERFILTER_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class RetrievalVectorSearchFilterFilter(BaseModel): + """ + Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = RetrievalVectorSearchFilterFilter.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in RetrievalVectorSearchFilterFilter with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into RetrievalVectorSearchFilterFilter with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py new file mode 100644 index 0000000..4e268a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RIGHT_ANY_OF_SCHEMAS = ["RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair"] + +class Right(BaseModel): + """ + Right + """ + + # data type: RetrievalBinaryBooleanFilter + anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + # data type: RetrievalScopedKeyValueListPair + anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "RetrievalBinaryBooleanFilter", "RetrievalScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Right.model_construct() + error_messages = [] + # validate data type: RetrievalBinaryBooleanFilter + if not isinstance(v, RetrievalBinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalBinaryBooleanFilter`") + else: + return v + + # validate data type: RetrievalScopedKeyValueListPair + if not isinstance(v, RetrievalScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `RetrievalScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Right with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[RetrievalBinaryBooleanFilter] = None + try: + instance.actual_instance = RetrievalBinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[RetrievalScopedKeyValueListPair] = None + try: + instance.actual_instance = RetrievalScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Right with anyOf schemas: RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Right.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py new file mode 100644 index 0000000..10277c5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/right1.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.document_grounding_generation.generated.models.scoped_key_value_list_pair import ScopedKeyValueListPair +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +RIGHT1_ANY_OF_SCHEMAS = ["BinaryBooleanFilter", "ScopedKeyValueListPair"] + +class Right1(BaseModel): + """ + Right operand of the boolean expression + """ + + # data type: BinaryBooleanFilter + anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + # data type: ScopedKeyValueListPair + anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[BinaryBooleanFilter, ScopedKeyValueListPair]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "BinaryBooleanFilter", "ScopedKeyValueListPair" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = Right1.model_construct() + error_messages = [] + # validate data type: BinaryBooleanFilter + if not isinstance(v, BinaryBooleanFilter): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryBooleanFilter`") + else: + return v + + # validate data type: ScopedKeyValueListPair + if not isinstance(v, ScopedKeyValueListPair): + error_messages.append(f"Error! Input type `{type(v)}` is not `ScopedKeyValueListPair`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Right1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BinaryBooleanFilter] = None + try: + instance.actual_instance = BinaryBooleanFilter.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[ScopedKeyValueListPair] = None + try: + instance.actual_instance = ScopedKeyValueListPair.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Right1 with anyOf schemas: BinaryBooleanFilter, ScopedKeyValueListPair. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], BinaryBooleanFilter, ScopedKeyValueListPair]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.document_grounding_generation.generated.models.binary_boolean_filter import BinaryBooleanFilter +# TODO: Rewrite to not use raise_errors +Right1.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py new file mode 100644 index 0000000..e4222c3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3Configuration(BaseModel): + """ + S3Configuration + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) + s3: Optional[ServiceNowConfigurationMinimalServiceNow] = None + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "s3", "cronExpression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3Configuration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of s3 + if self.s3: + _dict['s3'] = self.s3.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3Configuration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "s3": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["s3"]) if obj.get("s3") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py new file mode 100644 index 0000000..9b836ac --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_configuration_minimal.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3ConfigurationMinimal(BaseModel): + """ + S3ConfigurationMinimal + """ # noqa: E501 + s3: ServiceNowConfigurationMinimalServiceNow + __properties: ClassVar[List[str]] = ["s3"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3ConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of s3 + if self.s3: + _dict['s3'] = self.s3.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3ConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "s3": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["s3"]) if obj.get("s3") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py new file mode 100644 index 0000000..23d3538 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_create_request.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3PipelineCreateRequest(BaseModel): + """ + S3PipelineCreateRequest + """ # noqa: E501 + type: StrictStr + configuration: S3Configuration + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['S3']): + raise ValueError("must be one of enum values ('S3')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": S3Configuration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py new file mode 100644 index 0000000..7cbcad7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_get_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration import S3Configuration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3PipelineGetResponse(BaseModel): + """ + S3PipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: S3Configuration + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['S3']): + raise ValueError("must be one of enum values ('S3')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": S3Configuration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py new file mode 100644 index 0000000..51fa3ce --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/s3_pipeline_minimal_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.s3_configuration_minimal import S3ConfigurationMinimal +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class S3PipelineMinimalResponse(BaseModel): + """ + S3PipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: Optional[S3ConfigurationMinimal] = None + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['S3']): + raise ValueError("must be one of enum values ('S3')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of S3PipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of S3PipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": S3ConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py new file mode 100644 index 0000000..0cb6288 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scoped_key_value_list_pair.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScopedKeyValueListPair(BaseModel): + """ + ScopedKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + scope: Optional[StrictStr] = Field(default='document', description="Scope of the metadata filter (e.g., collection, document, chunk)") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "scope"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['collection', 'document', 'chunk']): + raise ValueError("must be one of enum values ('collection', 'document', 'chunk')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScopedKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScopedKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "scope": obj.get("scope") if obj.get("scope") is not None else 'document' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py new file mode 100644 index 0000000..f360da3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/score.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class Score(BaseModel): + """ + Score + """ # noqa: E501 + value: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Score from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Score from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py new file mode 100644 index 0000000..a566813 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/scores_aggregation_strategy.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ScoresAggregationStrategy(str, Enum): + """ + ScoresAggregationStrategy + """ + + """ + allowed enum values + """ + WEIGHTED_AVERAGE = 'weighted_average' + RRF = 'rrf' + WEIGHTED_RRF = 'weighted_rrf' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ScoresAggregationStrategy from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py new file mode 100644 index 0000000..899fb81 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_create_request.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SDMPipelineCreateRequest(BaseModel): + """ + SDMPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: MetaData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SDM']): + raise ValueError("must be one of enum values ('SDM')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py new file mode 100644 index 0000000..d7d0893 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_get_response.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SDMPipelineGetResponse(BaseModel): + """ + SDMPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: MetaData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SDM']): + raise ValueError("must be one of enum values ('SDM')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py new file mode 100644 index 0000000..c321e85 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sdm_pipeline_minimal_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SDMPipelineMinimalResponse(BaseModel): + """ + SDMPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SDM']): + raise ValueError("must be one of enum values ('SDM')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SDMPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SDMPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py new file mode 100644 index 0000000..de68186 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_configuration.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchConfiguration(BaseModel): + """ + SearchConfiguration + """ # noqa: E501 + max_chunk_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", serialization_alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=0, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", serialization_alias="maxDocumentCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py new file mode 100644 index 0000000..12cc663 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_document_key_value_list_pair.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.search_select_option_enum import SearchSelectOptionEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchDocumentKeyValueListPair(BaseModel): + """ + SearchDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + select_mode: Optional[List[Optional[SearchSelectOptionEnum]]] = Field(default=None, description="Select mode for search filters", serialization_alias="selectMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py new file mode 100644 index 0000000..ab99bd4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_filter.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.key_value_list_pair import KeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.search_configuration import SearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.search_document_key_value_list_pair import SearchDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchFilter(BaseModel): + """ + SearchFilter + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this SearchFilter - unique per request.") + collection_ids: List[StrictStr] = Field(serialization_alias="collectionIds") + configuration: SearchConfiguration + collection_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", serialization_alias="collectionMetadata") + document_metadata: Optional[Annotated[List[SearchDocumentKeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[Annotated[List[KeyValueListPair], Field(max_length=2000)]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collection_metadata (list) + _items = [] + if self.collection_metadata: + for _item_collection_metadata in self.collection_metadata: + _items.append(_item_collection_metadata.to_dict() if _item_collection_metadata is not None else None) + _dict['collectionMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "collectionIds": obj.get("collectionIds"), + "configuration": SearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collectionMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "documentMetadata": [SearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [KeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py new file mode 100644 index 0000000..4985173 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipeline.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data_data_repository_metadata_inner import MetaDataDataRepositoryMetadataInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchPipeline(BaseModel): + """ + SearchPipeline + """ # noqa: E501 + data_repository_metadata: Optional[List[MetaDataDataRepositoryMetadataInner]] = Field(default=None, description="Search for metadata happens at key level. Pipelines matching the search criteria will be returned.", serialization_alias="dataRepositoryMetadata", json_schema_extra={"examples": [[{"key": "purpose", "value": ["demonstration"]}, {"key": "sample-key", "value": ["sample-value1", "sample-value2"]}]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["dataRepositoryMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchPipeline from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_repository_metadata (list) + _items = [] + if self.data_repository_metadata: + for _item_data_repository_metadata in self.data_repository_metadata: + _items.append(_item_data_repository_metadata.to_dict() if _item_data_repository_metadata is not None else None) + _dict['dataRepositoryMetadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchPipeline from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataRepositoryMetadata": [MetaDataDataRepositoryMetadataInner.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py new file mode 100644 index 0000000..47d6766 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_pipelines_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_minimal_response import PipelineMinimalResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchPipelinesResponse(BaseModel): + """ + SearchPipelinesResponse + """ # noqa: E501 + count: Optional[StrictInt] = None + resources: List[PipelineMinimalResponse] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["count", "resources"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchPipelinesResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in resources (list) + _items = [] + if self.resources: + for _item_resources in self.resources: + _items.append(_item_resources.to_dict() if _item_resources is not None else None) + _dict['resources'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchPipelinesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "resources": [PipelineMinimalResponse.from_dict(_item) for _item in obj["resources"]] if obj.get("resources") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py new file mode 100644 index 0000000..93be5ea --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_results.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.results_inner import ResultsInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchResults(BaseModel): + """ + SearchResults + """ # noqa: E501 + results: List[ResultsInner] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py new file mode 100644 index 0000000..5c1915f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.search_scores_aggregated_score import SearchScoresAggregatedScore +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchScores(BaseModel): + """ + SearchScores + """ # noqa: E501 + aggregated_score: SearchScoresAggregatedScore = Field(serialization_alias="aggregatedScore") + dense_retrieval_score: SearchScoresAggregatedScore = Field(serialization_alias="denseRetrievalScore") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["aggregatedScore", "denseRetrievalScore"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchScores from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of aggregated_score + if self.aggregated_score: + _dict['aggregatedScore'] = self.aggregated_score.to_dict() + # override the default output from pydantic by calling `to_dict()` of dense_retrieval_score + if self.dense_retrieval_score: + _dict['denseRetrievalScore'] = self.dense_retrieval_score.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchScores from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "aggregatedScore": SearchScoresAggregatedScore.from_dict(obj["aggregatedScore"]) if obj.get("aggregatedScore") is not None else None, + "denseRetrievalScore": SearchScoresAggregatedScore.from_dict(obj["denseRetrievalScore"]) if obj.get("denseRetrievalScore") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py new file mode 100644 index 0000000..bb8b78f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_scores_aggregated_score.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SearchScoresAggregatedScore(BaseModel): + """ + SearchScoresAggregatedScore + """ # noqa: E501 + value: Optional[Union[StrictFloat, StrictInt]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SearchScoresAggregatedScore from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SearchScoresAggregatedScore from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py new file mode 100644 index 0000000..170a28a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class SearchSelectOptionEnum(str, Enum): + """ + SearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py new file mode 100644 index 0000000..8fbc34c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_config.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfig(BaseModel): + """ + ServiceNowConfig + """ # noqa: E501 + include_paths: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["active=true", "sys_domain_path=/health"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["includePaths"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py new file mode 100644 index 0000000..ed8ee74 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfigurationMinimal(BaseModel): + """ + ServiceNowConfigurationMinimal + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + service_now: Optional[ServiceNowConfigurationMinimalServiceNow] = Field(default=None, serialization_alias="serviceNow") + __properties: ClassVar[List[str]] = ["destination", "serviceNow"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_now + if self.service_now: + _dict['serviceNow'] = self.service_now.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "serviceNow": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py new file mode 100644 index 0000000..2849fe1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_minimal_service_now.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfigurationMinimalServiceNow(BaseModel): + """ + ServiceNowConfigurationMinimalServiceNow + """ # noqa: E501 + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["includePaths"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimalServiceNow from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationMinimalServiceNow from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py new file mode 100644 index 0000000..411517b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_configuration_struct.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_config import ServiceNowConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowConfigurationStruct(BaseModel): + """ + ServiceNowConfigurationStruct + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["destination-name"]}) + service_now: Optional[ServiceNowConfig] = Field(default=None, serialization_alias="serviceNow") + metadata_config_id: Optional[StrictStr] = Field(default=None, serialization_alias="metadataConfigId", json_schema_extra={"examples": ["uuid"]}) + cron_expression: Optional[StrictStr] = Field(default=None, description="Optional cron expression for scheduling pipeline execution. Must represent an interval greater than 1 hour. ", serialization_alias="cronExpression", json_schema_extra={"examples": ["0 */20 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "serviceNow", "metadataConfigId", "cronExpression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationStruct from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of service_now + if self.service_now: + _dict['serviceNow'] = self.service_now.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowConfigurationStruct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "serviceNow": ServiceNowConfig.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None, + "metadataConfigId": obj.get("metadataConfigId"), + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py new file mode 100644 index 0000000..0f23790 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_create_request.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_struct import ServiceNowConfigurationStruct +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowPipelineCreateRequest(BaseModel): + """ + ServiceNowPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: Optional[MetaData] = None + configuration: Optional[ServiceNowConfigurationStruct] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ServiceNow']): + raise ValueError("must be one of enum values ('ServiceNow')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": ServiceNowConfigurationStruct.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py new file mode 100644 index 0000000..df6ee8f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_get_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal import ServiceNowConfigurationMinimal +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowPipelineGetResponse(BaseModel): + """ + ServiceNowPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: ServiceNowConfigurationMinimal + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ServiceNow']): + raise ValueError("must be one of enum values ('ServiceNow')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": ServiceNowConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py new file mode 100644 index 0000000..65cc210 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/service_now_pipeline_minimal_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ServiceNowPipelineMinimalResponse(BaseModel): + """ + ServiceNowPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ServiceNow']): + raise ValueError("must be one of enum values ('ServiceNow')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceNowPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceNowPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py new file mode 100644 index 0000000..4567bb1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPConfiguration(BaseModel): + """ + SFTPConfiguration + """ # noqa: E501 + destination: StrictStr = Field(json_schema_extra={"examples": ["generic-secret-name"]}) + sftp: Optional[ServiceNowConfigurationMinimalServiceNow] = None + cron_expression: Optional[StrictStr] = Field(default=None, serialization_alias="cronExpression", json_schema_extra={"examples": ["0 3 * * *"]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["destination", "sftp", "cronExpression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sftp + if self.sftp: + _dict['sftp'] = self.sftp.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "destination": obj.get("destination"), + "sftp": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["sftp"]) if obj.get("sftp") is not None else None, + "cronExpression": obj.get("cronExpression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py new file mode 100644 index 0000000..e4f7bd1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_configuration_minimal.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict +from gen_ai_hub.document_grounding_generation.generated.models.service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimalServiceNow +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPConfigurationMinimal(BaseModel): + """ + SFTPConfigurationMinimal + """ # noqa: E501 + sftp: ServiceNowConfigurationMinimalServiceNow + __properties: ClassVar[List[str]] = ["sftp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPConfigurationMinimal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of sftp + if self.sftp: + _dict['sftp'] = self.sftp.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPConfigurationMinimal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sftp": ServiceNowConfigurationMinimalServiceNow.from_dict(obj["sftp"]) if obj.get("sftp") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py new file mode 100644 index 0000000..849cbdb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_create_request.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPPipelineCreateRequest(BaseModel): + """ + SFTPPipelineCreateRequest + """ # noqa: E501 + type: StrictStr + configuration: SFTPConfiguration + metadata: Optional[MetaData] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SFTP']): + raise ValueError("must be one of enum values ('SFTP')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "configuration": SFTPConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py new file mode 100644 index 0000000..78947aa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_get_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration import SFTPConfiguration +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPPipelineGetResponse(BaseModel): + """ + SFTPPipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: Optional[MetaData] = None + configuration: SFTPConfiguration + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata", "configuration"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SFTP']): + raise ValueError("must be one of enum values ('SFTP')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "configuration": SFTPConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py new file mode 100644 index 0000000..15d79fa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/sftp_pipeline_minimal_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from gen_ai_hub.document_grounding_generation.generated.models.sftp_configuration_minimal import SFTPConfigurationMinimal +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SFTPPipelineMinimalResponse(BaseModel): + """ + SFTPPipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + configuration: Optional[SFTPConfigurationMinimal] = None + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "configuration", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['SFTP']): + raise ValueError("must be one of enum values ('SFTP')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SFTPPipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SFTPPipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "configuration": SFTPConfigurationMinimal.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py new file mode 100644 index 0000000..2c9b7df --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site import SharePointSite +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointConfig(BaseModel): + """ + SharePointConfig + """ # noqa: E501 + site: SharePointSite + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["site"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of site + if self.site: + _dict['site'] = self.site.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "site": SharePointSite.from_dict(obj["site"]) if obj.get("site") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py new file mode 100644 index 0000000..49a9688 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_config_get_response.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.share_point_site_get_response import SharePointSiteGetResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointConfigGetResponse(BaseModel): + """ + SharePointConfigGetResponse + """ # noqa: E501 + site: SharePointSiteGetResponse + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["site"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointConfigGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of site + if self.site: + _dict['site'] = self.site.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointConfigGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "site": SharePointSiteGetResponse.from_dict(obj["site"]) if obj.get("site") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py new file mode 100644 index 0000000..137f795 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointSite(BaseModel): + """ + SharePointSite + """ # noqa: E501 + name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "includePaths"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSite from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSite from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py new file mode 100644 index 0000000..c745e0d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_detail.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointSiteDetail(BaseModel): + """ + SharePointSiteDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["sharepoint-site-id"]}) + name: StrictStr = Field(json_schema_extra={"examples": ["sharepoint-site-name"]}) + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths", json_schema_extra={"examples": [["/testFolder1", "/testFolder2"]]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSiteDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSiteDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py new file mode 100644 index 0000000..1037807 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/share_point_site_get_response.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SharePointSiteGetResponse(BaseModel): + """ + SharePointSiteGetResponse + """ # noqa: E501 + id: Optional[StrictStr] = None + name: StrictStr + include_paths: Optional[List[StrictStr]] = Field(default=None, serialization_alias="includePaths") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name", "includePaths"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePointSiteGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePointSiteGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "includePaths": obj.get("includePaths") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py new file mode 100644 index 0000000..75abb5f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/strategy.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_reranker import MergeStrategyReranker +from gen_ai_hub.document_grounding_generation.generated.models.merge_strategy_score_reuse import MergeStrategyScoreReuse +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +STRATEGY_ONE_OF_SCHEMAS = ["MergeStrategyReranker", "MergeStrategyScoreReuse"] + +class Strategy(BaseModel): + """ + Merging and scoring strategy to derive final PerSearchFilterResult. + """ + # data type: MergeStrategyScoreReuse + oneof_schema_1_validator: Optional[MergeStrategyScoreReuse] = None + # data type: MergeStrategyReranker + oneof_schema_2_validator: Optional[MergeStrategyReranker] = None + actual_instance: Optional[Union[MergeStrategyReranker, MergeStrategyScoreReuse]] = None + one_of_schemas: Set[str] = { "MergeStrategyReranker", "MergeStrategyScoreReuse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = Strategy.model_construct() + error_messages = [] + match = 0 + # validate data type: MergeStrategyScoreReuse + if not isinstance(v, MergeStrategyScoreReuse): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyScoreReuse`") + else: + match += 1 + # validate data type: MergeStrategyReranker + if not isinstance(v, MergeStrategyReranker): + error_messages.append(f"Error! Input type `{type(v)}` is not `MergeStrategyReranker`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into MergeStrategyScoreReuse + try: + instance.actual_instance = MergeStrategyScoreReuse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MergeStrategyReranker + try: + instance.actual_instance = MergeStrategyReranker.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Strategy with oneOf schemas: MergeStrategyReranker, MergeStrategyScoreReuse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], MergeStrategyReranker, MergeStrategyScoreReuse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py new file mode 100644 index 0000000..6a919db --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextOnlyBaseChunk(BaseModel): + """ + Schema for a text-only chunk. + """ # noqa: E501 + content: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + id: UUID = Field(description="Unique identifier of a chuk.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["content", "metadata", "id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "content": obj.get("content"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None, + "id": obj.get("id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py new file mode 100644 index 0000000..7c84155 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_only_base_chunk_create.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextOnlyBaseChunkCreate(BaseModel): + """ + Schema for a text-only chunk. + """ # noqa: E501 + content: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["content", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunkCreate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextOnlyBaseChunkCreate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "content": obj.get("content"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py new file mode 100644 index 0000000..a680f91 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/text_search_request.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_filter import VectorSearchFilter +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TextSearchRequest(BaseModel): + """ + TextSearchRequest + """ # noqa: E501 + query: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=2000)]] = Field(description="Query string") + filters: List[VectorSearchFilter] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["query", "filters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextSearchRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item_filters in self.filters: + _items.append(_item_filters.to_dict() if _item_filters is not None else None) + _dict['filters'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if query (nullable) is None + # and model_fields_set contains the field + if self.query is None and "query" in self.model_fields_set: + _dict['query'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextSearchRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "filters": [VectorSearchFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py new file mode 100644 index 0000000..590429d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/validation_error.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.location_inner import LocationInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ValidationError(BaseModel): + """ + ValidationError + """ # noqa: E501 + loc: List[LocationInner] + msg: StrictStr + type: StrictStr + input: Optional[Any] = None + ctx: Optional[Dict[str, Any]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in loc (list) + _items = [] + if self.loc: + for _item_loc in self.loc: + _items.append(_item_loc.to_dict() if _item_loc is not None else None) + _dict['loc'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if input (nullable) is None + # and model_fields_set contains the field + if self.input is None and "input" in self.model_fields_set: + _dict['input'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loc": [LocationInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None, + "msg": obj.get("msg"), + "type": obj.get("type"), + "input": obj.get("input"), + "ctx": obj.get("ctx") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py new file mode 100644 index 0000000..c41018a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_chunk.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorChunk(BaseModel): + """ + VectorChunk + """ # noqa: E501 + id: StrictStr + content: StrictStr + metadata: Optional[List[VectorKeyValueListPair]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "content", "metadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorChunk from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + _items.append(_item_metadata.to_dict() if _item_metadata is not None else None) + _dict['metadata'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorChunk from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "content": obj.get("content"), + "metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py new file mode 100644 index 0000000..399e657 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_document_key_value_list_pair.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.filter_match_mode_enum import FilterMatchModeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorDocumentKeyValueListPair(BaseModel): + """ + VectorDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + match_mode: Optional[FilterMatchModeEnum] = Field(default=None, serialization_alias="matchMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "matchMode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "matchMode": obj.get("matchMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py new file mode 100644 index 0000000..05daa4e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_key_value_list_pair.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorKeyValueListPair(BaseModel): + """ + Collection metadata during ingestion + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py new file mode 100644 index 0000000..448bec0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_per_filter_search_result.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.documents_chunk import DocumentsChunk +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorPerFilterSearchResult(BaseModel): + """ + VectorPerFilterSearchResult + """ # noqa: E501 + filter_id: StrictStr = Field(serialization_alias="filterId") + results: List[DocumentsChunk] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["filterId", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorPerFilterSearchResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorPerFilterSearchResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filterId": obj.get("filterId"), + "results": [DocumentsChunk.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py new file mode 100644 index 0000000..88877a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_scoring_configuration.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from gen_ai_hub.document_grounding_generation.generated.models.boosting_scoring_configuration import BoostingScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.scores_aggregation_strategy import ScoresAggregationStrategy +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorScoringConfiguration(BaseModel): + """ + VectorScoringConfiguration + """ # noqa: E501 + dense_retrieval: Optional[DenseRetrievalScoringConfiguration] = Field(default=None, serialization_alias="denseRetrieval") + keyword_retrieval: Optional[KeyWordRetrievalScoringConfiguration] = Field(default=None, serialization_alias="keywordRetrieval") + boosting: Optional[BoostingScoringConfiguration] = None + score_threshold: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum chunk score threshold.", serialization_alias="scoreThreshold") + aggregation_strategy: Optional[ScoresAggregationStrategy] = Field(default=None, serialization_alias="aggregationStrategy") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["denseRetrieval", "keywordRetrieval", "boosting", "scoreThreshold", "aggregationStrategy"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorScoringConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of dense_retrieval + if self.dense_retrieval: + _dict['denseRetrieval'] = self.dense_retrieval.to_dict() + # override the default output from pydantic by calling `to_dict()` of keyword_retrieval + if self.keyword_retrieval: + _dict['keywordRetrieval'] = self.keyword_retrieval.to_dict() + # override the default output from pydantic by calling `to_dict()` of boosting + if self.boosting: + _dict['boosting'] = self.boosting.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if score_threshold (nullable) is None + # and model_fields_set contains the field + if self.score_threshold is None and "score_threshold" in self.model_fields_set: + _dict['scoreThreshold'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorScoringConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "denseRetrieval": DenseRetrievalScoringConfiguration.from_dict(obj["denseRetrieval"]) if obj.get("denseRetrieval") is not None else None, + "keywordRetrieval": KeyWordRetrievalScoringConfiguration.from_dict(obj["keywordRetrieval"]) if obj.get("keywordRetrieval") is not None else None, + "boosting": BoostingScoringConfiguration.from_dict(obj["boosting"]) if obj.get("boosting") is not None else None, + "scoreThreshold": obj.get("scoreThreshold"), + "aggregationStrategy": obj.get("aggregationStrategy") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py new file mode 100644 index 0000000..156f89d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_configuration.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchConfiguration(BaseModel): + """ + VectorSearchConfiguration + """ # noqa: E501 + max_chunk_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'.", serialization_alias="maxChunkCount") + max_document_count: Optional[Annotated[int, Field(le=10000000, strict=True, gt=0)]] = Field(default=None, description="[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned.", serialization_alias="maxDocumentCount") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["maxChunkCount", "maxDocumentCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if max_chunk_count (nullable) is None + # and model_fields_set contains the field + if self.max_chunk_count is None and "max_chunk_count" in self.model_fields_set: + _dict['maxChunkCount'] = None + + # set to None if max_document_count (nullable) is None + # and model_fields_set contains the field + if self.max_document_count is None and "max_document_count" in self.model_fields_set: + _dict['maxDocumentCount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "maxChunkCount": obj.get("maxChunkCount"), + "maxDocumentCount": obj.get("maxDocumentCount") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py new file mode 100644 index 0000000..bf71547 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_document_key_value_list_pair.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_select_option_enum import VectorSearchSelectOptionEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchDocumentKeyValueListPair(BaseModel): + """ + VectorSearchDocumentKeyValueListPair + """ # noqa: E501 + key: Annotated[str, Field(strict=True, max_length=1024)] + value: List[Annotated[str, Field(strict=True, max_length=1024)]] + select_mode: Optional[List[VectorSearchSelectOptionEnum]] = Field(default=None, description="Select mode for search filters", serialization_alias="selectMode") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["key", "value", "selectMode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchDocumentKeyValueListPair from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if select_mode (nullable) is None + # and model_fields_set contains the field + if self.select_mode is None and "select_mode" in self.model_fields_set: + _dict['selectMode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchDocumentKeyValueListPair from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value"), + "selectMode": obj.get("selectMode") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py new file mode 100644 index 0000000..3f4ac20 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_filter.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.filter import Filter +from gen_ai_hub.document_grounding_generation.generated.models.vector_key_value_list_pair import VectorKeyValueListPair +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_configuration import VectorSearchConfiguration +from gen_ai_hub.document_grounding_generation.generated.models.vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchFilter(BaseModel): + """ + VectorSearchFilter + """ # noqa: E501 + id: StrictStr = Field(description="Identifier of this VectorSearchFilter - unique per request.") + collection_ids: List[StrictStr] = Field(serialization_alias="collectionIds") + configuration: VectorSearchConfiguration + collection_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*']", serialization_alias="collectionMetadata") + document_metadata: Optional[List[VectorSearchDocumentKeyValueListPair]] = Field(default=None, description="Restrict documents considered during search to those annotated with the given metadata.", serialization_alias="documentMetadata") + chunk_metadata: Optional[List[VectorKeyValueListPair]] = Field(default=None, description="Restrict chunks considered during search to those with the given metadata.", serialization_alias="chunkMetadata") + filter: Optional[Filter] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "collectionIds", "configuration", "collectionMetadata", "documentMetadata", "chunkMetadata", "filter"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of configuration + if self.configuration: + _dict['configuration'] = self.configuration.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in collection_metadata (list) + _items = [] + if self.collection_metadata: + for _item_collection_metadata in self.collection_metadata: + _items.append(_item_collection_metadata.to_dict() if _item_collection_metadata is not None else None) + _dict['collectionMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in document_metadata (list) + _items = [] + if self.document_metadata: + for _item_document_metadata in self.document_metadata: + _items.append(_item_document_metadata.to_dict() if _item_document_metadata is not None else None) + _dict['documentMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in chunk_metadata (list) + _items = [] + if self.chunk_metadata: + for _item_chunk_metadata in self.chunk_metadata: + _items.append(_item_chunk_metadata.to_dict() if _item_chunk_metadata is not None else None) + _dict['chunkMetadata'] = _items + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if collection_metadata (nullable) is None + # and model_fields_set contains the field + if self.collection_metadata is None and "collection_metadata" in self.model_fields_set: + _dict['collectionMetadata'] = None + + # set to None if document_metadata (nullable) is None + # and model_fields_set contains the field + if self.document_metadata is None and "document_metadata" in self.model_fields_set: + _dict['documentMetadata'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "collectionIds": obj.get("collectionIds"), + "configuration": VectorSearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collectionMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "documentMetadata": [VectorSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunkMetadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["chunkMetadata"]] if obj.get("chunkMetadata") is not None else None, + "filter": Filter.from_dict(obj["filter"]) if obj.get("filter") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py new file mode 100644 index 0000000..a45c041 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_results.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.vector_per_filter_search_result import VectorPerFilterSearchResult +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class VectorSearchResults(BaseModel): + """ + VectorSearchResults + """ # noqa: E501 + results: List[VectorPerFilterSearchResult] = Field(description="List of returned results.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VectorSearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + _items.append(_item_results.to_dict() if _item_results is not None else None) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VectorSearchResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [VectorPerFilterSearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py new file mode 100644 index 0000000..98754a0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/vector_search_select_option_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class VectorSearchSelectOptionEnum(str, Enum): + """ + VectorSearchSelectOptionEnum + """ + + """ + allowed enum values + """ + IGNOREIFKEYABSENT = 'ignoreIfKeyAbsent' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of VectorSearchSelectOptionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py new file mode 100644 index 0000000..53da7ec --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_create_request.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkZonePipelineCreateRequest(BaseModel): + """ + WorkZonePipelineCreateRequest + """ # noqa: E501 + type: StrictStr + metadata: MetaData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['WorkZone']): + raise ValueError("must be one of enum values ('WorkZone')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineCreateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py new file mode 100644 index 0000000..f720f1e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_get_response.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from gen_ai_hub.document_grounding_generation.generated.models.meta_data import MetaData +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkZonePipelineGetResponse(BaseModel): + """ + WorkZonePipelineGetResponse + """ # noqa: E501 + id: StrictStr + type: StrictStr + metadata: MetaData + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['WorkZone']): + raise ValueError("must be one of enum values ('WorkZone')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineGetResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineGetResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "metadata": MetaData.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py new file mode 100644 index 0000000..c91e0fa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/models/work_zone_pipeline_minimal_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.document_grounding_generation.generated.models.pipeline_execution_status import PipelineExecutionStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class WorkZonePipelineMinimalResponse(BaseModel): + """ + WorkZonePipelineMinimalResponse + """ # noqa: E501 + id: StrictStr = Field(json_schema_extra={"examples": ["uuid"]}) + status: Optional[PipelineExecutionStatus] + type: StrictStr + metadata: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "status", "type", "metadata"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['WorkZone']): + raise ValueError("must be one of enum values ('WorkZone')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkZonePipelineMinimalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkZonePipelineMinimalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "metadata": obj.get("metadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed b/packages/gen/gen_ai_hub/document_grounding_generation/generated/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py new file mode 100644 index 0000000..e6b72c6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/rest.py @@ -0,0 +1,201 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl +from typing import Optional, Union + +import httpx + +from gen_ai_hub.document_grounding_generation.generated.exceptions import ApiException, ApiValueError + +RESTResponseType = httpx.Response + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status_code + self.reason = resp.reason_phrase + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.aread() + return self.data + + @property + def headers(self): + """Returns a CIMultiDictProxy of response headers.""" + return self.response.headers + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header; use ``headers`` instead.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + + # maxsize is number of requests to host that are allowed in parallel + self.maxsize = configuration.connection_pool_maxsize + + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, + ) + if configuration.cert_file: + self.ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + if not configuration.verify_ssl: + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE + + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers + + self.pool_manager: Optional[httpx.AsyncClient] = None + + async def close(self): + if self.pool_manager is not None: + await self.pool_manager.aclose() + + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None): + """Execute request + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + args["json"] = body + if body is None and post_params: + args["json"] = dict(post_params) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + args["data"] = dict(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by httpx + del headers['Content-Type'] + + files = [] + data = {} + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + files.append((k, v)) + else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) + data[k] = v + + if files: + args["files"] = files + if data: + args["data"] = data + + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + if self.pool_manager is None: + self.pool_manager = self._create_pool_manager() + + r = await self.pool_manager.request(**args) + return RESTResponse(r) + + def _create_pool_manager(self) -> httpx.AsyncClient: + limits = httpx.Limits(max_connections=self.maxsize) + + proxy = None + if self.proxy: + proxy = httpx.Proxy( + url=self.proxy, + headers=self.proxy_headers + ) + + return httpx.AsyncClient( + limits=limits, + proxy=proxy, + verify=self.ssl_context, + trust_env=True + ) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py b/packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py new file mode 100644 index 0000000..dd7a630 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/generated/sync_helper.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Grounding + + Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import threading +from typing import Any, Coroutine, Optional, TypeVar + +T = TypeVar("T") + +_loop: Optional[asyncio.AbstractEventLoop] = None +_loop_lock = threading.Lock() + + +def _get_sync_loop() -> asyncio.AbstractEventLoop: + """Return a dedicated event loop running in a background daemon thread. + + A single, long-lived loop is reused for every synchronous call so that the + underlying ``httpx.AsyncClient`` (and its connection pool) stays bound to one + event loop across calls. The loop is created lazily and in a thread-safe way. + """ + global _loop + if _loop is None: + with _loop_lock: + if _loop is None: + loop = asyncio.new_event_loop() + thread = threading.Thread( + target=loop.run_forever, + name="generated-sync-runner", + daemon=True, + ) + thread.start() + _loop = loop + return _loop + + +def run_sync(coro: Coroutine[Any, Any, T]) -> T: + """Run an async coroutine to completion and return its result synchronously. + + The coroutine is scheduled on a dedicated background event loop and the + calling thread blocks until it finishes. This is used to expose synchronous + ``_sync`` variants of the asynchronous API methods. + + Note: this must not be called from within a running event loop (i.e. from + ``async`` code) as it would block that loop; use the ``await``-able async + methods directly in that case. + """ + return asyncio.run_coroutine_threadsafe(coro, _get_sync_loop()).result() diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py new file mode 100644 index 0000000..cec9036 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/__init__.py @@ -0,0 +1,5 @@ +"""Tabular AI Orchestration client for SAP AI Core.""" + +from gen_ai_hub.tab_ai_orchestration.client import TabAiOrchestrationClient + +__all__ = ["TabAiOrchestrationClient"] diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py new file mode 100644 index 0000000..27027c2 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py @@ -0,0 +1,134 @@ +"""Typed async client for the Tabular AI Orchestration service.""" +from __future__ import annotations + +from typing import Any, Optional, Self, Union + +import httpx + +from gen_ai_hub.tab_ai_orchestration.generated.api.predict_api import PredictApi +from gen_ai_hub.tab_ai_orchestration.generated.api_client import ApiClient +from gen_ai_hub.tab_ai_orchestration.generated.configuration import Configuration +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse +from gen_ai_hub.tab_ai_orchestration.generated.rest import RESTClientObject + +from gen_ai_hub import GenAIHubProxyClient +from gen_ai_hub.proxy import get_proxy_client + + +def _get_proxy(proxy_client: Optional[GenAIHubProxyClient]) -> GenAIHubProxyClient: + return proxy_client or get_proxy_client(proxy_version="gen-ai-hub") + + +def _resolve_deployment_url(proxy: GenAIHubProxyClient, model_name: str, model_version: Optional[str]) -> str: + from ai_core_sdk.models import Status + query = proxy.ai_core_client.deployment.query( + status=Status.RUNNING, + scenario_id="tabular-orchestration", + resource_group=proxy.resource_group or "default", + ) + if not query.resources: + raise ValueError("No running tabular-orchestration deployment found.") + return query.resources[0].deployment_url + + +def _make_auth_hook(proxy: GenAIHubProxyClient): + async def inject_auth(request: httpx.Request) -> None: + for key, value in proxy.request_header.items(): + request.headers[key] = value + return inject_auth + + +class _SapRESTClientObject(RESTClientObject): + def __init__(self, configuration: Configuration, proxy: GenAIHubProxyClient, timeout: Any) -> None: + super().__init__(configuration) + self._proxy = proxy + self._timeout = timeout + + def _create_pool_manager(self) -> httpx.AsyncClient: + kwargs: dict[str, Any] = {"event_hooks": {"request": [_make_auth_hook(self._proxy)]}} + if self._timeout is not None: + kwargs["timeout"] = self._timeout + return httpx.AsyncClient(**kwargs) + + +class _SapApiClient(ApiClient): + def __init__(self, configuration: Configuration, proxy: GenAIHubProxyClient, timeout: Any) -> None: + super().__init__(configuration=configuration) + self.rest_client = _SapRESTClientObject(configuration, proxy, timeout) + + def sanitize_for_serialization(self, obj: Any) -> Any: + # The base class calls obj.to_dict() which includes additional_properties. + # Override to strip it at all levels while preserving camelCase aliases. + from pydantic import BaseModel + if obj is None: + return None + if isinstance(obj, BaseModel): + d = obj.model_dump(by_alias=True, exclude_none=True, exclude={"additional_properties"}) + return self.sanitize_for_serialization(d) + if isinstance(obj, dict): + return {k: self.sanitize_for_serialization(v) for k, v in obj.items() if k != "additional_properties"} + if isinstance(obj, list): + return [self.sanitize_for_serialization(i) for i in obj] + return super().sanitize_for_serialization(obj) + + +class TabAiOrchestrationClient: + """Async client for the Tabular AI Orchestration service. + + Resolves the deployment URL from the proxy client credentials using + ``model_name`` and optional ``model_version``. Auth headers are injected + automatically via the SAP proxy client. + + Usage:: + + async with TabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + response = await client.predict( + ai_resource_group="default", + predict_request=PredictRequest(...), + ) + + # or without context manager + client = TabAiOrchestrationClient(model_name="sap-rpt-1.5") + response = await client.predict(...) + await client.close() + """ + + def __init__( + self, + model_name: str, + model_version: Optional[str] = None, + proxy_client: Optional[GenAIHubProxyClient] = None, + timeout: Union[float, None] = None, + ) -> None: + proxy = _get_proxy(proxy_client) + base_url = _resolve_deployment_url(proxy, model_name, model_version) + config = Configuration(host=base_url) + self._api_client = _SapApiClient(config, proxy, timeout) + self._predict_api = PredictApi(self._api_client) + + async def close(self) -> None: + """Close the underlying HTTP client.""" + await self._api_client.close() + + async def __aenter__(self) -> Self: + return self + + async def __aexit__(self, *_: object) -> None: + await self.close() + + async def predict( + self, + predict_request: PredictRequest, + ai_resource_group: str, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model. + + :param predict_request: The prediction request payload. + :param ai_resource_group: AI Core resource group identifier. + :returns: Prediction response from the model. + """ + return await self._predict_api.predict( # type: ignore[no-any-return] + ai_resource_group=ai_resource_group, + predict_request=predict_request, + ) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py new file mode 100644 index 0000000..7495576 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/__init__.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# Define package exports +__all__ = [ + "PredictApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "ConditionsInner", + "ContextSelectionConfig", + "ContextSelectionStrategyEnum", + "FilterCondition", + "FilterConditions", + "Filterconditions", + "HTTPValidationError", + "LocationInner", + "ModelRpt1", + "ModelRpt15", + "ModelRpt15Explanations", + "ModelRpt15PredictionConfig", + "Modelconfig", + "PredictMetadata", + "PredictRequest", + "PredictResponse", + "PredictStatus", + "PredictionConfig", + "SamplingHeuristicConfig", + "SamplingRandomConfig", + "Strategyconfig", + "TFMEnum", + "TargetColumn", + "TaskTypeEnum", + "ValidationError", +] + +# import apis into sdk package +from gen_ai_hub.tab_ai_orchestration.generated.api.predict_api import PredictApi as PredictApi + +# import ApiClient +from gen_ai_hub.tab_ai_orchestration.generated.api_response import ApiResponse as ApiResponse +from gen_ai_hub.tab_ai_orchestration.generated.api_client import ApiClient as ApiClient +from gen_ai_hub.tab_ai_orchestration.generated.configuration import Configuration as Configuration +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import OpenApiException as OpenApiException +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiTypeError as ApiTypeError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiValueError as ApiValueError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiKeyError as ApiKeyError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiAttributeError as ApiAttributeError +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiException as ApiException + +# import models into sdk package +from gen_ai_hub.tab_ai_orchestration.generated.models.conditions_inner import ConditionsInner as ConditionsInner +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig as ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum as ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition as FilterCondition +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions as FilterConditions +from gen_ai_hub.tab_ai_orchestration.generated.models.filterconditions import Filterconditions as Filterconditions +from gen_ai_hub.tab_ai_orchestration.generated.models.http_validation_error import HTTPValidationError as HTTPValidationError +from gen_ai_hub.tab_ai_orchestration.generated.models.location_inner import LocationInner as LocationInner +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt1 import ModelRpt1 as ModelRpt1 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 as ModelRpt15 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations as ModelRpt15Explanations +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig as ModelRpt15PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig as Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_metadata import PredictMetadata as PredictMetadata +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest as PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse as PredictResponse +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_status import PredictStatus as PredictStatus +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig as PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_heuristic_config import SamplingHeuristicConfig as SamplingHeuristicConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_random_config import SamplingRandomConfig as SamplingRandomConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.strategyconfig import Strategyconfig as Strategyconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum as TFMEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn as TargetColumn +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum as TaskTypeEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.validation_error import ValidationError as ValidationError + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py new file mode 100644 index 0000000..0b1ce14 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/__init__.py @@ -0,0 +1,5 @@ +# flake8: noqa + +# import apis into api package +from gen_ai_hub.tab_ai_orchestration.generated.api.predict_api import PredictApi + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py new file mode 100644 index 0000000..9de4e57 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api/predict_api.py @@ -0,0 +1,456 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse + +from gen_ai_hub.tab_ai_orchestration.generated.api_client import ApiClient, RequestSerialized +from gen_ai_hub.tab_ai_orchestration.generated.api_response import ApiResponse +from gen_ai_hub.tab_ai_orchestration.generated.rest import RESTResponseType +from gen_ai_hub.tab_ai_orchestration.generated.sync_helper import run_sync + + +class PredictApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def predict( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model + + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + + :param ai_resource_group: AI Core resource group identifier (required) + :type ai_resource_group: str + :param predict_request: (required) + :type predict_request: PredictRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._predict_serialize( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PredictResponse", + '400': None, + '401': None, + '404': None, + '422': "HTTPValidationError", + '500': None, + '502': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def predict_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PredictResponse]: + """Make predictions using a Tabular Foundation Model + + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + + :param ai_resource_group: AI Core resource group identifier (required) + :type ai_resource_group: str + :param predict_request: (required) + :type predict_request: PredictRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._predict_serialize( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PredictResponse", + '400': None, + '401': None, + '404': None, + '422': "HTTPValidationError", + '500': None, + '502': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def predict_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Make predictions using a Tabular Foundation Model + + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + + :param ai_resource_group: AI Core resource group identifier (required) + :type ai_resource_group: str + :param predict_request: (required) + :type predict_request: PredictRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._predict_serialize( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PredictResponse", + '400': None, + '401': None, + '404': None, + '422': "HTTPValidationError", + '500': None, + '502': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + @validate_call + def predict_sync( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model (synchronous) + + Synchronous variant of :meth:`predict`. It calls the asynchronous + method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.predict( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def predict_sync_with_http_info( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PredictResponse]: + """Make predictions using a Tabular Foundation Model (synchronous) + + Synchronous variant of :meth:`predict_with_http_info`. It calls the + asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.predict_with_http_info( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + @validate_call + def predict_sync_without_preload_content( + self, + ai_resource_group: Annotated[StrictStr, Field(description="AI Core resource group identifier")], + predict_request: PredictRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Make predictions using a Tabular Foundation Model (synchronous) + + Synchronous variant of :meth:`predict_without_preload_content`. It calls + the asynchronous method and blocks until it completes. + """ # noqa: E501 + return run_sync( + self.predict_without_preload_content( + ai_resource_group=ai_resource_group, + predict_request=predict_request, + _request_timeout=_request_timeout, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + ) + + + def _predict_serialize( + self, + ai_resource_group, + predict_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if ai_resource_group is not None: + _header_params['ai-resource-group'] = ai_resource_group + # process the form parameters + # process the body parameter + if predict_request is not None: + _body_params = predict_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/predict', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py new file mode 100644 index 0000000..b4b057f --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_client.py @@ -0,0 +1,836 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile +import uuid + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from gen_ai_hub.tab_ai_orchestration.generated.configuration import Configuration +from gen_ai_hub.tab_ai_orchestration.generated.api_response import ApiResponse, T as ApiResponseT +import gen_ai_hub.tab_ai_orchestration.generated.models +from gen_ai_hub.tab_ai_orchestration.generated import rest +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = await self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it. + if response_type is None and str(response_data.status) not in response_types_map \ + and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \ + and 'default' in response_types_map: + response_type = response_types_map['default'] + + # deserialize response data + response_text = None + return_data = None + try: + if response_type in ("bytearray", "bytes"): + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.headers, + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + elif isinstance(obj, dict): + return { + key: self.sanitize_for_serialization(val) + for key, val in obj.items() + } + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return self.sanitize_for_serialization(obj_dict) + + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('Optional['): + m = re.match(r'Optional\[(.*)]', klass) + assert m is not None, "Malformed Optional type definition" + # data is not None here, so the optionality is already resolved + return self.__deserialize(data, m.group(1)) + + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(gen_ai_hub.tab_ai_orchestration.generated.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, str(value).lower() if isinstance(value, bool) else value) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + str(value).lower() if isinstance(value, bool) else str(value) + for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend( + (k, quote(str(value).lower() if isinstance(value, bool) else str(value))) + for value in v + ) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join( + quote(str(value).lower() if isinstance(value, bool) else str(value)) + for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + if not 'Cookie' in headers: + headers['Cookie'] = "" + else: + headers['Cookie'] += "; " + # Account for cookie value containing spaces and special characters, excluding base64 delimiters + cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=") + headers['Cookie'] += f"{auth_setting['key']}={cookie_value}" + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py new file mode 100644 index 0000000..27ae67d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/configuration.py @@ -0,0 +1,595 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import base64 +import copy +import http.client as httplib +import logging +from logging import FileHandler +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self + + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: int - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. + + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "/v1" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("generated") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = verify_ssl + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file + """client certificate file + """ + self.key_file = key_file + """client key file + """ + self.assert_hostname = assert_hostname + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = tls_server_name + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100 + """This value is passed to the aiohttp to limit simultaneous connections. + None in the constructor is coerced to default 100. + """ + + self.proxy = proxy + """Proxy URL + """ + self.proxy_headers = proxy_headers + """Proxy headers + """ + self.safe_chars_for_path_param = safe_chars_for_path_param + """Safe chars for path_param + """ + self.retries = retries + """Retry configuration + """ + # Enable client side validation + self.client_side_validation = client_side_validation + + self.socket_options = socket_options + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = datetime_format + """datetime format + """ + + self.date_format = date_format + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setter to re-create the file handler (excluded from __dict__ copy) + result.logger_file = self.logger_file + + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.8.1\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "/v1", + 'description': "No description provided", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and variable['enum_values'] \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py new file mode 100644 index 0000000..98cc5e8 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/exceptions.py @@ -0,0 +1,218 @@ +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py new file mode 100644 index 0000000..6c0eae6 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/__init__.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +# flake8: noqa +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +# import models into model package +from gen_ai_hub.tab_ai_orchestration.generated.models.conditions_inner import ConditionsInner +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions +from gen_ai_hub.tab_ai_orchestration.generated.models.filterconditions import Filterconditions +from gen_ai_hub.tab_ai_orchestration.generated.models.http_validation_error import HTTPValidationError +from gen_ai_hub.tab_ai_orchestration.generated.models.location_inner import LocationInner +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt1 import ModelRpt1 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_metadata import PredictMetadata +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_response import PredictResponse +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_status import PredictStatus +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_heuristic_config import SamplingHeuristicConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_random_config import SamplingRandomConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.strategyconfig import Strategyconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.validation_error import ValidationError + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py new file mode 100644 index 0000000..67e5933 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/conditions_inner.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +CONDITIONSINNER_ANY_OF_SCHEMAS = ["FilterCondition", "FilterConditions"] + +class ConditionsInner(BaseModel): + """ + ConditionsInner + """ + + # data type: FilterCondition + anyof_schema_1_validator: Optional[FilterCondition] = None + # data type: FilterConditions + anyof_schema_2_validator: Optional[FilterConditions] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[FilterCondition, FilterConditions]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "FilterCondition", "FilterConditions" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = ConditionsInner.model_construct() + error_messages = [] + # validate data type: FilterCondition + if not isinstance(v, FilterCondition): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterCondition`") + else: + return v + + # validate data type: FilterConditions + if not isinstance(v, FilterConditions): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterConditions`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in ConditionsInner with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # anyof_schema_1_validator: Optional[FilterCondition] = None + try: + instance.actual_instance = FilterCondition.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[FilterConditions] = None + try: + instance.actual_instance = FilterConditions.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into ConditionsInner with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], FilterCondition, FilterConditions]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions +# TODO: Rewrite to not use raise_errors +ConditionsInner.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py new file mode 100644 index 0000000..67f818d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_config.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.filterconditions import Filterconditions +from gen_ai_hub.tab_ai_orchestration.generated.models.strategyconfig import Strategyconfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ContextSelectionConfig(BaseModel): + """ + Configuration for context selection. + """ # noqa: E501 + index_column: Optional[StrictStr] = Field(default=None, description="Name of the unique row-identifier column (e.g. 'ROW_INDEX'). Required for 'heuristic', and deterministic 'random' strategies.", serialization_alias="indexColumn") + num_rows: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Number of rows to select for context. If not provided or set to 0, context selection is skipped.", serialization_alias="numRows") + strategy: Optional[ContextSelectionStrategyEnum] = Field(default=None, description="Sampling strategy for context selection.") + strategy_config: Optional[Strategyconfig] = Field(default=None, serialization_alias="strategyConfig") + filter_conditions: Optional[Filterconditions] = Field(default=None, serialization_alias="filterConditions") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["indexColumn", "numRows", "strategy", "strategyConfig", "filterConditions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ContextSelectionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of strategy_config + if self.strategy_config: + _dict['strategyConfig'] = self.strategy_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of filter_conditions + if self.filter_conditions: + _dict['filterConditions'] = self.filter_conditions.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if index_column (nullable) is None + # and model_fields_set contains the field + if self.index_column is None and "index_column" in self.model_fields_set: + _dict['indexColumn'] = None + + # set to None if num_rows (nullable) is None + # and model_fields_set contains the field + if self.num_rows is None and "num_rows" in self.model_fields_set: + _dict['numRows'] = None + + # set to None if strategy_config (nullable) is None + # and model_fields_set contains the field + if self.strategy_config is None and "strategy_config" in self.model_fields_set: + _dict['strategyConfig'] = None + + # set to None if filter_conditions (nullable) is None + # and model_fields_set contains the field + if self.filter_conditions is None and "filter_conditions" in self.model_fields_set: + _dict['filterConditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ContextSelectionConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "indexColumn": obj.get("indexColumn"), + "numRows": obj.get("numRows"), + "strategy": obj.get("strategy"), + "strategyConfig": Strategyconfig.from_dict(obj["strategyConfig"]) if obj.get("strategyConfig") is not None else None, + "filterConditions": Filterconditions.from_dict(obj["filterConditions"]) if obj.get("filterConditions") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py new file mode 100644 index 0000000..38f4f0c --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/context_selection_strategy_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ContextSelectionStrategyEnum(str, Enum): + """ + Context selection strategies for data sampling. + """ + + """ + allowed enum values + """ + NONE = 'none' + RANDOM = 'random' + HEURISTIC = 'heuristic' + AUTO = 'auto' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ContextSelectionStrategyEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py new file mode 100644 index 0000000..55ee4ea --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_condition.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FilterCondition(BaseModel): + """ + A single filter condition for context selection. + """ # noqa: E501 + var_field: StrictStr = Field(description="Field name to filter on", serialization_alias="field") + op: StrictStr = Field(description="Filter operator (e.g., 'eq', 'gte', 'lte')") + value: Optional[Any] = Field(description="Value to compare against") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["field", "op", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FilterCondition from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FilterCondition from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "field": obj.get("field"), + "op": obj.get("op"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py new file mode 100644 index 0000000..e8cb464 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filter_conditions.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class FilterConditions(BaseModel): + """ + Filter conditions for context selection. + """ # noqa: E501 + logic: StrictStr = Field(description="Logical operator to combine conditions ('and' or 'or')") + conditions: List[ConditionsInner] = Field(description="List of filter conditions") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["logic", "conditions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FilterConditions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in conditions (list) + _items = [] + if self.conditions: + for _item_conditions in self.conditions: + _items.append(_item_conditions.to_dict() if _item_conditions is not None else None) + _dict['conditions'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FilterConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "logic": obj.get("logic"), + "conditions": [ConditionsInner.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + +from gen_ai_hub.tab_ai_orchestration.generated.models.conditions_inner import ConditionsInner +# TODO: Rewrite to not use raise_errors +FilterConditions.model_rebuild(raise_errors=False) + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py new file mode 100644 index 0000000..f3f4b5b --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/filterconditions.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_condition import FilterCondition +from gen_ai_hub.tab_ai_orchestration.generated.models.filter_conditions import FilterConditions +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +FILTERCONDITIONS_ANY_OF_SCHEMAS = ["FilterCondition", "FilterConditions"] + +class Filterconditions(BaseModel): + """ + Filter conditions for context selection + """ + + # data type: FilterConditions + anyof_schema_1_validator: Optional[FilterConditions] = None + # data type: FilterCondition + anyof_schema_2_validator: Optional[FilterCondition] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[FilterCondition, FilterConditions]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "FilterCondition", "FilterConditions" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Filterconditions.model_construct() + error_messages = [] + # validate data type: FilterConditions + if not isinstance(v, FilterConditions): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterConditions`") + else: + return v + + # validate data type: FilterCondition + if not isinstance(v, FilterCondition): + error_messages.append(f"Error! Input type `{type(v)}` is not `FilterCondition`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Filterconditions with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[FilterConditions] = None + try: + instance.actual_instance = FilterConditions.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[FilterCondition] = None + try: + instance.actual_instance = FilterCondition.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Filterconditions with anyOf schemas: FilterCondition, FilterConditions. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], FilterCondition, FilterConditions]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py new file mode 100644 index 0000000..e37f3a1 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/http_validation_error.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.validation_error import ValidationError +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class HTTPValidationError(BaseModel): + """ + HTTPValidationError + """ # noqa: E501 + detail: Optional[List[ValidationError]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["detail"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HTTPValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in detail (list) + _items = [] + if self.detail: + for _item_detail in self.detail: + _items.append(_item_detail.to_dict() if _item_detail is not None else None) + _dict['detail'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HTTPValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py new file mode 100644 index 0000000..da4b6a3 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/location_inner.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"] + +class LocationInner(BaseModel): + """ + LocationInner + """ + + # data type: str + anyof_schema_1_validator: Optional[StrictStr] = None + # data type: int + anyof_schema_2_validator: Optional[StrictInt] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "int", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + instance = LocationInner.model_construct() + error_messages = [] + # validate data type: str + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: int + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + # deserialize data into str + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into int + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py new file mode 100644 index 0000000..695448d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt1.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt1(BaseModel): + """ + RPT1 Reference: https://help.sap.com/docs/sap-ai-core/generative-ai/example-payloads-for-inferencing-sap-rpt-1?locale=en-US#parameters + """ # noqa: E501 + index_column: Optional[StrictStr] = Field(default=None, description="(Optional) The name of the column used to identify the row. This column isn't used as an input feature for the model, and is returned in the response objects.") + data_schema: Optional[Dict[str, Dict[str, StrictStr]]] = Field(default=None, description="(Optional) A schema definition for data types of all columns. Possible values: string, numeric, or date.") + parse_data_types: Optional[StrictBool] = Field(default=True, description="(Optional, RPT default: True) Relevant when data_schema isn't passed. Whether or not to parse data types, such as interpreting strings as numbers or dates.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index_column", "data_schema", "parse_data_types"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if index_column (nullable) is None + # and model_fields_set contains the field + if self.index_column is None and "index_column" in self.model_fields_set: + _dict['index_column'] = None + + # set to None if data_schema (nullable) is None + # and model_fields_set contains the field + if self.data_schema is None and "data_schema" in self.model_fields_set: + _dict['data_schema'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index_column": obj.get("index_column"), + "data_schema": obj.get("data_schema"), + "parse_data_types": obj.get("parse_data_types") if obj.get("parse_data_types") is not None else True + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py new file mode 100644 index 0000000..d6f7c78 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt15(BaseModel): + """ + ModelRpt15 + """ # noqa: E501 + index_column: Optional[StrictStr] = Field(default=None, description="(Optional) The name of the column used to identify the row. This column isn't used as an input feature for the model, and is returned in the response objects.") + data_schema: Optional[Dict[str, Dict[str, StrictStr]]] = Field(default=None, description="(Optional) A schema definition for data types of all columns. Possible values: string, numeric, or date.") + parse_data_types: Optional[StrictBool] = Field(default=True, description="(Optional, RPT Default: True) Relevant when data_schema isn't passed. Whether or not to parse data types, such as interpreting strings as numbers or dates.") + prediction_config: Optional[ModelRpt15PredictionConfig] = Field(default=None, description="(Optional) An object for configuring predictions.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index_column", "data_schema", "parse_data_types", "prediction_config"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt15 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of prediction_config + if self.prediction_config: + _dict['prediction_config'] = self.prediction_config.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if index_column (nullable) is None + # and model_fields_set contains the field + if self.index_column is None and "index_column" in self.model_fields_set: + _dict['index_column'] = None + + # set to None if data_schema (nullable) is None + # and model_fields_set contains the field + if self.data_schema is None and "data_schema" in self.model_fields_set: + _dict['data_schema'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt15 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index_column": obj.get("index_column"), + "data_schema": obj.get("data_schema"), + "parse_data_types": obj.get("parse_data_types") if obj.get("parse_data_types") is not None else True, + "prediction_config": ModelRpt15PredictionConfig.from_dict(obj["prediction_config"]) if obj.get("prediction_config") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py new file mode 100644 index 0000000..a204190 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_explanations.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt15Explanations(BaseModel): + """ + ModelRpt15Explanations + """ # noqa: E501 + top_column_scores: Optional[Annotated[int, Field(le=20, strict=True, ge=0)]] = Field(default=0, description="(Optional, RPT Default: 0) Number of top column scores to return. A value of 0 disables explainability.") + top_relevant_context_rows: Optional[Annotated[int, Field(le=20, strict=True)]] = Field(default=None, description="(Optional) Number of most relevant context rows to return for each query row.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["top_column_scores", "top_relevant_context_rows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt15Explanations from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if top_relevant_context_rows (nullable) is None + # and model_fields_set contains the field + if self.top_relevant_context_rows is None and "top_relevant_context_rows" in self.model_fields_set: + _dict['top_relevant_context_rows'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt15Explanations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "top_column_scores": obj.get("top_column_scores") if obj.get("top_column_scores") is not None else 0, + "top_relevant_context_rows": obj.get("top_relevant_context_rows") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py new file mode 100644 index 0000000..401176d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/model_rpt15_prediction_config.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ModelRpt15PredictionConfig(BaseModel): + """ + ModelRpt15PredictionConfig + """ # noqa: E501 + explanations: Optional[ModelRpt15Explanations] = Field(default=None, description="(Optional) Configuration used to request explanations.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["explanations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ModelRpt15PredictionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of explanations + if self.explanations: + _dict['explanations'] = self.explanations.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ModelRpt15PredictionConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "explanations": ModelRpt15Explanations.from_dict(obj["explanations"]) if obj.get("explanations") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py new file mode 100644 index 0000000..1fc1a72 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/modelconfig.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt1 import ModelRpt1 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +MODELCONFIG_ONE_OF_SCHEMAS = ["ModelRpt1", "ModelRpt15"] + +class Modelconfig(BaseModel): + """ + (Optional) Any additional TFM-specific configurations that will be passed to the selected TFM. + """ + # data type: ModelRpt15 + oneof_schema_1_validator: Optional[ModelRpt15] = None + # data type: ModelRpt1 + oneof_schema_2_validator: Optional[ModelRpt1] = None + actual_instance: Optional[Union[ModelRpt1, ModelRpt15]] = None + one_of_schemas: Set[str] = { "ModelRpt1", "ModelRpt15" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = Modelconfig.model_construct() + error_messages = [] + match = 0 + # validate data type: ModelRpt15 + if not isinstance(v, ModelRpt15): + error_messages.append(f"Error! Input type `{type(v)}` is not `ModelRpt15`") + else: + match += 1 + # validate data type: ModelRpt1 + if not isinstance(v, ModelRpt1): + error_messages.append(f"Error! Input type `{type(v)}` is not `ModelRpt1`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into ModelRpt15 + try: + instance.actual_instance = ModelRpt15.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ModelRpt1 + try: + instance.actual_instance = ModelRpt1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Modelconfig with oneOf schemas: ModelRpt1, ModelRpt15. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], ModelRpt1, ModelRpt15]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py new file mode 100644 index 0000000..890fb3c --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_metadata.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictMetadata(BaseModel): + """ + Metadata about the prediction. + """ # noqa: E501 + num_columns: StrictInt + num_rows: StrictInt + num_predictions: StrictInt + num_query_rows: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["num_columns", "num_rows", "num_predictions", "num_query_rows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "num_columns": obj.get("num_columns"), + "num_rows": obj.get("num_rows"), + "num_predictions": obj.get("num_predictions"), + "num_query_rows": obj.get("num_query_rows") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py new file mode 100644 index 0000000..f6da192 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictRequest(BaseModel): + """ + Request schema for prediction endpoint. + """ # noqa: E501 + model_name: TFMEnum = Field(description="Name of the deployed model", serialization_alias="modelName") + scenario_config_name: StrictStr = Field(description="Scenario configuration identifier", serialization_alias="scenarioConfigName") + context_selection_config: Optional[ContextSelectionConfig] = Field(default=None, description="Context selection configuration", serialization_alias="contextSelectionConfig") + prediction_config: PredictionConfig = Field(description="Prediction configuration", serialization_alias="predictionConfig") + var_model_config: Optional[Modelconfig] = Field(default=None, serialization_alias="modelConfig") + columns: Optional[Dict[str, List[Any]]] = Field(default=None, description="Query-only rows in columnar form. An object mapping from column name to array of column values.") + context_columns: Optional[Dict[str, List[Any]]] = Field(default=None, description="(Optional) Context rows in columnar form, only relevant if 'columns' is provided. An object mapping from column name to array of column values.", serialization_alias="contextColumns") + rows: Optional[List[Dict[str, Any]]] = Field(default=None, description="Query-only rows in row form. An array of objects representing table rows.") + context_rows: Optional[List[Dict[str, Any]]] = Field(default=None, description="(Optional) Context rows in row form, only relevant if 'rows' is provided. An array of objects representing table rows.", serialization_alias="contextRows") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["modelName", "scenarioConfigName", "contextSelectionConfig", "predictionConfig", "modelConfig", "columns", "contextColumns", "rows", "contextRows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of context_selection_config + if self.context_selection_config: + _dict['contextSelectionConfig'] = self.context_selection_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of prediction_config + if self.prediction_config: + _dict['predictionConfig'] = self.prediction_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of var_model_config + if self.var_model_config: + _dict['modelConfig'] = self.var_model_config.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if context_selection_config (nullable) is None + # and model_fields_set contains the field + if self.context_selection_config is None and "context_selection_config" in self.model_fields_set: + _dict['contextSelectionConfig'] = None + + # set to None if columns (nullable) is None + # and model_fields_set contains the field + if self.columns is None and "columns" in self.model_fields_set: + _dict['columns'] = None + + # set to None if context_columns (nullable) is None + # and model_fields_set contains the field + if self.context_columns is None and "context_columns" in self.model_fields_set: + _dict['contextColumns'] = None + + # set to None if rows (nullable) is None + # and model_fields_set contains the field + if self.rows is None and "rows" in self.model_fields_set: + _dict['rows'] = None + + # set to None if context_rows (nullable) is None + # and model_fields_set contains the field + if self.context_rows is None and "context_rows" in self.model_fields_set: + _dict['contextRows'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modelName": obj.get("modelName"), + "scenarioConfigName": obj.get("scenarioConfigName"), + "contextSelectionConfig": ContextSelectionConfig.from_dict(obj["contextSelectionConfig"]) if obj.get("contextSelectionConfig") is not None else None, + "predictionConfig": PredictionConfig.from_dict(obj["predictionConfig"]) if obj.get("predictionConfig") is not None else None, + "modelConfig": Modelconfig.from_dict(obj["modelConfig"]) if obj.get("modelConfig") is not None else None, + "columns": obj.get("columns"), + "contextColumns": obj.get("contextColumns"), + "rows": obj.get("rows"), + "contextRows": obj.get("contextRows") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py new file mode 100644 index 0000000..3ba90a7 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_response.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_metadata import PredictMetadata +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_status import PredictStatus +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictResponse(BaseModel): + """ + Response schema for prediction endpoint. + """ # noqa: E501 + id: StrictStr + metadata: PredictMetadata + predictions: List[Dict[str, Any]] + status: PredictStatus + additional_information: Optional[List[StrictStr]] = Field(default=None, description="Warnings or informational messages from context selection") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "metadata", "predictions", "status", "additional_information"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of status + if self.status: + _dict['status'] = self.status.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "metadata": PredictMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "predictions": obj.get("predictions"), + "status": PredictStatus.from_dict(obj["status"]) if obj.get("status") is not None else None, + "additional_information": obj.get("additional_information") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py new file mode 100644 index 0000000..a25981f --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/predict_status.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictStatus(BaseModel): + """ + Status of the prediction. + """ # noqa: E501 + code: StrictInt + message: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py new file mode 100644 index 0000000..b36a139 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/prediction_config.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PredictionConfig(BaseModel): + """ + Configuration for what to predict. Model-agnostic prediction config. Only contains fields shared across all TFMs. Model-specific fields belong in `PredictRequest.modelConfig`. + """ # noqa: E501 + target_columns: Annotated[List[TargetColumn], Field(min_length=1)] = Field(description="List of target columns with prediction configuration", serialization_alias="targetColumns") + __properties: ClassVar[List[str]] = ["targetColumns"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PredictionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in target_columns (list) + _items = [] + if self.target_columns: + for _item_target_columns in self.target_columns: + _items.append(_item_target_columns.to_dict() if _item_target_columns is not None else None) + _dict['targetColumns'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PredictionConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "targetColumns": [TargetColumn.from_dict(_item) for _item in obj["targetColumns"]] if obj.get("targetColumns") is not None else None + }) + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py new file mode 100644 index 0000000..623f20d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_heuristic_config.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SamplingHeuristicConfig(BaseModel): + """ + SamplingHeuristicConfig + """ # noqa: E501 + method_ratio: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.67, description="Fraction of numRows filled by scoring method (remainder is random fill). Must be between 0 and 1.", serialization_alias="methodRatio") + fuzzy_num_pct: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.1, description="Numeric fuzzy threshold as a fraction of the absolute query value. E.g. 0.1 = +/-10%.", serialization_alias="fuzzyNumPct") + chunk_size: Optional[StrictInt] = Field(default=100, description="Max CASE WHEN expressions per subquery chunk (avoids HANA parse-tree depth limit).", serialization_alias="chunkSize") + chunk_threshold: Optional[StrictInt] = Field(default=150, description="Column count above which chunked SQL is used instead of a flat query.", serialization_alias="chunkThreshold") + pool_size: Optional[StrictInt] = Field(default=None, description="If set, scoring runs against a random subsample of this many rows instead of the full table. None = full table scan.", serialization_alias="poolSize") + fuzzy_date_days: Optional[StrictInt] = Field(default=30, description="Day window for fuzzy date matching. A date column scores 1 if abs(DAYS_BETWEEN(row_date, query_date)) <= dateFuzzyDays. Set to 0 for exact date match.", serialization_alias="fuzzyDateDays") + allow_timeout_fallback: Optional[StrictBool] = Field(default=False, description="When true, heuristic sampling falls back to random on timeout instead of raising an error. Set by the orchestrator when strategy=AUTO.", serialization_alias="allowTimeoutFallback") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["methodRatio", "fuzzyNumPct", "chunkSize", "chunkThreshold", "poolSize", "fuzzyDateDays", "allowTimeoutFallback"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SamplingHeuristicConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if pool_size (nullable) is None + # and model_fields_set contains the field + if self.pool_size is None and "pool_size" in self.model_fields_set: + _dict['poolSize'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SamplingHeuristicConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "methodRatio": obj.get("methodRatio") if obj.get("methodRatio") is not None else 0.67, + "fuzzyNumPct": obj.get("fuzzyNumPct") if obj.get("fuzzyNumPct") is not None else 0.1, + "chunkSize": obj.get("chunkSize") if obj.get("chunkSize") is not None else 100, + "chunkThreshold": obj.get("chunkThreshold") if obj.get("chunkThreshold") is not None else 150, + "poolSize": obj.get("poolSize"), + "fuzzyDateDays": obj.get("fuzzyDateDays") if obj.get("fuzzyDateDays") is not None else 30, + "allowTimeoutFallback": obj.get("allowTimeoutFallback") if obj.get("allowTimeoutFallback") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py new file mode 100644 index 0000000..10b782b --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/sampling_random_config.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SamplingRandomConfig(BaseModel): + """ + SamplingRandomConfig + """ # noqa: E501 + deterministic: Optional[StrictBool] = Field(default=False, description="When true, uses HASH_SHA256 of indexColumn for ordering instead of RAND(), producing the same row order on every call for the same data.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deterministic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SamplingRandomConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SamplingRandomConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deterministic": obj.get("deterministic") if obj.get("deterministic") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py new file mode 100644 index 0000000..6b35ad4 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/strategyconfig.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_heuristic_config import SamplingHeuristicConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.sampling_random_config import SamplingRandomConfig +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +STRATEGYCONFIG_ANY_OF_SCHEMAS = ["SamplingHeuristicConfig", "SamplingRandomConfig"] + +class Strategyconfig(BaseModel): + """ + Strategy-specific configuration parameters. + """ + + # data type: SamplingRandomConfig + anyof_schema_1_validator: Optional[SamplingRandomConfig] = None + # data type: SamplingHeuristicConfig + anyof_schema_2_validator: Optional[SamplingHeuristicConfig] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[SamplingHeuristicConfig, SamplingRandomConfig]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "SamplingHeuristicConfig", "SamplingRandomConfig" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = Strategyconfig.model_construct() + error_messages = [] + # validate data type: SamplingRandomConfig + if not isinstance(v, SamplingRandomConfig): + error_messages.append(f"Error! Input type `{type(v)}` is not `SamplingRandomConfig`") + else: + return v + + # validate data type: SamplingHeuristicConfig + if not isinstance(v, SamplingHeuristicConfig): + error_messages.append(f"Error! Input type `{type(v)}` is not `SamplingHeuristicConfig`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in Strategyconfig with anyOf schemas: SamplingHeuristicConfig, SamplingRandomConfig. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # anyof_schema_1_validator: Optional[SamplingRandomConfig] = None + try: + instance.actual_instance = SamplingRandomConfig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[SamplingHeuristicConfig] = None + try: + instance.actual_instance = SamplingHeuristicConfig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into Strategyconfig with anyOf schemas: SamplingHeuristicConfig, SamplingRandomConfig. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], SamplingHeuristicConfig, SamplingRandomConfig]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py new file mode 100644 index 0000000..681f95c --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/target_column.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TargetColumn(BaseModel): + """ + Configuration for a target column to predict. + """ # noqa: E501 + name: StrictStr = Field(description="Name of the column to predict") + prediction_placeholder: Optional[StrictStr] = Field(default='[PREDICT]', description="(Optional) Placeholder value indicating cells to predict") + task_type: Optional[TaskTypeEnum] = Field(default=None, description="(Optional) Type of prediction task (classification or regression)") + top_k: Optional[StrictInt] = Field(default=None, description="(Optional) Controls how many labels to predict for each column in each row. Only applicable to 'classification' task type.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "prediction_placeholder", "task_type", "top_k"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TargetColumn from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if top_k (nullable) is None + # and model_fields_set contains the field + if self.top_k is None and "top_k" in self.model_fields_set: + _dict['top_k'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TargetColumn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "prediction_placeholder": obj.get("prediction_placeholder") if obj.get("prediction_placeholder") is not None else '[PREDICT]', + "task_type": obj.get("task_type"), + "top_k": obj.get("top_k") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py new file mode 100644 index 0000000..6987187 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/task_type_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TaskTypeEnum(str, Enum): + """ + ML task types for predictions. + """ + + """ + allowed enum values + """ + CLASSIFICATION = 'classification' + REGRESSION = 'regression' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TaskTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py new file mode 100644 index 0000000..af3c525 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/tfm_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TFMEnum(str, Enum): + """ + Supported Tabular Foundation Models. + """ + + """ + allowed enum values + """ + SAP_MINUS_RPT_MINUS_1_MINUS_SMALL = 'sap-rpt-1-small' + SAP_MINUS_RPT_MINUS_1_MINUS_LARGE = 'sap-rpt-1-large' + SAP_MINUS_RPT_MINUS_1_DOT_5 = 'sap-rpt-1.5' + SAP_MINUS_RPT_MINUS_1_DOT_5_MINUS_LARGE = 'sap-rpt-1.5-large' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TFMEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py new file mode 100644 index 0000000..2ab7b7c --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/models/validation_error.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from gen_ai_hub.tab_ai_orchestration.generated.models.location_inner import LocationInner +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ValidationError(BaseModel): + """ + ValidationError + """ # noqa: E501 + loc: List[LocationInner] + msg: StrictStr + type: StrictStr + input: Optional[Any] = None + ctx: Optional[Dict[str, Any]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in loc (list) + _items = [] + if self.loc: + for _item_loc in self.loc: + _items.append(_item_loc.to_dict() if _item_loc is not None else None) + _dict['loc'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if input (nullable) is None + # and model_fields_set contains the field + if self.input is None and "input" in self.model_fields_set: + _dict['input'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loc": [LocationInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None, + "msg": obj.get("msg"), + "type": obj.get("type"), + "input": obj.get("input"), + "ctx": obj.get("ctx") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/py.typed b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py new file mode 100644 index 0000000..bf2e4fb --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/rest.py @@ -0,0 +1,201 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl +from typing import Optional, Union + +import httpx + +from gen_ai_hub.tab_ai_orchestration.generated.exceptions import ApiException, ApiValueError + +RESTResponseType = httpx.Response + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status_code + self.reason = resp.reason_phrase + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.aread() + return self.data + + @property + def headers(self): + """Returns a CIMultiDictProxy of response headers.""" + return self.response.headers + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header; use ``headers`` instead.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + + # maxsize is number of requests to host that are allowed in parallel + self.maxsize = configuration.connection_pool_maxsize + + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, + ) + if configuration.cert_file: + self.ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + if not configuration.verify_ssl: + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE + + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers + + self.pool_manager: Optional[httpx.AsyncClient] = None + + async def close(self): + if self.pool_manager is not None: + await self.pool_manager.aclose() + + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None): + """Execute request + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + args["json"] = body + if body is None and post_params: + args["json"] = dict(post_params) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + args["data"] = dict(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by httpx + del headers['Content-Type'] + + files = [] + data = {} + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + files.append((k, v)) + else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) + data[k] = v + + if files: + args["files"] = files + if data: + args["data"] = data + + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + if self.pool_manager is None: + self.pool_manager = self._create_pool_manager() + + r = await self.pool_manager.request(**args) + return RESTResponse(r) + + def _create_pool_manager(self) -> httpx.AsyncClient: + limits = httpx.Limits(max_connections=self.maxsize) + + proxy = None + if self.proxy: + proxy = httpx.Proxy( + url=self.proxy, + headers=self.proxy_headers + ) + + return httpx.AsyncClient( + limits=limits, + proxy=proxy, + verify=self.ssl_context, + trust_env=True + ) diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py new file mode 100644 index 0000000..e5e47f0 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/generated/sync_helper.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + Tabular AI Orchestrator + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import threading +from typing import Any, Coroutine, Optional, TypeVar + +T = TypeVar("T") + +_loop: Optional[asyncio.AbstractEventLoop] = None +_loop_lock = threading.Lock() + + +def _get_sync_loop() -> asyncio.AbstractEventLoop: + """Return a dedicated event loop running in a background daemon thread. + + A single, long-lived loop is reused for every synchronous call so that the + underlying ``httpx.AsyncClient`` (and its connection pool) stays bound to one + event loop across calls. The loop is created lazily and in a thread-safe way. + """ + global _loop + if _loop is None: + with _loop_lock: + if _loop is None: + loop = asyncio.new_event_loop() + thread = threading.Thread( + target=loop.run_forever, + name="generated-sync-runner", + daemon=True, + ) + thread.start() + _loop = loop + return _loop + + +def run_sync(coro: Coroutine[Any, Any, T]) -> T: + """Run an async coroutine to completion and return its result synchronously. + + The coroutine is scheduled on a dedicated background event loop and the + calling thread blocks until it finishes. This is used to expose synchronous + ``_sync`` variants of the asynchronous API methods. + + Note: this must not be called from within a running event loop (i.e. from + ``async`` code) as it would block that loop; use the ``await``-able async + methods directly in that case. + """ + return asyncio.run_coroutine_threadsafe(coro, _get_sync_loop()).result() diff --git a/packages/gen/openapitools.json b/packages/gen/openapitools.json new file mode 100644 index 0000000..8dd0d74 --- /dev/null +++ b/packages/gen/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.25.0" + } +} diff --git a/packages/gen/specs/document-grounding/api.yaml b/packages/gen/specs/document-grounding/api.yaml new file mode 100644 index 0000000..44d2846 --- /dev/null +++ b/packages/gen/specs/document-grounding/api.yaml @@ -0,0 +1,4686 @@ +openapi: 3.0.0 +info: + title: Grounding + version: 0.1.0 + description: Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + contact: + name: SAP AI Core +x-sap-shortText: Enhance content generation with additional capabilities for business AI scenarios. +externalDocs: + description: Documentation for SAP AI Core - Grounding + url: https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/grounding +tags: + - name: Pipelines + description: Tag for pipelines component + - name: Vector + description: Tag for vector component + - name: Retrieval + description: Tag for retrieval component +servers: + - url: 'https://api.ai.{region}.ml.hana.ondemand.com/v2/lm/{service}' + description: Production endpoint for SAP AI Core + variables: + region: + enum: + - prod.eu-central-1.aws + - prodeuonly.eu-central-1.aws + - prod.us-east-1.aws + - prod.ap-northeast-1.aws + - prod.ap-southeast-2.aws + - prod-eu20.westeurope.azure + - prod-eu30.europe-west3.gcp + - prod-us21.eastus.azure + - prod-us30.us-central1.gcp + - prod-ap20.australiaeast.az + - prod-ap11.ap-southeast-1.aws + default: prod.eu-central-1.aws + service: + default: document-grounding +paths: + '/pipelines': + post: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.create_pipeline + summary: Pipeline Creation + description: Create a pipeline + x-sap-cloud-sdk-operation-name: createPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createPipeline' + responses: + '201': + description: Returns pipelineId on successful creation. + content: + application/json: + schema: + $ref: '#/components/schemas/pipelineId' + '400': + $ref: '#/components/responses/BadRequest' + get: + tags: + - Pipelines + parameters: + - name: metadataConfigId + in: query + required: false + schema: + type: string + description: Filter pipelines based on metadataConfigId + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + operationId: pipeline.v1.pipeline_endpoints.get_all_pipeline + summary: Get Pipelines + description: Get all pipelines + x-sap-cloud-sdk-operation-name: getAllPipelines + responses: + '200': + description: Returns all pipelines for the tenant. + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelines' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/{pipelineId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_by_id + summary: Get details of a Pipeline + description: Get details of a pipeline by pipeline id + x-sap-cloud-sdk-operation-name: getPipelineById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + responses: + '200': + description: Returns the pipeline for an pipelineId + content: + application/json: + schema: + $ref: '#/components/schemas/getPipeline' + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.delete_pipeline_by_id + summary: Delete pipeline + description: Delete a pipeline by pipeline id + x-sap-cloud-sdk-operation-name: deletePipelineById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to delete. + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequest' + patch: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.patch_pipeline_by_id + summary: Patch pipeline + description: Patch a pipeline by pipeline id + x-sap-cloud-sdk-operation-name: patchPipelineById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to patch. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/patchPipeline' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/{pipelineId}/status': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_status + summary: Get status of Pipeline + description: Get pipeline status by pipeline id + x-sap-cloud-sdk-operation-name: getPipelineStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get status. + responses: + '200': + description: Returns the pipeline status for an pipelineId. + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelineStatus' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/search': + post: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.search_pipeline + summary: Pipeline Search by Metadata + description: Search for pipelines based on metadata + x-sap-cloud-sdk-operation-name: searchPipelinesByMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/searchPipeline' + responses: + '200': + description: Returns pipelines for the tenant that matches the metadata + content: + application/json: + schema: + $ref: '#/components/schemas/searchPipelinesResponse' + '400': + $ref: '#/components/responses/BadRequest' + + ### ### ### Pipeline Status API ### ### + ### ### ######################### ### ### + '/pipelines/{pipelineId}/executions': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_executions + summary: Get Pipeline Executions + description: Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + x-sap-cloud-sdk-operation-name: getAllExecutionsForPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: lastExecution + in: query + required: false + schema: + type: boolean + description: Filter to get the last execution + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Returns all executions + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelineExecutions' + + '/pipelines/{pipelineId}/executions/{executionId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_execution_by_id + summary: Get Pipeline Execution by ID + description: Retrieve details of a specific pipeline execution by its execution ID. + x-sap-cloud-sdk-operation-name: getExecutionDetailsByIdForPipelineExecution + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: executionId + in: path + required: true + schema: + type: string + description: The ID of the execution + responses: + '200': + description: Returns a response to execution id + content: + application/json: + schema: + $ref: '#/components/schemas/getPipelineExecutionById' + + '/pipelines/{pipelineId}/executions/{executionId}/documents': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_execution_documents + summary: Get Documents for a Pipeline Execution + description: Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + x-sap-cloud-sdk-operation-name: getDocumentsForPipelineExecution + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: executionId + in: path + required: true + schema: + type: string + description: The ID of the execution + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Returns a response to execution id + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsStatusResponse' + + '/pipelines/{pipelineId}/executions/{executionId}/documents/{documentId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_execution_document_by_id + summary: Get Document by ID for a Pipeline Execution + description: Retrieve details of a specific document associated with a pipeline execution. + x-sap-cloud-sdk-operation-name: getDocumentByIdForPipelineExecution + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline + - name: executionId + in: path + required: true + schema: + type: string + description: The ID of the execution + - name: documentId + in: path + required: true + schema: + type: string + description: The ID of the document to get. + responses: + '200': + description: Returns a response to execution id and document id. + content: + application/json: + schema: + $ref: '#/components/schemas/PipelineDocumentResponse' + + '/pipelines/{pipelineId}/documents': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_documents + summary: Get Documents for a Pipeline + description: Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + x-sap-cloud-sdk-operation-name: getAllDocumentsForPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Returns all documents for a pipeline. + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsStatusResponse' + + '/pipelines/{pipelineId}/documents/{documentId}': + get: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_document_by_id + summary: Get Document by ID for a Pipeline + description: Retrieve details of a specific document associated with a pipeline. + x-sap-cloud-sdk-operation-name: getDocumentByIdForPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + - name: documentId + in: path + required: true + schema: + type: string + description: The ID of the document to get. + responses: + '200': + description: Returns a response to document id. + content: + application/json: + schema: + $ref: '#/components/schemas/PipelineDocumentResponse' + + '/pipelines/trigger': + post: + tags: + - Pipelines + operationId: pipeline.v1.pipeline_endpoints.trigger_pipeline + summary: Pipeline Trigger + description: Manually trigger a pipeline + x-sap-cloud-sdk-operation-name: manualTriggerPipeline + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/manualPipelineTrigger' + responses: + '202': + description: Accepted + headers: + Location: + description: Location of the triggered pipeline execution + schema: + type: string + format: uri + '400': + $ref: '#/components/responses/BadRequest' + + '/pipelines/metadata/configurations': + post: + tags: + - Metadata Configurations + summary: Create a metadata configuration + description: Creates a new metadata configuration. + operationId: metadata_management.v1.metadata_endpoints.create_metadata_configuration + x-sap-cloud-sdk-operation-name: createMetadataConfiguration + requestBody: + required: true + x-body-name: config_payload + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataConfigurationRequest' + responses: + '202': + description: Accepted - Document enumeration in progress + headers: + Location: + description: URI of the created metadata configuration resource + schema: + type: string + example: /metadata/configurations/7e2b1111-aaaa-bbbb-cccc-123456789abc + '400': + $ref: '#/components/responses/BadRequest' + get: + tags: + - Metadata Configurations + summary: List metadata configurations + description: List all metadata configurations + operationId: metadata_management.v1.metadata_endpoints.list_metadata_configurations + x-sap-cloud-sdk-operation-name: listMetadataConfigurations + parameters: + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Paginated list of configurations + content: + application/json: + schema: + $ref: '#/components/schemas/ListMetadataConfigurations' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/metadata/configurations/{metadataConfigId}': + get: + tags: + - Metadata Configurations + summary: Get a configuration by ID + description: Get the details of a configuration by ID + operationId: metadata_management.v1.metadata_endpoints.get_metadata_configuration_by_id + x-sap-cloud-sdk-operation-name: getMetadataConfigurationById + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + responses: + '200': + description: Configuration found + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataConfigurationResponse' + '404': + description: Configuration not found + '400': + $ref: '#/components/responses/BadRequest' + delete: + tags: + - Metadata Configurations + summary: Delete a configuration by ID + description: Delete a metadata configuration by ID + operationId: metadata_management.v1.metadata_endpoints.delete_metadata_configuration_by_id + x-sap-cloud-sdk-operation-name: deleteMetadataConfigurationById + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + responses: + '202': + description: Configuration deletion initiated + '404': + description: Configuration not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: Internal server error during deletion of configuration + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '409': + description: Pipelines exists for this configuration. Delete the pipelines before deleting the configuration. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '/pipelines/metadata/configurations/{metadataConfigId}/documents': + get: + tags: + - Metadata Configurations + summary: List documents of a configuration + description: List the documents for a configuration + operationId: metadata_management.v1.metadata_endpoints.list_metadata_configuration_documents + x-sap-cloud-sdk-operation-name: listMetadataConfigurationDocuments + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + - in: query + name: absolutePath + schema: + type: string + description: > + Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: List of documents + content: + application/json: + schema: + $ref: '#/components/schemas/ListConfigurationDocuments' + patch: + tags: + - Metadata Configurations + summary: Batch update metadata for multiple documents + description: Patch the documents of a configuration in batch + operationId: metadata_management.v1.metadata_endpoints.batch_update_documents_metadata + x-sap-cloud-sdk-operation-name: batchUpdateDocumentsMetadata + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + requestBody: + required: true + x-body-name: documents_metadata_payload + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/DocumentMetadataBatchRequest' + responses: + '200': + description: Batch patch applied successfully + content: + application/json: + schema: + $ref: '#/components/schemas/BatchUpdateDocumentsResponse' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/metadata/configurations/{metadataConfigId}/documents/{documentId}': + get: + tags: + - Metadata Configurations + summary: Get document details + description: Get the details of a document by document id + operationId: metadata_management.v1.metadata_endpoints.get_document_details + x-sap-cloud-sdk-operation-name: getMetadataDocumentDetails + parameters: + - name: metadataConfigId + in: path + required: true + schema: + type: string + description: Metadata Configuration ID + - name: documentId + in: path + required: true + schema: + type: string + description: Document ID + responses: + '200': + description: Document details + content: + application/json: + schema: + $ref: '#/components/schemas/ConfigurationDocument' + '404': + description: Document or configuration not found + '400': + $ref: '#/components/responses/BadRequest' + + '/vector/collections': + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + tags: + - Vector + summary: Get collections + description: Gets a list of collections. + operationId: vector.v1.vector_endpoints.get_all_collections + x-sap-cloud-sdk-operation-name: getAllCollections + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + tags: + - Vector + summary: Create collection + description: Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + operationId: vector.v1.vector_endpoints.create_collection + x-sap-cloud-sdk-operation-name: createCollection + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionRequest' + required: true + responses: + '202': + description: Successful Response + headers: + Location: + description: The newly created collections monitor url + schema: + type: string + format: uri + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}': + get: + tags: + - Vector + summary: Get collection by ID + description: Gets a specific collection by ID. + operationId: vector.v1.vector_endpoints.get_collection_by_id + x-sap-cloud-sdk-operation-name: getCollectionById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + delete: + tags: + - Vector + summary: Delete collection by ID + description: Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + operationId: vector.v1.vector_endpoints.delete_collection + x-sap-cloud-sdk-operation-name: deleteCollectionById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + title: Collectionid + description: Collection ID + responses: + '202': + description: Successful Response + headers: + Location: + description: The deleted collections monitor url + schema: + type: string + format: uri + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}/documents/{documentId}': + get: + tags: + - Vector + summary: Get document by ID + description: Gets a specific document in a collection by ID. + operationId: vector.v1.vector_endpoints.get_document_by_id + x-sap-cloud-sdk-operation-name: getDocumentById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + - name: documentId + in: path + required: true + schema: + type: string + format: uuid + title: Documentid + description: Document ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + delete: + tags: + - Vector + summary: Delete a document + description: Deletes a specific document of a collection. + operationId: vector.v1.vector_endpoints.delete_document + x-sap-cloud-sdk-operation-name: deleteDocumentById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + - name: documentId + in: path + required: true + schema: + type: string + format: uuid + title: Documentid + description: Document ID + responses: + '204': + description: Successful Response + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}/documents': + get: + tags: + - Vector + summary: Get documents + description: Gets a list of documents of a collection. + operationId: vector.v1.vector_endpoints.get_all_documents + x-sap-cloud-sdk-operation-name: getAllDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Documents' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + post: + tags: + - Vector + summary: Create documents in collection + description: Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + operationId: vector.v1.vector_endpoints.create_documents + x-sap-cloud-sdk-operation-name: createDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentCreateRequest' + responses: + '201': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + patch: + tags: + - Vector + summary: Upsert documents in collection + description: Upserts the data of multiple documents into a collection. + operationId: vector.v1.vector_endpoints.update_documents + x-sap-cloud-sdk-operation-name: updateDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + description: Collection ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentUpdateRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/search': + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + tags: + - Vector + summary: Search chunk by vector + description: Search chunks + operationId: vector.v1.vector_endpoints.search_chunk + x-sap-cloud-sdk-operation-name: search + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TextSearchRequest' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/VectorSearchResults' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{id}/creationStatus': + get: + tags: + - Vector + summary: Get collection status by ID + description: Gets a specific collection status from monitor by ID. + operationId: vector.v1.vector_endpoints.get_collection_creation_status + x-sap-cloud-sdk-operation-name: getCollectionCreationStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: id + in: path + required: true + schema: + type: string + format: uuid + title: ID + description: Collection ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CollectionCreatedResponse' + - $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{id}/deletionStatus': + get: + tags: + - Vector + summary: Get collection status by ID + description: Gets a specific collection status from monitor by ID. + operationId: vector.v1.vector_endpoints.get_collection_deletion_status + x-sap-cloud-sdk-operation-name: getCollectionDeletionStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: id + in: path + required: true + schema: + type: string + format: uuid + title: Id + description: Collection ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CollectionDeletedResponse' + - $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/documents': + delete: + tags: + - Vector + summary: Delete list of documents across collections + description: Deletes list of documents across collections. + operationId: vector.v1.vector_endpoints.delete_all_documents + x-sap-cloud-sdk-operation-name: deleteAllDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentBulkDeleteRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentBulkDeleteResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/metadata': + patch: + tags: + - Vector + summary: Patch collections metadata + description: Allows to add, remove and modify the collections metadata. + operationId: vector.v1.vector_endpoints.update_collections_metadata + x-sap-cloud-sdk-operation-name: updateCollectionsMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/documents/metadata': + patch: + tags: + - Vector + summary: Patch documents metadata + description: Allows to add, remove and modify the documents metadata. + operationId: vector.v1.vector_endpoints.update_documents_metadata + x-sap-cloud-sdk-operation-name: updateDocumentsMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/chunks/metadata': + patch: + tags: + - Vector + summary: Patch chunks metadata + description: Allows to add, remove and modify the chunks metadata. + operationId: vector.v1.vector_endpoints.update_chunks_metadata + x-sap-cloud-sdk-operation-name: updateChunksMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/retrieval/dataRepositories': + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + tags: + - Retrieval + summary: List all DataRepository objects. + description: List all Data Repositories + operationId: retrieval.v1.retrieval_endpoints.get_data_repositories + x-sap-cloud-sdk-operation-name: getDataRepositories + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DataRepositories' + '400': + $ref: '#/components/responses/BadRequest' + '/retrieval/dataRepositories/{repositoryId}': + get: + tags: + - Retrieval + summary: List single DataRepository object. + description: List data repository by id + operationId: retrieval.v1.retrieval_endpoints.get_data_repository + x-sap-cloud-sdk-operation-name: getDataRepositoryById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + - name: repositoryId + in: path + required: true + schema: + type: string + format: uuid + title: Repositoryid + description: Repository ID + - name: remoteName + in: query + required: false + schema: + type: string + minLength: 1 + nullable: true + title: Remotename + description: Remote name if DataRepository is from remote DG. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DataRepository' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '404': + $ref: '#/components/responses/NotFound' + '/retrieval/search': + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + tags: + - Retrieval + summary: Retrieve relevant content + description: Retrieve relevant content given a query string. + operationId: retrieval.v1.retrieval_endpoints.search + x-sap-cloud-sdk-operation-name: search + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RetrievalSearchInput' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/RetrievalSearchResults' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + +components: + securitySchemes: + Oauth2: + type: oauth2 + description: OAuth client credentials (client ID and secret) are required. These can be requested from SAP BTP cloud cockpit. + flows: + clientCredentials: + tokenUrl: https://(subdomain_identity_zone).authentication.(host)/oauth/token + scopes: {} + schemas: + createPipeline: + oneOf: + - $ref: '#/components/schemas/MSSharePointPipelineCreateRequest' + - $ref: '#/components/schemas/S3PipelineCreateRequest' + - $ref: '#/components/schemas/SFTPPipelineCreateRequest' + - $ref: '#/components/schemas/SDMPipelineCreateRequest' + - $ref: '#/components/schemas/WorkZonePipelineCreateRequest' + - $ref: '#/components/schemas/ServiceNowPipelineCreateRequest' + - $ref: '#/components/schemas/GoogleDrivePipelineCreateRequest' + - $ref: '#/components/schemas/MetadataConfiguration' + discriminator: + propertyName: type + mapping: + MSSharePoint: '#/components/schemas/MSSharePointPipelineCreateRequest' + S3: '#/components/schemas/S3PipelineCreateRequest' + SFTP: '#/components/schemas/SFTPPipelineCreateRequest' + SDM: '#/components/schemas/SDMPipelineCreateRequest' + WorkZone: '#/components/schemas/WorkZonePipelineCreateRequest' + ServiceNow: '#/components/schemas/ServiceNowPipelineCreateRequest' + GoogleDrive: '#/components/schemas/GoogleDrivePipelineCreateRequest' + metadata: '#/components/schemas/MetadataConfiguration' + + manualPipelineTrigger: + type: object + properties: + pipelineId: + type: string + example: uuid + metadataOnly: + type: boolean + example: True + + MSSharePointPipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: [MSSharePoint] + configuration: + $ref: '#/components/schemas/MSSharePointConfiguration' + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + S3PipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: [S3] + configuration: + $ref: '#/components/schemas/S3Configuration' + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + SFTPPipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: [SFTP] + configuration: + $ref: '#/components/schemas/SFTPConfiguration' + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + SDMPipelineCreateRequest: + type: object + required: + - type + - metadata + properties: + type: + type: string + enum: [SDM] + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + WorkZonePipelineCreateRequest: + type: object + required: + - type + - metadata + properties: + type: + type: string + enum: [WorkZone] + metadata: + $ref: '#/components/schemas/MetaData' + additionalProperties: true + + ServiceNowPipelineCreateRequest: + type: object + required: + - type + properties: + type: + type: string + enum: ['ServiceNow'] + metadata: + $ref: '#/components/schemas/MetaData' + configuration: + $ref: '#/components/schemas/ServiceNowConfigurationStruct' + additionalProperties: true + + MetadataConfiguration: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: ['metadata'] + configuration: + $ref: '#/components/schemas/MetadataConfigurationStruct' + metadata: + type: object + properties: + dataRepositoryMetadata: + $ref: '#/components/schemas/DataRepositoryMetaDataStrict' + required: + - dataRepositoryMetadata + additionalProperties: true + + MetadataConfigurationStruct: + type: object + properties: + metadataConfigId: + type: string + minLength: 1 + example: uuid + cronExpression: + type: string + description: | + Optional cron expression for scheduling pipeline execution. + Must represent an interval greater than 1 hour. + example: '0 */20 * * *' + required: + - metadataConfigId + additionalProperties: true + + # null is not allowed as the 'value' inside the items + DataRepositoryMetaDataStrict: + type: array + items: + $ref: '#/components/schemas/MetaDataKeyValuePairStrict' + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + + # null is not allowed as the 'value' + MetaDataKeyValuePairStrict: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + additionalProperties: true + + ServiceNowConfigurationStruct: + type: object + required: + - destination + properties: + destination: + type: string + example: destination-name + serviceNow: + $ref: '#/components/schemas/ServiceNowConfig' + metadataConfigId: + type: string + example: uuid + cronExpression: + type: string + description: | + Optional cron expression for scheduling pipeline execution. + Must represent an interval greater than 1 hour. + example: '0 */20 * * *' + additionalProperties: true + + ServiceNowConfig: + type: object + properties: + includePaths: + type: array + items: + type: string + minItems: 1 + example: + - active=true + - sys_domain_path=/health + additionalProperties: true + + GoogleDrivePipelineCreateRequest: + type: object + required: + - type + - configuration + properties: + type: + type: string + enum: ['GoogleDrive'] + metadata: + $ref: '#/components/schemas/MetaData' + configuration: + $ref: '#/components/schemas/GoogleDriveConfigurationStruct' + + GoogleDriveConfigurationStruct: + type: object + required: + - destination + - googleDrive + properties: + destination: + type: string + example: destination-name + googleDrive: + $ref: '#/components/schemas/GoogleDriveConfig' + cronExpression: + type: string + description: | + Optional cron expression for scheduling pipeline execution. + Must represent an interval greater than 1 hour. + example: '0 */20 * * *' + metadataConfigId: + type: string + example: uuid + additionalProperties: true + + GoogleDriveConfig: + type: object + required: + - resourceType + properties: + resourceType: + type: string + enum: ['SHARED_FOLDER', 'SHARED_DRIVE'] + example: 'SHARED_DRIVE' + resourceId: + type: string + example: '0AGVUFpXcXc5Uk9PVA' + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: true + + GoogleDriveResourceDetail: + type: object + properties: + resourceType: + type: string + enum: ['SHARED_FOLDER', 'SHARED_DRIVE'] + example: 'SHARED_DRIVE' + resourceId: + type: string + example: '0AGVUFpXcXc5Uk9PVA' + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: true + + ServiceNowConfigurationMinimal: + type: object + required: + - destination + properties: + destination: + type: string + example: destination-name + serviceNow: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: false + + GoogleDriveConfigurationMinimal: + type: object + required: + - googleDrive + properties: + googleDrive: + $ref: '#/components/schemas/GoogleDriveResourceDetail' + additionalProperties: false + + MSSharePointConfiguration: + type: object + required: + - destination + - sharePoint + properties: + destination: + type: string + example: generic-secret-name + sharePoint: + $ref: '#/components/schemas/SharePointConfig' + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + additionalProperties: true + + SharePointConfig: + type: object + required: + - site + properties: + site: + $ref: '#/components/schemas/SharePointSite' + additionalProperties: true + + SharePointSite: + type: object + required: + - name + properties: + name: + type: string + example: sharepoint-site-name + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: true + + SFTPConfiguration: + type: object + required: + - destination + properties: + destination: + type: string + example: generic-secret-name + sftp: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + additionalProperties: true + + S3Configuration: + type: object + required: + - destination + properties: + destination: + type: string + example: generic-secret-name + s3: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + additionalProperties: true + + MetaData: + type: object + properties: + destination: + type: string + example: destination-name + dataRepositoryMetadata: + type: array + items: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + additionalProperties: true + + getPipelines: + type: object + required: + - resources + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/getPipeline' + + getPipeline: + oneOf: + - $ref: '#/components/schemas/MSSharePointPipelineGetResponse' + - $ref: '#/components/schemas/S3PipelineGetResponse' + - $ref: '#/components/schemas/SFTPPipelineGetResponse' + - $ref: '#/components/schemas/SDMPipelineGetResponse' + - $ref: '#/components/schemas/WorkZonePipelineGetResponse' + - $ref: '#/components/schemas/ServiceNowPipelineGetResponse' + - $ref: '#/components/schemas/GoogleDrivePipelineGetResponse' + discriminator: + propertyName: type + mapping: + MSSharePoint: '#/components/schemas/MSSharePointPipelineGetResponse' + S3: '#/components/schemas/S3PipelineGetResponse' + SFTP: '#/components/schemas/SFTPPipelineGetResponse' + SDM: '#/components/schemas/SDMPipelineGetResponse' + WorkZone: '#/components/schemas/WorkZonePipelineGetResponse' + ServiceNow: '#/components/schemas/ServiceNowPipelineGetResponse' + GoogleDrive: '#/components/schemas/GoogleDrivePipelineGetResponse' + + MSSharePointPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: [MSSharePoint] + configuration: + $ref: '#/components/schemas/MSSharePointConfigurationGetResponse' + + S3PipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: [S3] + configuration: + $ref: '#/components/schemas/S3Configuration' + + SFTPPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: [SFTP] + configuration: + $ref: '#/components/schemas/SFTPConfiguration' + + SDMPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - metadata + properties: + type: + type: string + enum: [SDM] + metadata: + $ref: '#/components/schemas/MetaData' + + WorkZonePipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - metadata + properties: + type: + type: string + enum: [WorkZone] + metadata: + $ref: '#/components/schemas/MetaData' + + ServiceNowPipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: ['ServiceNow'] + configuration: + $ref: '#/components/schemas/ServiceNowConfigurationMinimal' + + GoogleDrivePipelineGetResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineResponse' + - type: object + required: + - configuration + properties: + type: + type: string + enum: ['GoogleDrive'] + configuration: + $ref: '#/components/schemas/GoogleDriveConfigurationMinimal' + + BasePipelineResponse: + type: object + required: + - id + - type + properties: + id: + type: string + type: + type: string + metadata: + $ref: '#/components/schemas/MetaData' + + MSSharePointConfigurationGetResponse: + type: object + required: + - destination + - sharePoint + properties: + destination: + type: string + sharePoint: + $ref: '#/components/schemas/SharePointConfigGetResponse' + + SharePointConfigGetResponse: + type: object + required: + - site + properties: + site: + $ref: '#/components/schemas/SharePointSiteGetResponse' + + SharePointSiteGetResponse: + type: object + required: + - name + properties: + id: + type: string + name: + type: string + includePaths: + type: array + items: + type: string + + pipelineId: + type: object + properties: + pipelineId: + type: string + example: uuid + + PipelineExecutionData: + type: object + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + createdAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00Z' + nullable: true + modifiedAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00Z' + nullable: true + + getPipelineStatus: + type: object + properties: + lastStarted: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00.000Z' + createdAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00.000Z' + nullable: true + lastCompletedAt: + type: string + pattern: '^$|^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$' + example: '2024-02-15T12:45:00.000Z' + nullable: true + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + + PipelineExecutionStatus: + type: string + anyOf: + - enum: + - NEW + - CREATING + - CREATED + - CREATION_FAILED + - UNKNOWN + - INPROGRESS + - FINISHED + - FINISHEDWITHERRORS + - TIMEOUT + - DELETION_INPROGRESS + - DELETION_FAILED + - {} + + getPipelineExecutions: + type: object + properties: + count: + type: integer + example: 2 + resources: + type: array + items: + $ref: '#/components/schemas/PipelineExecutionData' + + getPipelineExecutionById: + type: object + properties: + id: + type: string + example: uuid + createdAt: + type: string + example: '2024-02-15T12:45:00Z' # UTC + modifiedAt: + type: string + example: '2024-02-15T12:45:00Z' # UTC + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + + DocumentStatus: + type: string + anyOf: + - enum: + - TO_BE_PROCESSED + - INDEXED + - REINDEXED + - DEINDEXED + - FAILED + - FAILED_TO_BE_RETRIED + - TO_BE_SCHEDULED + - {} + example: 'INDEXED' + + DocumentsStatusResponse: + type: object + properties: + count: + type: integer + example: 1 + resources: + type: array + items: + type: object + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/DocumentStatus' + viewLocation: + type: string + example: 'location' + nullable: true + downloadLocation: + type: string + example: 'location' + nullable: true + absoluteUrl: + type: string + nullable: true + title: + type: string + nullable: true + metadataId: + type: string + nullable: true + createdTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + lastUpdatedTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + + PipelineDocumentResponse: + type: object + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/DocumentStatus' + viewLocation: + type: string + example: 'location' + nullable: true + downloadLocation: + type: string + example: 'location' + nullable: true + absoluteUrl: + type: string + nullable: true + title: + type: string + nullable: true + metadataId: + type: string + nullable: true + createdTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + lastUpdatedTimestamp: + type: string + example: '2024-02-15T12:45:00Z' + searchPipeline: + type: object + properties: + dataRepositoryMetadata: + type: array + description: Search for metadata happens at key level. Pipelines matching the search criteria will be returned. + items: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + + searchPipelinesResponse: + type: object + required: + - resources + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/PipelineMinimalResponse' + + PipelineMinimalResponse: + oneOf: + - $ref: '#/components/schemas/MSSharePointPipelineMinimalResponse' + - $ref: '#/components/schemas/S3PipelineMinimalResponse' + - $ref: '#/components/schemas/SFTPPipelineMinimalResponse' + - $ref: '#/components/schemas/SDMPipelineMinimalResponse' + - $ref: '#/components/schemas/WorkZonePipelineMinimalResponse' + - $ref: '#/components/schemas/ServiceNowPipelineMinimalResponse' + - $ref: '#/components/schemas/GoogleDrivePipelineMinimalResponse' + discriminator: + propertyName: type + mapping: + MSSharePoint: '#/components/schemas/MSSharePointPipelineMinimalResponse' + S3: '#/components/schemas/S3PipelineMinimalResponse' + SFTP: '#/components/schemas/SFTPPipelineMinimalResponse' + SDM: '#/components/schemas/SDMPipelineMinimalResponse' + WorkZone: '#/components/schemas/WorkZonePipelineMinimalResponse' + ServiceNow: '#/components/schemas/ServiceNowPipelineMinimalResponse' + GoogleDrive: '#/components/schemas/GoogleDrivePipelineMinimalResponse' + + MSSharePointPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + - configuration + properties: + type: + type: string + enum: + - MSSharePoint + configuration: + $ref: '#/components/schemas/MSSharePointConfigurationMinimal' + metadata: + type: boolean + example: true + + S3PipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - S3 + configuration: + $ref: '#/components/schemas/S3ConfigurationMinimal' + metadata: + type: boolean + example: true + + SFTPPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - SFTP + configuration: + $ref: '#/components/schemas/SFTPConfigurationMinimal' + metadata: + type: boolean + example: true + + SDMPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - SDM + metadata: + type: boolean + example: true + + WorkZonePipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - WorkZone + metadata: + type: boolean + example: true + + ServiceNowPipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - ServiceNow + metadata: + type: boolean + example: true + + GoogleDrivePipelineMinimalResponse: + allOf: + - $ref: '#/components/schemas/BasePipelineMinimalResponse' + - type: object + required: + - type + properties: + type: + type: string + enum: + - GoogleDrive + configuration: + $ref: '#/components/schemas/GoogleDriveConfigurationMinimal' + metadata: + type: boolean + example: true + + BasePipelineMinimalResponse: + type: object + required: + - id + - status + properties: + id: + type: string + example: uuid + status: + $ref: '#/components/schemas/PipelineExecutionStatus' + + MSSharePointConfigurationMinimal: + type: object + required: + - sharePoint + properties: + sharePoint: + $ref: '#/components/schemas/SharePointSiteDetail' + + SharePointSiteDetail: + type: object + required: + - name + properties: + id: + type: string + example: sharepoint-site-id + name: + type: string + example: sharepoint-site-name + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + + S3ConfigurationMinimal: + type: object + required: + - s3 + properties: + s3: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: false + + SFTPConfigurationMinimal: + type: object + required: + - sftp + properties: + sftp: + type: object + properties: + includePaths: + $ref: '#/components/schemas/IncludePathsArray' + additionalProperties: false + + IncludePathsArray: + type: array + items: + type: string + example: + - /testFolder1 + - /testFolder2 + + patchPipeline: + type: object + properties: + metadata: + type: object + properties: + dataRepositoryMetadata: + type: array + description: Patch for metadata happens at key level. Value for the specific key would be inserted/replaced. + items: + type: object + properties: + key: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + value: + type: array + items: + type: string + minLength: 1 + maxLength: 1024 + nullable: false + nullable: false + minItems: 1 + required: + - key + - value + example: + - key: purpose + value: + - demonstration + - key: sample-key + value: + - sample-value1 + - sample-value2 + configuration: + type: object + properties: + cronExpression: + type: string + example: '0 3 * * *' # Every day at 3:00 AM UTC + + Chunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Metadata + default: [] + type: object + required: + - id + - content + title: Chunk + VectorChunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + title: Metadata + default: [] + type: object + required: + - id + - content + title: VectorChunk + RetrievalChunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Metadata + default: [] + searchScores: + $ref: '#/components/schemas/SearchScores' + nullable: true + postProcessingScore: + $ref: '#/components/schemas/Score' + nullable: true + type: object + required: + - id + - content + title: RetrievalChunk + DocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + title: MatchMode + description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + nullable: true + default: ANY + type: object + required: + - key + - value + title: DocumentKeyValueListPair + VectorDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + title: MatchMode + description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + nullable: true + default: ANY + type: object + required: + - key + - value + title: VectorDocumentKeyValueListPair + RetrievalDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + title: MatchMode + nullable: true + description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + default: ANY + type: object + required: + - key + - value + title: RetrievalDocumentKeyValueListPair + HTTPValidationError: + properties: + detail: + type: array + items: + $ref: '#/components/schemas/ValidationError' + title: Detail + type: object + title: HTTPValidationError + KeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: KeyValueListPair + VectorKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + description: Collection metadata during ingestion + title: VectorKeyValueListPair + RetrievalKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: RetrievalKeyValueListPair + Document-Output: + properties: + id: + type: string + format: uuid + title: Id + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + chunks: + items: + $ref: '#/components/schemas/VectorChunk' + type: array + title: VectorChunks + type: object + required: + - id + - chunks + title: Document + DocumentsChunk: + properties: + id: + type: string + format: uuid + title: Id + title: + type: string + title: Title + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] + documents: + items: + $ref: '#/components/schemas/Document-Output' + type: array + title: Documents + type: object + required: + - id + - title + - documents + title: Collection + PerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + items: + $ref: '#/components/schemas/DocumentsChunk' + type: array + title: Results + type: object + required: + - filterId + - results + title: PerFilterSearchResult + VectorPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + items: + $ref: '#/components/schemas/DocumentsChunk' + type: array + title: Results + type: object + required: + - filterId + - results + title: VectorPerFilterSearchResult + SearchConfiguration: + properties: + maxChunkCount: + nullable: true + type: integer + minimum: 0 + maximum: 0 + exclusiveMinimum: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + nullable: true + type: integer + minimum: 0 + maximum: 0 + exclusiveMinimum: true + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: SearchConfiguration + VectorSearchConfiguration: + properties: + maxChunkCount: + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: VectorSearchConfiguration + RetrievalSearchConfiguration: + nullable: true + default: {} + minProperties: 0 + maxProperties: 2 + properties: + maxChunkCount: + nullable: true + type: integer + minimum: 0 + exclusiveMinimum: true + maximum: 10000000 + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + nullable: true + type: integer + minimum: 0 + exclusiveMinimum: true + maximum: 10000000 + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: RetrievalSearchConfiguration + SearchDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/SearchSelectOptionEnum' + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: SearchDocumentKeyValueListPair + VectorSearchDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/VectorSearchSelectOptionEnum' + nullable: true + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: VectorSearchDocumentKeyValueListPair + RetrievalSearchDocumentKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchSelectOptionEnum' + nullable: true + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: RetrievalSearchDocumentKeyValueListPair + SearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/PerFilterSearchResult' + title: Results + description: List of returned results. + type: object + required: + - results + title: SearchResults + VectorSearchResults: + properties: + results: + type: array + items: + $ref: '#/components/schemas/VectorPerFilterSearchResult' + title: Results + description: List of returned results. + type: object + required: + - results + title: VectorSearchResults + + CollectionsListResponse: + properties: + count: + type: integer + resources: + items: + $ref: '#/components/schemas/Collection' + type: array + title: Collections + type: object + required: + - resources + title: CollectionsListResponse + description: A response containing collections retrieved from the server. + CollectionRequest: + properties: + title: + type: string + nullable: true + title: Title + embeddingConfig: + $ref: '#/components/schemas/EmbeddingConfig' + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + description: >- + Metadata attached to collection. Useful to restrict search to a + subset of collections. + default: [] + id: + type: string + format: uuid + nullable: true + title: Id + description: Unique identifier of a collection. + type: object + required: + - embeddingConfig + title: CollectionRequest + description: A request for creating a new, single collection. + CollectionCreatedResponse: + properties: + collectionURL: + type: string + title: Collectionurl + status: + type: string + title: Status + type: object + required: + - collectionURL + - status + title: CollectionCreatedResponse + CollectionPendingResponse: + properties: + monitorURL: + type: string + title: MonitorURL + type: object + required: + - monitorURL + title: CollectionPendingResponse + CollectionDeletedResponse: + properties: + collectionURL: + type: string + title: Collectionurl + status: + type: string + title: Status + type: object + required: + - collectionURL + - status + title: CollectionDeletedResponse + BaseDocument: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunkCreate' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + type: object + required: + - chunks + title: BaseDocument + description: Base class for documents, document requests and responses. + DocumentCreateRequest: + properties: + documents: + items: + $ref: '#/components/schemas/BaseDocument' + type: array + title: Documents + type: object + required: + - documents + title: DocumentCreateRequest + description: >- + A create request containing one or more new documents to create and + store in a collection. + Document-Input: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunkCreate' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - chunks + - id + title: Document + description: A single document stored in a collection by ID. + DocumentUpdateRequest: + properties: + documents: + items: + $ref: '#/components/schemas/Document-Input' + type: array + title: Documents + type: object + required: + - documents + title: DocumentUpdateRequest + description: + An update request containing one or more documents to update existing + documents in a collection by ID. + DocumentWithoutChunks: + properties: + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - metadata + - id + title: DocumentWithoutChunks + description: + A single document stored in a collection by ID without exposing + its chunks. + DocumentsListResponse: + properties: + documents: + items: + $ref: '#/components/schemas/DocumentWithoutChunks' + type: array + title: Documents + type: object + required: + - documents + title: DocumentsListResponse + description: A response containing documents retrieved from the server. + Documents: + properties: + count: + type: integer + resources: + items: + $ref: '#/components/schemas/DocumentWithoutChunks' + type: array + title: Documents + type: object + required: + - resources + title: Documents + description: A response containing documents retrieved from the server. + TextOnlyBaseChunk: + properties: + content: + type: string + title: Content + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a chuk. + type: object + required: + - content + - id + title: TextOnlyBaseChunk + description: Schema for a text-only chunk. + TextOnlyBaseChunkCreate: + properties: + content: + type: string + title: Content + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] + type: object + required: + - content + title: TextOnlyBaseChunk + description: Schema for a text-only chunk. + DocumentResponse: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunk' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/VectorDocumentKeyValueListPair' + type: array + title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - chunks + - id + title: DocumentResponse + description: >- + A response containing information about a newly created, single + document. + SearchSelectOptionEnum: + type: string + anyOf: + - enum: + - ignoreIfKeyAbsent + - {} + default: ignoreIfKeyAbsent + title: SearchSelectOptionEnum + VectorSearchSelectOptionEnum: + type: string + enum: + - ignoreIfKeyAbsent + title: VectorSearchSelectOptionEnum + RetrievalSearchSelectOptionEnum: + type: string + enum: + - ignoreIfKeyAbsent + title: RetrievalSearchSelectOptionEnum + SearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this SearchFilter - unique per request. + collectionIds: + items: + type: string + type: array + title: Collectionids + configuration: + $ref: '#/components/schemas/SearchConfiguration' + collectionMetadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + maxItems: 2000 + title: Collectionmetadata + description: >- + Restrict collections considered during search to those annotated + with the given metadata. Useful when combined with collections=['*'] + default: [] + documentMetadata: + items: + $ref: '#/components/schemas/SearchDocumentKeyValueListPair' + type: array + maxItems: 2000 + title: Documentmetadata + description: >- + Restrict documents considered during search to those annotated with + the given metadata. + default: [] + chunkMetadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + maxItems: 2000 + title: Chunkmetadata + description: >- + Restrict chunks considered during search to those with the given + metadata. + default: [] + type: object + required: + - id + - collectionIds + - configuration + title: SearchFilter + VectorSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this VectorSearchFilter - unique per request. + collectionIds: + items: + type: string + type: array + title: Collectionids + configuration: + $ref: '#/components/schemas/VectorSearchConfiguration' + collectionMetadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + nullable: true + title: Collectionmetadata + description: >- + Restrict collections considered during search to those annotated + with the given metadata. Useful when combined with collections=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/VectorSearchDocumentKeyValueListPair' + nullable: true + title: Documentmetadata + description: >- + Restrict documents considered during search to those annotated with + the given metadata. + default: [] + chunkMetadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Chunkmetadata + description: >- + Restrict chunks considered during search to those with the given + metadata. + default: [] + filter: + title: Filter + description: + Advanced filter expression for combining metadata filters with + boolean logic + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + nullable: true + type: object + required: + - id + - collectionIds + - configuration + title: VectorSearchFilter + TextSearchRequest: + properties: + query: + type: string + maxLength: 2000 + minLength: 1 + nullable: true + title: Query + description: Query string + filters: + items: + $ref: '#/components/schemas/VectorSearchFilter' + type: array + title: Filters + type: object + required: + - query + - filters + title: TextSearchRequest + EmbeddingConfig: + properties: + modelName: + type: string + maxLength: 1024 + title: Modelname + default: text-embedding-ada-002 + type: object + title: EmbeddingConfig + Collection: + properties: + title: + type: string + nullable: true + title: Title + embeddingConfig: + $ref: '#/components/schemas/EmbeddingConfig' + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + description: >- + Metadata attached to collection. Useful to restrict search to a + subset of collections. + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a collection. + type: object + required: + - embeddingConfig + - id + title: Collection + description: A logical grouping of content. + DataRepositories: + properties: + count: + type: integer + resources: + type: array + items: + $ref: '#/components/schemas/DataRepository' + title: Datarepositories + type: object + required: + - resources + title: DataRepositories + DataRepository: + properties: + id: + type: string + format: uuid + title: Id + description: Unique identifier of this DataRepository. + title: + type: string + title: Title + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Metadata + description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + default: [] + remoteGroundingName: + type: string + nullable: true + message: + type: string + nullable: true + type: + $ref: '#/components/schemas/DataRepositoryType' + type: object + required: + - id + - title + - type + title: DataRepository + description: DataRepository schema expected by Retrieval. + DataRepositorySearchResult: + properties: + dataRepository: + $ref: '#/components/schemas/DataRepositoryWithDocuments' + type: object + required: + - dataRepository + title: DataRepositorySearchResult + DataRepositoryType: + description: Only include DataRepositories with the given type. + type: string + enum: + - vector + - help.sap.com + - remote:dg + title: DataRepositoryType + DataRepositoryWithDocuments: + properties: + id: + type: string + format: uuid + title: Id + description: Unique identifier of this DataRepository. + title: + type: string + title: Title + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Metadata + description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + default: [] + remoteGroundingName: + type: string + nullable: true + description: Friendly destination Name (grounding.name) of remote instance. + message: + type: string + nullable: true + description: Optional message. + documents: + type: array + items: + $ref: '#/components/schemas/Document' + title: Documents + type: object + required: + - id + - title + - documents + title: DataRepositoryWithDocuments + description: DataRepository schema returned by the Vector search endpoint + Document: + properties: + id: + type: string + title: Id + metadata: + type: array + items: + $ref: '#/components/schemas/RetrievalDocumentKeyValueListPair' + title: Metadata + default: [] + chunks: + type: array + items: + $ref: '#/components/schemas/RetrievalChunk' + title: RetrievalChunks + type: object + required: + - id + - chunks + title: Document + DataRepositoryPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + type: array + items: + $ref: '#/components/schemas/DataRepositorySearchResult' + title: Results + description: List of returned results. + default: [] + type: object + required: + - filterId + title: PerFilterSearchResult + PerFilterSearchResultError: + description: Error message if any. + properties: + message: + type: string + title: Message + default: Unknown Error Occurred + type: object + required: + - message + title: PerFilterSearchResultError + RetrievalPerFilterSearchResultError: + description: Error message if any. + properties: + message: + type: string + title: Message + default: Unknown Error Occurred + type: object + required: + - message + title: RetrievalPerFilterSearchResultError + PerFilterSearchResultWithError: + properties: + filterId: + type: string + title: Filterid + error: + $ref: '#/components/schemas/PerFilterSearchResultError' + type: object + required: + - filterId + title: PerFilterSearchResultWithError + RetrievalSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this RetrievalSearchFilter - unique per request. + searchConfiguration: + nullable: true + $ref: '#/components/schemas/RetrievalSearchConfiguration' + default: {} + dataRepositories: + type: array + items: + type: string + title: Datarepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: ['*'] + dataRepositoryType: + $ref: '#/components/schemas/DataRepositoryType' + description: Only include DataRepositories with the given type. + remoteName: + description: Destination Name of remote instance. + type: string + nullable: true + dataRepositoryMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + default: [] + chunkMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + default: [] + type: object + required: + - id + - dataRepositoryType + title: RetrievalSearchFilter + description: Limit scope of search to certain DataRepositories, Documents or Chunks. + RetrievalSearchInput: + properties: + query: + type: string + minLength: 1 + nullable: true + title: Query + description: Query string + filters: + type: array + items: + anyOf: + - $ref: '#/components/schemas/RetrievalSearchFilter' + - $ref: '#/components/schemas/RetrievalVectorSearchFilter' + title: Filters + postProcessing: + type: array + items: + type: object + required: + - strategy + - inputs + properties: + id: + description: New ID for each PostProcessingOperation. + default: ae9eee48-4671-4321-a3e5-640adaaf26ae + type: string + nullable: true + maxChunkCount: + description: 'Maximum number of chunks to be retained in final PerSearchFilterResult.' + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + default: 5 + strategy: + description: 'Merging and scoring strategy to derive final PerSearchFilterResult.' + oneOf: + - $ref: '#/components/schemas/MergeStrategyScoreReuse' + - $ref: '#/components/schemas/MergeStrategyReranker' + inputs: + type: array + items: + oneOf: + - $ref: '#/components/schemas/PostProcessingObjectReference' + - $ref: '#/components/schemas/PostProcessingOperation' + description: List of operations to be performed across PerFilterSearchResults. + default: [] + type: object + required: + - query + - filters + title: RetrievalSearchInput + Score: + type: object + properties: + value: + type: number + required: + - value + title: Score + SearchScores: + properties: + aggregatedScore: + type: object + properties: + value: + type: number + denseRetrievalScore: + type: object + properties: + value: + type: number + required: + - aggregatedScore + - denseRetrievalScore + title: SearchScores + RetrievalVectorSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this RetrievalSearchFilter - unique per request. + searchConfiguration: + $ref: '#/components/schemas/RetrievalSearchConfiguration' + nullable: true + default: {} + dataRepositories: + type: array + items: + type: string + title: Datarepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: + - '*' + dataRepositoryType: + $ref: '#/components/schemas/DataRepositoryType' + nullable: true + default: vector + remoteName: + description: Destination Name of remote instance. + type: string + nullable: true + dataRepositoryMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + default: [] + chunkMetadata: + type: array + items: + $ref: '#/components/schemas/RetrievalKeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + default: [] + filter: + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + nullable: true + description: Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + scoringConfiguration: + $ref: '#/components/schemas/VectorScoringConfiguration' + nullable: true + description: Scoring configuration for retrieval and ranking. + default: + denseRetrieval: + enabled: true + weight: 1 + keywordRetrieval: + enabled: true + extractKeyWordsFromQuery: false + weight: 1 + boosting: + enabled: true + metadata: [] + scoreComputationStrategy: match_count + weight: 1 + aggregationStrategy: weighted_average + type: object + required: + - id + title: RetrievalVectorSearchFilter + RetrievalBinaryBooleanFilter: + properties: + operator: + type: string + title: Operator + enum: + - and + - or + left: + title: Left + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + right: + title: Right + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + type: object + required: + - operator + - left + - right + title: RetrievalBinaryBooleanFilter + RetrievalScopedKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + scope: + type: string + title: Scope + enum: + - repository + - document + - chunk + default: document + type: object + required: + - key + - value + title: RetrievalScopedKeyValueListPair + MergeStrategyScoreReuse: + properties: + type: + description: 'The type of merge strategy.' + $ref: '#/components/schemas/MergeStrategyType' + nullable: true + default: scoreReuse + type: object + title: MergeStrategyScoreReuse + description: The MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the scores returned by the downstream retrieval process. It is important that the scores are comparable, meaning they should come from the same embedding model or reranker model. + MergeStrategyReranker: + properties: + type: + $ref: '#/components/schemas/MergeStrategyType' + nullable: true + default: reranker + model: + description: The RerankerModel to use. + type: string + enum: + - cohere-3.5 + nullable: true + title: RerankerModel + default: cohere-3.5 + boosting: + description: Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true. + type: array + items: + type: object + required: + - key + - value + - scope + properties: + key: + type: string + maxLength: 1024 + value: + type: array + items: + type: string + maxLength: 1024 + scope: + type: array + description: PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + items: + type: string + nullable: true + includeAllMetaData: + description: If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk. + type: boolean + nullable: true + default: false + type: object + title: MergeStrategyReranker + description: The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult instances. This strategy adds latency, but yields good results. + MergeStrategyType: + enum: + - reranker + - scoreReuse + - reciprocalRankFusion + - random + type: string + title: MergeStrategyType + PostProcessingObjectReference: + properties: + id: + description: PerFilterSearchResult ID or PostProcessingOperation ID. + type: string + nullable: true + default: '6d3eeafd-f3db-4e8e-949a-0e40e50eab64' + type: object + title: PostProcessingObjectReference + PostProcessingOperation: + properties: + id: + type: string + nullable: true + description: New ID for each PostProcessingOperation. + default: ae9eee48-4671-4321-a3e5-640adaaf26ae + title: Id + maxChunkCount: + title: Maxchunkcount + description: Maximum number of chunks to be retained in final PerSearchFilterResult. + default: 5 + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + strategy: + title: Strategy + description: Merging and scoring strategy to derive final PerSearchFilterResult. + oneOf: + - $ref: '#/components/schemas/MergeStrategyScoreReuse' + - $ref: '#/components/schemas/MergeStrategyReranker' + inputs: + title: Inputs + type: array + items: + oneOf: + - $ref: '#/components/schemas/PostProcessingObjectReference' + - $ref: '#/components/schemas/PostProcessingOperation' + type: object + required: + - strategy + - inputs + title: PostProcessingOperation + VectorScoringConfiguration: + properties: + denseRetrieval: + $ref: '#/components/schemas/DenseRetrievalScoringConfiguration' + nullable: true + default: + enabled: true + weight: 1 + keywordRetrieval: + $ref: '#/components/schemas/KeyWordRetrievalScoringConfiguration' + nullable: true + default: + enabled: true + weight: 1 + extractKeyWordsFromQuery: false + boosting: + $ref: '#/components/schemas/BoostingScoringConfiguration' + nullable: true + default: + enabled: true + metadata: [] + weight: 1 + scoreComputationStrategy: match_count + scoreThreshold: + title: Scorethreshold + description: Minimum chunk score threshold. + type: number + nullable: true + aggregationStrategy: + description: Methodology to calculate the final aggregate score. + $ref: '#/components/schemas/ScoresAggregationStrategy' + nullable: true + default: weighted_average + type: object + title: VectorScoringConfiguration + DenseRetrievalScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + description: Enable dense retrieval. + default: true + weight: + type: integer + nullable: true + description: Contribution to final score. + default: 1 + type: object + title: DenseRetrievalScoringConfiguration + KeyWordRetrievalScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + default: true + description: Enable dense retrieval. + weight: + type: integer + nullable: true + default: 1 + description: Contribution to final score. + extractKeyWordsFromQuery: + type: boolean + nullable: true + default: false + description: Extract Keywords from Query. + type: object + title: KeyWordRetrievalScoringConfiguration + BoostingScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + default: true + description: Enable metadata-based boosting. + metadata: + type: array + items: + type: object + required: + - key + - value + - weight + properties: + key: + type: string + maxLength: 1024 + value: + type: array + items: + type: string + maxLength: 1024 + scope: + type: string + enum: [repository, document, chunk] + default: document + weight: + type: integer + nullable: true + default: [] + weight: + type: integer + nullable: true + default: 1 + description: Contribution to final score. + scoreComputationStrategy: + description: How the similarity between document metadata and boosted key-value pairs is computed. + $ref: '#/components/schemas/BoostingScoreComputationStrategy' + nullable: true + default: match_count + type: object + title: BoostingScoringConfiguration + BoostingScoreComputationStrategy: + enum: + - match_count + - embedding + type: string + title: BoostingScoreComputationStrategy + ScoresAggregationStrategy: + enum: + - weighted_average + - rrf + - weighted_rrf + type: string + title: ScoresAggregationStrategy + + RetrievalDataRepositorySearchResult: + properties: + dataRepository: + $ref: '#/components/schemas/DataRepositoryWithDocuments' + type: object + required: + - dataRepository + title: RetrievalDataRepositorySearchResult + RetrievalPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + type: array + items: + $ref: '#/components/schemas/RetrievalDataRepositorySearchResult' + title: Results + description: List of returned results. + default: [] + remoteGroundingName: + type: string + nullable: true + description: + Friendly Destination Name of remote instance (grounding.name). + Only present if dataRepositoryType = remote:dg. + type: object + required: + - filterId + title: RetrievalPerFilterSearchResult + RetrievalPerFilterSearchResultWithError: + properties: + filterId: + type: string + title: Filterid + error: + $ref: '#/components/schemas/RetrievalPerFilterSearchResultError' + type: object + required: + - filterId + title: RetrievalPerFilterSearchResultWithError + RetrievalSearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/RetrievalPerFilterSearchResult' + - $ref: '#/components/schemas/RetrievalPerFilterSearchResultWithError' + title: Results + description: List of returned results. + type: object + required: + - results + title: RetrievalSearchResults + DataRepositorySearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/DataRepositoryPerFilterSearchResult' + - $ref: '#/components/schemas/PerFilterSearchResultWithError' + title: Results + description: List of returned results. + type: object + required: + - results + title: SearchResults + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + input: + title: Input + ctx: + type: object + title: Context + type: object + required: + - loc + - msg + - type + title: ValidationError + GenericError: + type: object + required: + - error + properties: + error: + type: string + description: Human-readable error message + title: GenericError + DocumentBulkDeleteRequest: + properties: + ids: + items: + type: string + format: uuid + type: array + maxItems: 100 + minItems: 1 + title: Ids + description: List of document IDs to delete + type: object + required: + - ids + title: DocumentBulkDeleteRequest + description: A request to delete documents by their IDs. + DocumentBulkDeleteResponse: + properties: + deleted: + type: array + items: + type: string + format: uuid + title: Deleted + description: List of successfully deleted document IDs + notFound: + type: array + items: + type: string + format: uuid + title: NotFound + description: List of document IDs that were not found + type: object + required: + - deleted + - notFound + title: DocumentBulkDeleteResponse + description: Response after deleting documents in bulk. + BinaryBooleanFilter: + type: object + required: + - operator + - left + - right + properties: + operator: + type: string + title: Operator + description: Boolean operator for combining filter conditions + enum: + - and + - or + left: + title: Left + description: Left operand of the boolean expression + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + right: + title: Right + description: Right operand of the boolean expression + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + title: BinaryBooleanFilter + ScopedKeyValueListPair: + type: object + required: + - key + - value + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + scope: + type: string + title: Scope + description: Scope of the metadata filter (e.g., collection, document, chunk) + enum: + - collection + - document + - chunk + default: document + title: ScopedKeyValueListPair + MetadataUpdates: + properties: + updates: + type: array + items: + $ref: '#/components/schemas/MetadataUpdateItem' + title: Updates + description: List of metadata updates. + type: object + required: + - updates + title: MetadataUpdates + MetadataUpdateItem: + properties: + ids: + type: array + items: + type: string + format: uuid + title: Ids + description: List of collection or document or chunk ids for which the metadata should be updated + metadataUpdates: + type: array + items: + $ref: '#/components/schemas/MetadataKeyUpdate' + title: MetadataUpdates + description: List of metadata updates for the given resource ids + type: object + required: + - ids + - metadataUpdates + title: MetadataUpdateItem + MetadataKeyUpdate: + properties: + key: + type: string + minLength: 1 + title: Key + description: Key to update + operations: + type: array + items: + $ref: '#/components/schemas/MetadataOperation' + nullable: true + title: Operations + description: Update operation executed for the key + type: object + required: + - key + title: MetadataKeyUpdate + MetadataOperation: + type: object + required: + - op + properties: + op: + $ref: '#/components/schemas/MetadataOperationEnum' + values: + type: array + items: + type: string + nullable: true + title: Values + description: List of values to update. + title: MetadataOperation + MetadataOperationEnum: + type: string + enum: + - add + - remove + - replace + - delete_key + title: MetadataOperationEnum + MetadataResponse: + type: object + properties: + current_metadata: + type: array + items: + $ref: '#/components/schemas/MetadataItem' + nullable: true + title: CurrentMetadata + description: List of metadata after updates. + default: [] + title: MetadataResponse + MetadataItem: + type: object + required: + - id + properties: + id: + type: string + format: uuid + title: Id + description: ID of collection + metadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + nullable: true + title: Metadata + description: List of metadata of the collections or documents or chunks + default: [] + title: MetadataItem + FilterMatchModeEnum: + type: string + enum: + - ANY + - ALL + title: FilterMatchModeEnum + + ### ### ######################## ### ### + ### ### ### Error ### ### ### + ### ### ######################## ### ### + + ApiError: + required: + - code + - message + type: object + properties: + code: + description: >- + Descriptive error code (not http status code). + type: string + message: + description: plaintext error description + type: string + requestId: + description: id of individual request + type: string + target: + description: url that has been called + type: string + details: + type: array + items: + $ref: '#/components/schemas/DetailsErrorResponse' + + DetailsErrorResponse: + type: object + properties: + code: + description: Descriptive error code (not http status code) + type: string + message: + description: Plaintext error description + type: string + + # Metadata Management Schemas + MetadataConfigurationRequest: + type: object + required: + - destinationName + - dataRepositoryType + properties: + id: + type: string + description: If provided, must be a valid UUID. If not provided, a new UUID will be generated. + name: + type: string + description: If provided, must be a valid string. If not provided, will be same as id. + destinationName: + type: string + description: Contains destination name containing credentials to access the data repository. + dataRepositoryType: + type: string + enum: [MSSharePoint, S3, SFTP] + example: MSSharePoint + description: The data repository type for which this configuration is being created. + includePaths: + type: array + items: + type: string + minItems: 1 + example: ['/site/documents', '/shared/team'] + labels: + type: array + items: + type: object + required: [key, value] + properties: + key: + type: string + example: 'department' + value: + type: string + example: 'finance' + + ListMetadataConfigurations: + type: object + properties: + count: + type: integer + example: 1 + description: Total number of metadata configurations returned. + resources: + type: array + items: + $ref: '#/components/schemas/MetadataConfigurationResponse' + description: List of metadata configuration objects. It will be empty array if no records found. + + MetadataConfigurationResponse: + allOf: + - $ref: '#/components/schemas/MetadataConfigurationRequest' + - type: object + properties: + enumerationStatus: + anyOf: + - enum: [NEW, IN_PROGRESS, COMPLETED, ERROR] + - {} + example: 'IN_PROGRESS' + description: Status of metadata enumeration for the configuration. + + ListConfigurationDocuments: + type: object + properties: + count: + type: integer + example: 1 + description: Total number of documents returned. + resources: + type: array + items: + $ref: '#/components/schemas/ConfigurationDocument' + description: List of document objects. It will be empty array if no records found. + + ListConfigurationDocumentsFullDetails: + type: object + properties: + count: + type: integer + example: 1 + description: Total number of documents returned. + resources: + type: array + items: + $ref: '#/components/schemas/ConfigurationDocumentFullDetails' + description: List of document objects. It will be empty array if no records found. + + ConfigurationDocument: + type: object + properties: + id: + type: string + example: 3cba7512-b07a-58e6-a442-c83996a0b3bb + description: Unique identifier for the document. + title: + type: string + example: 'Quarterly Report' + description: Title of the document. + absoluteFilePath: + type: string + example: '/sites/team/finance/Q1/report.pdf' + description: Absolute file path of the document in the repository. + createdTimestamp: + type: string + format: date-time + description: UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z) + example: '2025-08-28T06:15:30Z' + type: + anyOf: + - enum: [FOLDER, DOCUMENT] + - {} + example: 'FOLDER' + description: Type of the resource. Can be FOLDER, DOCUMENT. + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata key-value pairs associated with the document. + + ConfigurationDocumentFullDetails: + type: object + properties: + id: + type: string + example: 3cba7512-b07a-58e6-a442-c83996a0b3bb + description: Unique identifier for the document. + title: + type: string + example: 'Quarterly Report' + description: Title of the document. + absoluteFilePath: + type: string + example: '/sites/team/finance/Q1/report.pdf' + description: Absolute file path of the document in the repository. + createdTimestamp: + type: string + format: date-time + description: UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z) + example: '2025-08-28T06:15:30Z' + resourceUri: + type: string + example: 'https://example.com/resource/123' + description: URI of the resource. + webUrl: + type: string + example: 'https://example.com/web/123' + description: Web URL of the document. + documentEtag: + type: string + example: 'abc123etag' + description: ETag of the document. + fileSuffix: + type: string + example: '.pdf' + description: File suffix of the document. + viewLocation: + type: string + example: 'https://example.com/view/123' + description: View location of the document. + downloadLocation: + type: string + example: 'https://example.com/download/123' + description: Download location of the document. + mimeType: + type: string + example: 'application/pdf' + description: MIME type of the document. + fileSizeMb: + type: string + example: '1.5' + description: File size of the document in megabytes. + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata key-value pairs associated with the document. + + DocumentMetadata: + type: object + required: [key, value] + properties: + key: + type: string + example: contentObjectId + description: Metadata key name. + value: + type: array + items: + type: string + example: some-id + nullable: true + description: An array of string values associated with the metadata key. If the key already exists, its values will be overwritten. Setting the value to null will delete the metadata key-value pair. + matchMode: + anyOf: + - enum: [ANY, ALL] + - {} + example: ANY + description: Match mode for the metadata key (ANY or ALL). + + DocumentMetadataUpdate: + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier of the document to update. + example: 550e8400-e29b-41d4-a716-446655440000 + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata updates for this document. + maxItems: 10 + required: + - id + - metadata + + DocumentMetadataBatchRequest: + type: object + required: + - value + properties: + value: + type: array + items: + $ref: '#/components/schemas/DocumentMetadataUpdate' + maxItems: 1000 + description: List of document metadata updates to be applied in batch. + + BatchUpdateDocumentSuccess: + type: object + required: [id, metadata] + properties: + id: + type: string + format: uuid + description: Unique identifier of the document. + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentMetadata' + description: Metadata updates for this document. + + DocumentMetadataUpdateError: + type: object + required: [target, code, message] + properties: + target: + type: string + description: Document ID that caused the error. + example: 550e8400-e29b-41d4-a716-446655440000 + code: + type: integer + description: HTTP error status code. + example: 500 + message: + type: string + description: Error message. + example: Some unexpected error occurred. + + BatchUpdateDocumentsResponse: + type: array + items: + oneOf: + - $ref: '#/components/schemas/DocumentMetadataUpdate' + - $ref: '#/components/schemas/DocumentMetadataUpdateError' + + MessageResponse: + type: object + properties: + message: + type: string + example: Tenant onboarding request accepted + + ErrorResponse: + type: object + properties: + error: + type: string + example: Error occurred during tenant onboarding + + ### *** ***************************************************** *** ### + ### *** *** Start of responses *** *** ### + ### *** ***************************************************** *** ### + + responses: + BadRequest: + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + description: The specification of the resource was incorrect + + NotFound: + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + description: The specification of the resource was incorrect + + UnprocessableEntity: + description: There are validation issues with the data. + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + MonitorNotFound: + description: The specified monitor resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + + parameters: + top: + name: $top + description: Number of results to display + in: query + required: false + schema: + type: integer + minimum: 0 + example: 10 + + skip: + name: $skip + description: Number of results to be skipped from the ordered list of results + in: query + required: false + schema: + type: integer + minimum: 0 + example: 10 + + count: + name: $count + description: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + in: query + required: false + schema: + type: boolean + example: true diff --git a/packages/gen/specs/document-grounding/options-per-service.json b/packages/gen/specs/document-grounding/options-per-service.json new file mode 100644 index 0000000..908bb77 --- /dev/null +++ b/packages/gen/specs/document-grounding/options-per-service.json @@ -0,0 +1,6 @@ +{ + "api.yaml": { + "directoryName": "gen_ai_hub/document_grounding_generation/generated", + "basePath": "/lm/document-grounding" + } +} diff --git a/packages/gen/specs/tab-ai-orchestration/api.yaml b/packages/gen/specs/tab-ai-orchestration/api.yaml new file mode 100644 index 0000000..8022726 --- /dev/null +++ b/packages/gen/specs/tab-ai-orchestration/api.yaml @@ -0,0 +1,572 @@ +openapi: 3.1.0 +info: + title: Tabular AI Orchestrator + version: 1.8.1 +servers: + - url: /v1 +paths: + /predict: + post: + tags: + - predict + summary: Make predictions using a Tabular Foundation Model + description: >- + Make predictions for tabular data using a deployed Tabular Foundation + Model. + + Required Headers: + - ai-resource-group: AI Core resource group identifier + operationId: predict + parameters: + - name: ai-resource-group + in: header + required: true + schema: + type: string + description: AI Core resource group identifier + title: Ai-Resource-Group + description: AI Core resource group identifier + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/PredictRequest" + responses: + "200": + description: Successful Response + content: + application/json: + schema: + $ref: "#/components/schemas/PredictResponse" + "400": + description: Invalid request data + "401": + description: Authentication failed + "404": + description: Model not found + "422": + description: Validation Error + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" + "500": + description: Internal server error + "502": + description: External service error + "504": + description: Request timeout +components: + schemas: + ColumnarData: + additionalProperties: + items: {} + type: array + type: object + title: ColumnarData + description: |- + Columnar data format where each key is a column name + and the value is a list of values for that column. + + Example: + { + "code": ["new_code1", "new_code2"], + "category": ["Electronics", "Clothing"], + "price": [100, 50] + } + ContextSelectionConfig: + properties: + indexColumn: + anyOf: + - type: string + - type: "null" + title: Indexcolumn + description: Name of the unique row-identifier column (e.g. 'ROW_INDEX'). + Required for 'heuristic', and deterministic 'random' strategies. + numRows: + anyOf: + - type: integer + minimum: 0 + - type: "null" + title: Numrows + description: Number of rows to select for context. If not provided or set to 0, + context selection is skipped. + strategy: + $ref: "#/components/schemas/ContextSelectionStrategyEnum" + description: Sampling strategy for context selection. + default: random + strategyConfig: + anyOf: + - $ref: "#/components/schemas/SamplingRandomConfig" + - $ref: "#/components/schemas/SamplingHeuristicConfig" + - type: "null" + title: Strategyconfig + description: Strategy-specific configuration parameters. + filterConditions: + anyOf: + - $ref: "#/components/schemas/FilterConditions" + - $ref: "#/components/schemas/FilterCondition" + - type: "null" + title: Filterconditions + description: Filter conditions for context selection + type: object + title: ContextSelectionConfig + description: Configuration for context selection. + ContextSelectionStrategyEnum: + type: string + enum: + - none + - random + - heuristic + - auto + title: ContextSelectionStrategyEnum + description: Context selection strategies for data sampling. + FilterCondition: + properties: + field: + type: string + title: Field + description: Field name to filter on + op: + type: string + title: Op + description: Filter operator (e.g., 'eq', 'gte', 'lte') + value: + title: Value + description: Value to compare against + type: object + required: + - field + - op + - value + title: FilterCondition + description: A single filter condition for context selection. + FilterConditions: + properties: + logic: + type: string + title: Logic + description: Logical operator to combine conditions ('and' or 'or') + conditions: + items: + anyOf: + - $ref: "#/components/schemas/FilterCondition" + - $ref: "#/components/schemas/FilterConditions" + type: array + title: Conditions + description: List of filter conditions + type: object + required: + - logic + - conditions + title: FilterConditions + description: Filter conditions for context selection. + HTTPValidationError: + properties: + detail: + items: + $ref: "#/components/schemas/ValidationError" + type: array + title: Detail + type: object + title: HTTPValidationError + ModelRpt1: + properties: + index_column: + anyOf: + - type: string + - type: "null" + title: Index Column + description: (Optional) The name of the column used to identify the row. This + column isn't used as an input feature for the model, and is returned + in the response objects. + data_schema: + anyOf: + - additionalProperties: + additionalProperties: + type: string + type: object + type: object + - type: "null" + title: Data Schema + description: "(Optional) A schema definition for data types of all columns. + Possible values: string, numeric, or date." + examples: + - data_schema: + ORDERDATE: + dtype: date + PRICE: + dtype: numeric + PRODUCT: + dtype: string + parse_data_types: + type: boolean + title: Parse Data Types + description: "(Optional, RPT default: True) Relevant when data_schema isn't + passed. Whether or not to parse data types, such as interpreting + strings as numbers or dates." + default: true + additionalProperties: true + type: object + title: ModelRpt1 + description: "RPT1 Reference: + https://help.sap.com/docs/sap-ai-core/generative-ai/example-payloads-fo\ + r-inferencing-sap-rpt-1?locale=en-US#parameters" + ModelRpt1_5: + properties: + index_column: + anyOf: + - type: string + - type: "null" + title: Index Column + description: (Optional) The name of the column used to identify the row. This + column isn't used as an input feature for the model, and is returned + in the response objects. + data_schema: + anyOf: + - additionalProperties: + additionalProperties: + type: string + type: object + type: object + - type: "null" + title: Data Schema + description: "(Optional) A schema definition for data types of all columns. + Possible values: string, numeric, or date." + examples: + - data_schema: + ORDERDATE: + dtype: date + PRICE: + dtype: numeric + PRODUCT: + dtype: string + parse_data_types: + type: boolean + title: Parse Data Types + description: "(Optional, RPT Default: True) Relevant when data_schema isn't + passed. Whether or not to parse data types, such as interpreting + strings as numbers or dates." + default: true + prediction_config: + $ref: "#/components/schemas/ModelRpt1_5PredictionConfig" + description: (Optional) An object for configuring predictions. + additionalProperties: true + type: object + title: ModelRpt1_5 + ModelRpt1_5Explanations: + properties: + top_column_scores: + type: integer + maximum: 20 + minimum: 0 + title: Top Column Scores + description: "(Optional, RPT Default: 0) Number of top column scores to return. + A value of 0 disables explainability." + default: 0 + top_relevant_context_rows: + anyOf: + - type: integer + maximum: 20 + - type: "null" + title: Top Relevant Context Rows + description: (Optional) Number of most relevant context rows to return for each + query row. + additionalProperties: true + type: object + title: ModelRpt1_5Explanations + ModelRpt1_5PredictionConfig: + properties: + explanations: + $ref: "#/components/schemas/ModelRpt1_5Explanations" + description: (Optional) Configuration used to request explanations. + additionalProperties: true + type: object + title: ModelRpt1_5PredictionConfig + PredictMetadata: + properties: + num_columns: + type: integer + title: Num Columns + num_rows: + type: integer + title: Num Rows + num_predictions: + type: integer + title: Num Predictions + num_query_rows: + type: integer + title: Num Query Rows + type: object + required: + - num_columns + - num_rows + - num_predictions + - num_query_rows + title: PredictMetadata + description: Metadata about the prediction. + PredictRequest: + properties: + modelName: + $ref: "#/components/schemas/TFMEnum" + description: Name of the deployed model + scenarioConfigName: + type: string + title: Scenarioconfigname + description: Scenario configuration identifier + contextSelectionConfig: + anyOf: + - $ref: "#/components/schemas/ContextSelectionConfig" + - type: "null" + description: Context selection configuration + predictionConfig: + $ref: "#/components/schemas/PredictionConfig" + description: Prediction configuration + modelConfig: + oneOf: + - $ref: "#/components/schemas/ModelRpt1_5" + - $ref: "#/components/schemas/ModelRpt1" + title: Modelconfig + description: (Optional) Any additional TFM-specific configurations that will be + passed to the selected TFM. + columns: + anyOf: + - $ref: "#/components/schemas/ColumnarData" + - type: "null" + description: Query-only rows in columnar form. An object mapping from column + name to array of column values. + contextColumns: + anyOf: + - $ref: "#/components/schemas/ColumnarData" + - type: "null" + description: (Optional) Context rows in columnar form, only relevant if + 'columns' is provided. An object mapping from column name to array + of column values. + rows: + anyOf: + - $ref: "#/components/schemas/RowData" + - type: "null" + description: Query-only rows in row form. An array of objects representing table + rows. + contextRows: + anyOf: + - $ref: "#/components/schemas/RowData" + - type: "null" + description: (Optional) Context rows in row form, only relevant if 'rows' is + provided. An array of objects representing table rows. + type: object + required: + - modelName + - scenarioConfigName + - predictionConfig + title: PredictRequest + description: Request schema for prediction endpoint. + PredictResponse: + properties: + id: + type: string + title: Id + metadata: + $ref: "#/components/schemas/PredictMetadata" + predictions: + items: + additionalProperties: true + type: object + type: array + title: Predictions + status: + $ref: "#/components/schemas/PredictStatus" + additional_information: + items: + type: string + type: array + title: Additional Information + description: Warnings or informational messages from context selection + default: [] + type: object + required: + - id + - metadata + - predictions + - status + title: PredictResponse + description: Response schema for prediction endpoint. + PredictStatus: + properties: + code: + type: integer + title: Code + message: + type: string + title: Message + type: object + required: + - code + - message + title: PredictStatus + description: Status of the prediction. + PredictionConfig: + properties: + targetColumns: + items: + $ref: "#/components/schemas/TargetColumn" + type: array + minItems: 1 + title: Targetcolumns + description: List of target columns with prediction configuration + additionalProperties: false + type: object + required: + - targetColumns + title: PredictionConfig + description: |- + Configuration for what to predict. + + Model-agnostic prediction config. Only contains fields shared across + all TFMs. Model-specific fields belong in `PredictRequest.modelConfig`. + RowData: + items: + additionalProperties: true + type: object + type: array + title: RowData + description: |- + Row-wise data format where each element is a dictionary + representing a single row with column names as keys. + + Example: + [ + {"code": "new_code1", "category": "Electronics", "price": 100}, + {"code": "new_code2", "category": "Clothing", "price": 50}, + ] + SamplingHeuristicConfig: + properties: + methodRatio: + type: number + title: Methodratio + description: Fraction of numRows filled by scoring method (remainder is random + fill). Must be between 0 and 1. + default: 0.67 + fuzzyNumPct: + type: number + title: Fuzzynumpct + description: Numeric fuzzy threshold as a fraction of the absolute query value. + E.g. 0.1 = +/-10%. + default: 0.1 + chunkSize: + type: integer + title: Chunksize + description: Max CASE WHEN expressions per subquery chunk (avoids HANA + parse-tree depth limit). + default: 100 + chunkThreshold: + type: integer + title: Chunkthreshold + description: Column count above which chunked SQL is used instead of a flat query. + default: 150 + poolSize: + anyOf: + - type: integer + - type: "null" + title: Poolsize + description: If set, scoring runs against a random subsample of this many rows + instead of the full table. None = full table scan. + fuzzyDateDays: + type: integer + title: Fuzzydatedays + description: Day window for fuzzy date matching. A date column scores 1 if + abs(DAYS_BETWEEN(row_date, query_date)) <= dateFuzzyDays. Set to 0 + for exact date match. + default: 30 + allowTimeoutFallback: + type: boolean + title: Allowtimeoutfallback + description: When true, heuristic sampling falls back to random on timeout + instead of raising an error. Set by the orchestrator when + strategy=AUTO. + default: false + additionalProperties: true + type: object + title: SamplingHeuristicConfig + SamplingRandomConfig: + properties: + deterministic: + type: boolean + title: Deterministic + description: When true, uses HASH_SHA256 of indexColumn for ordering instead of + RAND(), producing the same row order on every call for the same + data. + default: false + additionalProperties: true + type: object + title: SamplingRandomConfig + TFMEnum: + type: string + enum: + - sap-rpt-1-small + - sap-rpt-1-large + - sap-rpt-1.5 + - sap-rpt-1.5-large + title: TFMEnum + description: Supported Tabular Foundation Models. + TargetColumn: + properties: + name: + type: string + title: Name + description: Name of the column to predict + prediction_placeholder: + type: string + title: Prediction Placeholder + description: (Optional) Placeholder value indicating cells to predict + default: "[PREDICT]" + task_type: + $ref: "#/components/schemas/TaskTypeEnum" + description: (Optional) Type of prediction task (classification or regression) + default: classification + top_k: + anyOf: + - type: integer + - type: "null" + title: Top K + description: (Optional) Controls how many labels to predict for each column in + each row. Only applicable to 'classification' task type. + type: object + required: + - name + title: TargetColumn + description: Configuration for a target column to predict. + TaskTypeEnum: + type: string + enum: + - classification + - regression + title: TaskTypeEnum + description: ML task types for predictions. + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + input: + title: Input + ctx: + type: object + title: Context + type: object + required: + - loc + - msg + - type + title: ValidationError diff --git a/packages/gen/specs/tab-ai-orchestration/options-per-service.json b/packages/gen/specs/tab-ai-orchestration/options-per-service.json new file mode 100644 index 0000000..4fdb69b --- /dev/null +++ b/packages/gen/specs/tab-ai-orchestration/options-per-service.json @@ -0,0 +1,6 @@ +{ + "api.yaml": { + "directoryName": "gen_ai_hub/tab_ai_orchestration/generated", + "basePath": "/v1" + } +} diff --git a/packages/openapi-generator/Makefile b/packages/openapi-generator/Makefile new file mode 100644 index 0000000..8914136 --- /dev/null +++ b/packages/openapi-generator/Makefile @@ -0,0 +1,6 @@ +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + +.PHONY: test + +test: + uv run --package sap-openapi-generator pytest $(PKG_DIR)tests/ -v diff --git a/packages/openapi-generator/config/custom-templates/model_generic.mustache b/packages/openapi-generator/config/custom-templates/model_generic.mustache new file mode 100644 index 0000000..eb7b1c9 --- /dev/null +++ b/packages/openapi-generator/config/custom-templates/model_generic.mustache @@ -0,0 +1,664 @@ +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +{{#vendorExtensions.x-py-other-imports}} +{{{.}}} +{{/vendorExtensions.x-py-other-imports}} +{{#vendorExtensions.x-py-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-model-imports}} +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python +{{#vendorExtensions.x-py-has-public-name-properties}} +from typing import TYPE_CHECKING +{{/vendorExtensions.x-py-has-public-name-properties}} + +{{^vendorExtensions.x-py-has-public-name-properties}} +{{#hasChildren}} +{{#discriminator}} +from typing import TYPE_CHECKING +{{/discriminator}} +{{/hasChildren}} +{{/vendorExtensions.x-py-has-public-name-properties}} +{{#hasChildren}} +{{#discriminator}} +{{! If this model is a super class, importlib is used. So import the necessary modules for the type here. }} +if TYPE_CHECKING: +{{#mappedModels}} + from {{packageName}}.models.{{model.classFilename}} import {{modelName}} +{{/mappedModels}} + +{{/discriminator}} +{{/hasChildren}} +{{#compatibleWithPythonLegacy}} + +{{>_legacy_model_dict_helpers}} + + +{{/compatibleWithPythonLegacy}} +class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): + """ + {{#description}}{{{description}}}{{/description}}{{^description}}{{{classname}}}{{/description}} +{{#compatibleWithPythonLegacy}} +{{! +python-legacy generic models exposed metadata and value helpers: +https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L37-L55 +https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L203-L255 +}} + + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. +{{/compatibleWithPythonLegacy}} + """ # noqa: E501 +{{#vars}} + {{name}}: {{{vendorExtensions.x-py-typing}}} +{{/vars}} +{{#isAdditionalPropertiesTrue}} + additional_properties: Dict[str, Any] = {} +{{/isAdditionalPropertiesTrue}} +{{#compatibleWithPythonLegacy}} + openapi_types: ClassVar[Dict[str, str]] = { +{{#allVars}} + {{#vendorExtensions.x-py-public-name-literal}}{{{vendorExtensions.x-py-public-name-literal}}}{{/vendorExtensions.x-py-public-name-literal}}{{^vendorExtensions.x-py-public-name-literal}}{{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}{{/vendorExtensions.x-py-public-name-literal}}: {{#lambda.pythonStringLiteral}}{{{dataType}}}{{/lambda.pythonStringLiteral}}{{^-last}},{{/-last}} +{{/allVars}} + } + + attribute_map: ClassVar[Dict[str, str]] = { +{{#allVars}} + {{#vendorExtensions.x-py-public-name-literal}}{{{vendorExtensions.x-py-public-name-literal}}}{{/vendorExtensions.x-py-public-name-literal}}{{^vendorExtensions.x-py-public-name-literal}}{{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}{{/vendorExtensions.x-py-public-name-literal}}: {{{vendorExtensions.x-py-wire-name-literal}}}{{^-last}},{{/-last}} +{{/allVars}} + } +{{/compatibleWithPythonLegacy}} + __properties: ClassVar[List[str]] = [{{#allVars}}{{{vendorExtensions.x-py-wire-name-literal}}}{{^-last}}, {{/-last}}{{/allVars}}] +{{#vars}} + {{#vendorExtensions.x-regex}} + + @field_validator('{{{name}}}', mode="before") + def {{{name}}}_validate_regular_expression(cls, value): + """Validates the regular expression""" + {{^required}} + if value is None: + return value + + {{/required}} + {{#required}} + {{#isNullable}} + if value is None: + return value + + {{/isNullable}} + {{/required}} + if isinstance(value, str) and not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}): + raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}") + return value + {{/vendorExtensions.x-regex}} + {{#isEnum}} + + @field_validator('{{{name}}}') + def {{{name}}}_validate_enum(cls, value): + """Validates the enum""" + {{^required}} + if value is None: + return value + + {{/required}} + {{#required}} + {{#isNullable}} + if value is None: + return value + + {{/isNullable}} + {{/required}} + {{#isContainer}} + {{#isArray}} + for i in value: + if i not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]): + raise ValueError("each list item must be one of ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isArray}} + {{#isMap}} + for i in value.values(): + if i not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]): + raise ValueError("dict values must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + if value not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]): + raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isContainer}} + return value + {{/isEnum}} +{{/vars}} + +{{#vendorExtensions.x-py-preprocesses-input-names}} + @classmethod + def __preprocess_input_names( + cls, + obj: Any, + remove_hidden_storage_names: bool = True, + ) -> Any: + if not isinstance(obj, _Mapping): + return obj + obj = dict(obj) +{{#vendorExtensions.x-py-input-name-properties}} +{{#vendorExtensions.x-py-public-name-differs-from-wire}} +{{#vendorExtensions.x-py-explicit-public-name}} + if ( + {{{vendorExtensions.x-py-wire-name-literal}}} in obj + and {{{vendorExtensions.x-py-public-name-literal}}} in obj + ): + raise ValueError( + "%s received both %r and %r" + % ( + cls.__name__, + {{{vendorExtensions.x-py-wire-name-literal}}}, + {{{vendorExtensions.x-py-public-name-literal}}}, + ) + ) +{{/vendorExtensions.x-py-explicit-public-name}} + if {{{vendorExtensions.x-py-wire-name-literal}}} not in obj and {{{vendorExtensions.x-py-public-name-literal}}} in obj: + obj[{{{vendorExtensions.x-py-wire-name-literal}}}] = obj[{{{vendorExtensions.x-py-public-name-literal}}}] + obj.pop({{{vendorExtensions.x-py-public-name-literal}}}, None) +{{/vendorExtensions.x-py-public-name-differs-from-wire}} +{{/vendorExtensions.x-py-input-name-properties}} +{{#vendorExtensions.x-py-hidden-storage-names.size}} + if remove_hidden_storage_names: +{{#vendorExtensions.x-py-hidden-storage-names}} + obj.pop({{#lambda.pythonStringLiteral}}{{{.}}}{{/lambda.pythonStringLiteral}}, None) +{{/vendorExtensions.x-py-hidden-storage-names}} +{{/vendorExtensions.x-py-hidden-storage-names.size}} + return obj + +{{/vendorExtensions.x-py-preprocesses-input-names}} +{{#vendorExtensions.x-py-validates-input-names}} + # Pydantic passes the model instance to wrap validators during assignment: + # https://docs.pydantic.dev/2.11/migration/#changes-to-validators + # Private names also keep inherited model validators distinct: + # https://docs.pydantic.dev/2.11/concepts/validators/#on-inheritance + @_model_validator(mode="wrap") + @classmethod + def __validate_input_names( + cls, + obj: Any, + handler: _ModelWrapValidatorHandler[Self], + ) -> Self: + if not isinstance(obj, cls): + obj = cls.__preprocess_input_names(obj) + return handler(obj) + +{{/vendorExtensions.x-py-validates-input-names}} + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, +{{#compatibleWithPythonLegacy}} +{{! +python-legacy generated explicit constructor parameters, so unknown kwargs failed: +https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L64-L100 +}} + extra="forbid", +{{/compatibleWithPythonLegacy}} + protected_namespaces=(), + ) + + +{{#hasChildren}} +{{#discriminator}} + # JSON field name that stores the object type + __discriminator_property_name: ClassVar[str] = {{#lambda.pythonSingleQuotedStringLiteral}}{{{discriminator.propertyBaseName}}}{{/lambda.pythonSingleQuotedStringLiteral}} + + # discriminator mappings + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + {{#mappedModels}}{{#lambda.pythonSingleQuotedStringLiteral}}{{{mappingName}}}{{/lambda.pythonSingleQuotedStringLiteral}}: '{{{modelName}}}'{{^-last}},{{/-last}}{{/mappedModels}} + } + + @classmethod + def get_discriminator_value(cls, obj: Dict[str, Any]) -> Optional[str]: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj.get(cls.__discriminator_property_name) + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + +{{/discriminator}} +{{/hasChildren}} + def to_str(self) -> str: +{{#compatibleWithPythonLegacy}} + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) +{{/compatibleWithPythonLegacy}} +{{^compatibleWithPythonLegacy}} + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) +{{/compatibleWithPythonLegacy}} +{{#compatibleWithPythonLegacy}} + + def __repr__(self) -> str: + """For print and pprint""" + return self.to_str() + + def __eq__(self, other: object) -> bool: + """Returns true if both objects are equal""" + if not isinstance(other, {{classname}}): + return False + +{{#isAdditionalPropertiesTrue}} + return ( + self.to_dict() == other.to_dict() + and self.additional_properties == other.additional_properties + ) +{{/isAdditionalPropertiesTrue}} +{{^isAdditionalPropertiesTrue}} + return self.to_dict() == other.to_dict() +{{/isAdditionalPropertiesTrue}} + + def __ne__(self, other: object) -> bool: + """Returns true if both objects are not equal""" + if not isinstance(other, {{classname}}): + return True + + return not (self == other) + +{{/compatibleWithPythonLegacy}} + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" +{{#compatibleWithPythonLegacy}} + to_openapi_dict = _get_openapi_to_dict(self) + if to_openapi_dict is not None: + return json.dumps(to_jsonable_python(to_openapi_dict(self))) + return json.dumps(to_jsonable_python(self.to_dict())) +{{/compatibleWithPythonLegacy}} +{{^compatibleWithPythonLegacy}} + return json.dumps(to_jsonable_python(self.to_dict())) +{{/compatibleWithPythonLegacy}} + + @classmethod + def from_json(cls, json_str: str) -> Optional[{{^hasChildren}}Self{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union[{{#mappedModels}}{{{modelName}}}{{^-last}}, {{/-last}}{{/mappedModels}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}{{/hasChildren}}]: + """Create an instance of {{{classname}}} from a JSON string""" + return cls.from_dict(json.loads(json_str)) + +{{#compatibleWithPythonLegacy}} + def to_dict(self, serialize: bool = False) -> Dict[str, Any]: + """Return all declared model fields using public or wire names.""" + return { +{{#allVars}} + ({{{vendorExtensions.x-py-wire-name-literal}}} if serialize else {{#vendorExtensions.x-py-public-name-literal}}{{{vendorExtensions.x-py-public-name-literal}}}{{/vendorExtensions.x-py-public-name-literal}}{{^vendorExtensions.x-py-public-name-literal}}{{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}{{/vendorExtensions.x-py-public-name-literal}}): _to_legacy_value(getattr(self, {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}, None), serialize), +{{/allVars}} + } + + def __openapi_generator_modern_projection(self) -> Dict[str, Any]: +{{/compatibleWithPythonLegacy}} +{{^compatibleWithPythonLegacy}} + def to_dict(self) -> Dict[str, Any]: +{{/compatibleWithPythonLegacy}} + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + {{#vendorExtensions.x-py-readonly}} + * OpenAPI `readOnly` fields are excluded. + {{/vendorExtensions.x-py-readonly}} + {{#isAdditionalPropertiesTrue}} + * Fields in `self.additional_properties` are added to the output dict. + {{/isAdditionalPropertiesTrue}} + """ + excluded_fields: Set[str] = set([ + {{#vendorExtensions.x-py-readonly}} + "{{{.}}}", + {{/vendorExtensions.x-py-readonly}} + {{#isAdditionalPropertiesTrue}} + "additional_properties", + {{/isAdditionalPropertiesTrue}} + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + {{#allVars}} + {{#isContainer}} + {{#isArray}} + {{#items.isArray}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list of list) + _items = [] + if self.{{{name}}}: + for _item_{{{name}}} in self.{{{name}}}: + _items.append( + [{{#compatibleWithPythonLegacy}}_to_openapi_value(_inner_item){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_inner_item.to_dict(){{/compatibleWithPythonLegacy}} if _inner_item is not None else None for _inner_item in _item_{{{name}}}] if _item_{{{name}}} is not None else None + ) + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _items + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{#items.isMap}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list of dict) + _items = [] + if self.{{{name}}}: + for _item_{{{name}}} in self.{{{name}}}: + _items.append( + {_inner_key: {{#compatibleWithPythonLegacy}}_to_openapi_value(_inner_value){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_inner_value.to_dict(){{/compatibleWithPythonLegacy}} if _inner_value is not None else None for _inner_key, _inner_value in _item_{{{name}}}.items()} if _item_{{{name}}} is not None else None + ) + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _items + {{/items.items.isPrimitiveType}} + {{/items.isMap}} + {{^items.isArray}} + {{^items.isMap}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list) + _items = [] + if self.{{{name}}}: + for _item_{{{name}}} in self.{{{name}}}: + _items.append({{#compatibleWithPythonLegacy}}_to_openapi_value(_item_{{{name}}}){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_item_{{{name}}}.to_dict(){{/compatibleWithPythonLegacy}} if _item_{{{name}}} is not None else None) + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _items + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{/items.isMap}} + {{/items.isArray}} + {{/isArray}} + {{#isMap}} + {{#items.isArray}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of array) + _field_dict_of_array = {} + if self.{{{name}}}: + for _key_{{{name}}} in self.{{{name}}}: + _field_dict_of_array[_key_{{{name}}}] = [ + {{#compatibleWithPythonLegacy}}_to_openapi_value(_item){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_item.to_dict(){{/compatibleWithPythonLegacy}} if _item is not None else None for _item in self.{{{name}}}[_key_{{{name}}}] + ] if self.{{{name}}}[_key_{{{name}}}] is not None else None + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _field_dict_of_array + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{#items.isMap}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of dict) + _field_dict_of_dict = {} + if self.{{{name}}}: + for _key_{{{name}}}, _value_{{{name}}} in self.{{{name}}}.items(): + _field_dict_of_dict[_key_{{{name}}}] = { + _key: {{#compatibleWithPythonLegacy}}_to_openapi_value(_value){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}_value.to_dict(){{/compatibleWithPythonLegacy}} if _value is not None else None for _key, _value in _value_{{{name}}}.items() + } if _value_{{{name}}} is not None else None + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _field_dict_of_dict + {{/items.items.isPrimitiveType}} + {{/items.isMap}} + {{^items.isMap}} + {{^items.isArray}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict) + _field_dict = {} + if self.{{{name}}}: + for _key_{{{name}}} in self.{{{name}}}: + _field_dict[_key_{{{name}}}] = {{#compatibleWithPythonLegacy}}_to_openapi_value(self.{{{name}}}[_key_{{{name}}}]){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}self.{{{name}}}[_key_{{{name}}}].to_dict(){{/compatibleWithPythonLegacy}} if self.{{{name}}}[_key_{{{name}}}] is not None else None + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = _field_dict + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{/items.isArray}} + {{/items.isMap}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of {{{name}}} + if self.{{{name}}}: + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = {{#compatibleWithPythonLegacy}}_to_openapi_value(self.{{{name}}}){{/compatibleWithPythonLegacy}}{{^compatibleWithPythonLegacy}}self.{{{name}}}.to_dict(){{/compatibleWithPythonLegacy}} + {{/isEnumOrRef}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/allVars}} + {{#isAdditionalPropertiesTrue}} + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + {{/isAdditionalPropertiesTrue}} + {{#allVars}} + {{#isNullable}} + # set to None if {{{name}}} (nullable) is None + # and model_fields_set contains the field + if self.{{name}} is None and "{{{name}}}" in self.model_fields_set: + _dict[{{#lambda.pythonSingleQuotedStringLiteral}}{{{baseName}}}{{/lambda.pythonSingleQuotedStringLiteral}}] = None + + {{/isNullable}} + {{/allVars}} + return _dict + +{{#compatibleWithPythonLegacy}} +{{>_legacy_model_dict_registration}} + +{{/compatibleWithPythonLegacy}} + {{#hasChildren}} + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Optional[{{#discriminator}}Union[{{#mappedModels}}{{{modelName}}}{{^-last}}, {{/-last}}{{/mappedModels}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}]: + """Create an instance of {{{classname}}} from a dict""" + {{/hasChildren}} + {{^hasChildren}} + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of {{{classname}}} from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + {{/hasChildren}} +{{#vendorExtensions.x-py-preprocesses-input-names}} + + obj = _cast( + Dict[str, Any], + cls.__preprocess_input_names( + obj, + remove_hidden_storage_names={{#hasChildren}}{{#discriminator}}False{{/discriminator}}{{^discriminator}}True{{/discriminator}}{{/hasChildren}}{{^hasChildren}}True{{/hasChildren}}, + ), + ) + +{{/vendorExtensions.x-py-preprocesses-input-names}} + {{#hasChildren}} + {{#discriminator}} + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + {{#mappedModels}} + if object_type == '{{{modelName}}}': + return import_module("{{packageName}}.models.{{model.classFilename}}").{{modelName}}.from_dict(obj) + {{/mappedModels}} + + raise ValueError("{{{classname}}} failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + {{/discriminator}} + {{/hasChildren}} + {{^hasChildren}} +{{^vendorExtensions.x-py-preprocesses-input-names}} + +{{/vendorExtensions.x-py-preprocesses-input-names}} + {{#disallowAdditionalPropertiesIfNotPresent}} + {{^isAdditionalPropertiesTrue}} + # raise errors for additional fields in the input + for _key in obj.keys(): + if _key not in cls.__properties: + raise ValueError("Error due to additional fields (not defined in {{classname}}) in the input: " + _key) + + {{/isAdditionalPropertiesTrue}} + {{/disallowAdditionalPropertiesIfNotPresent}} + _obj = cls.model_validate({ + {{#allVars}} + {{#isContainer}} + {{#isArray}} + {{#items.isContainer}} + {{#items.isArray}} + {{#items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: [ + [{{{items.items.dataType}}}.from_dict(_inner_item) for _inner_item in _item] if _item is not None else None + for _item in obj[{{{vendorExtensions.x-py-wire-name-literal}}}] + ] if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{#items.isMap}} + {{#items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: [ + {_inner_key: {{{items.items.dataType}}}.from_dict(_inner_value) for _inner_key, _inner_value in _item.items()} if _item is not None else None + for _item in obj[{{{vendorExtensions.x-py-wire-name-literal}}}] + ] if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{/items.isMap}} + {{/items.isContainer}} + {{^items.isContainer}} + {{^items.isPrimitiveType}} + {{#items.isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{^items.isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: [{{{items.dataType}}}.from_dict(_item) for _item in obj[{{{vendorExtensions.x-py-wire-name-literal}}}]] if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{#items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/items.isContainer}} + {{/isArray}} + {{#isMap}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + {{#items.isContainer}} + {{#items.isMap}} + {{{vendorExtensions.x-py-wire-name-literal}}}: dict( + (_k, dict( + (_ik, {{{items.items.dataType}}}.from_dict(_iv)) + for _ik, _iv in _v.items() + ) + if _v is not None + else None + ) + for _k, _v in obj[{{{vendorExtensions.x-py-wire-name-literal}}}].items() + ) + if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None + else None{{^-last}},{{/-last}} + {{/items.isMap}} + {{#items.isArray}} + {{{vendorExtensions.x-py-wire-name-literal}}}: { + _k: [{{{items.items.dataType}}}.from_dict(_item) for _item in _v] if _v is not None else None + for _k, _v in obj[{{{vendorExtensions.x-py-wire-name-literal}}}].items() + } + if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None + else None{{^-last}},{{/-last}} + {{/items.isArray}} + {{/items.isContainer}} + {{^items.isContainer}} + {{{vendorExtensions.x-py-wire-name-literal}}}: dict( + (_k, {{{items.dataType}}}.from_dict(_v)) + for _k, _v in obj[{{{vendorExtensions.x-py-wire-name-literal}}}].items() + ) + if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None + else None{{^-last}},{{/-last}} + {{/items.isContainer}} + {{/items.isEnumOrRef}} + {{#items.isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: dict((_k, _v) for _k, _v in obj.get({{{vendorExtensions.x-py-wire-name-literal}}}).items()) if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{#items.isPrimitiveType}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: {{{dataType}}}.from_dict(obj[{{{vendorExtensions.x-py-wire-name-literal}}}]) if obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None else None{{^-last}},{{/-last}} + {{/isEnumOrRef}} + {{#isEnumOrRef}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{#defaultValue}} if {{#isNullable}}{{{vendorExtensions.x-py-wire-name-literal}}} in obj{{/isNullable}}{{^isNullable}}obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None{{/isNullable}} else {{{defaultValue}}}{{/defaultValue}}{{^-last}},{{/-last}} + {{/isEnumOrRef}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#defaultValue}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) if {{#isNullable}}{{{vendorExtensions.x-py-wire-name-literal}}} in obj{{/isNullable}}{{^isNullable}}obj.get({{{vendorExtensions.x-py-wire-name-literal}}}) is not None{{/isNullable}} else {{{defaultValue}}}{{^-last}},{{/-last}} + {{/defaultValue}} + {{^defaultValue}} + {{{vendorExtensions.x-py-wire-name-literal}}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/defaultValue}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/allVars}} + }) + {{#isAdditionalPropertiesTrue}} + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + {{/isAdditionalPropertiesTrue}} + return _obj + {{/hasChildren}} +{{#vendorExtensions.x-py-has-public-name-properties}} + + if TYPE_CHECKING: +{{#vars}} + {{#vendorExtensions.x-py-public-name-differs-from-storage}} + + @property{{#vendorExtensions.x-py-public-name-overrides-base-model}} # type: ignore[override]{{/vendorExtensions.x-py-public-name-overrides-base-model}} + def {{{vendorExtensions.x-py-public-name}}}(self) -> _{{classname}}_{{name}}_public_type: + return self.{{{name}}} + + @{{{vendorExtensions.x-py-public-name}}}.setter + def {{{vendorExtensions.x-py-public-name}}}(self, value: _{{classname}}_{{name}}_public_type) -> None:{{#vendorExtensions.x-py-public-name-overrides-base-model}} # pyright: ignore[reportIncompatibleMethodOverride]{{/vendorExtensions.x-py-public-name-overrides-base-model}} + self.{{{name}}} = value + {{/vendorExtensions.x-py-public-name-differs-from-storage}} +{{/vars}} +{{/vendorExtensions.x-py-has-public-name-properties}} + +{{#vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-postponed-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-postponed-model-imports}} +# TODO: Rewrite to not use raise_errors +{{classname}}.model_rebuild(raise_errors=False) +{{/vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-has-public-name-properties}} + +if TYPE_CHECKING: +{{#vars}} +{{#vendorExtensions.x-py-public-name-differs-from-storage}} + _{{classname}}_{{name}}_public_type = {{{vendorExtensions.x-py-public-name-typing}}} +{{/vendorExtensions.x-py-public-name-differs-from-storage}} +{{/vars}} + +# Install forwarding properties after Pydantic has consumed the class +# namespace and resolved any postponed model annotations. +{{#vars}} +{{#vendorExtensions.x-py-public-name-differs-from-storage}} +setattr( + {{classname}}, + {{{vendorExtensions.x-py-public-name-literal}}}, + property( + lambda self: self.{{{name}}}, + lambda self, value: setattr( + self, + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}, + value, + ), + ), +) +{{/vendorExtensions.x-py-public-name-differs-from-storage}} +{{/vars}} +{{/vendorExtensions.x-py-has-public-name-properties}} diff --git a/packages/openapi-generator/config/python-config.yaml b/packages/openapi-generator/config/python-config.yaml new file mode 100644 index 0000000..ab3b1af --- /dev/null +++ b/packages/openapi-generator/config/python-config.yaml @@ -0,0 +1,49 @@ +# openapi-generator-cli configuration for the Python generator (Pydantic v2, Python 3.10+). +# +# Usage (from repository root or package directory): +# +# # 1. Pre-process the spec +# sap-preprocess-spec --input path/to/spec.yaml --output .cache/processed.yaml +# +# # 2. Run the generator +# npx @openapitools/openapi-generator-cli generate \ +# -g python \ +# -i .cache/processed.yaml \ +# -o path/to/output \ +# -c packages/openapi-generator/config/python-config.yaml \ +# --additional-properties packageName= +# +# The openapitools.json at the repository root pins the generator version. + +generatorName: python + +packageVersion: "1.0.0" + +# HTTP backend: urllib3 (sync, default), asyncio (async), httpx (sync+async) +library: httpx + +additionalProperties: + # Suppress timestamp comment in generated files for clean VCS diffs + hideGenerationTimestamp: true + # SAP APIs often include additional properties — allow them in models + disallowAdditionalPropertiesIfNotPresent: false + # Resolve discriminator lookups for oneOf/anyOf + useOneOfDiscriminatorLookup: true + # Emit only Python source files; the parent package owns pyproject.toml/setup.py + generateSourceCodeOnly: true + # Emit _sync variants of each async method (httpx library only) + supportHttpxSync: true + +globalProperties: + apiDocs: "false" + modelDocs: "false" + apiTests: "false" + modelTests: "false" + +# Ensure only the first tag drives API class assignment. +# The pre-processor sets exactly one tag per operation, so this is a safety net. +openapiNormalizer: + KEEP_ONLY_FIRST_TAG_IN_OPERATION: "true" + +# Uncomment to use custom Mustache templates (only needed for non-standard output): +# templateDir: packages/openapi-generator/config/custom-templates diff --git a/packages/openapi-generator/pyproject.toml b/packages/openapi-generator/pyproject.toml new file mode 100644 index 0000000..e582bd1 --- /dev/null +++ b/packages/openapi-generator/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[project] +name = "sap-openapi-generator" +version = "0.1.0" +description = "SAP Cloud SDK for AI (Python): OpenAPI code generation tooling" +license = "Apache-2.0" +license-files = ["LICENSE"] +authors = [{ name = "SAP SE" }] +requires-python = ">=3.10" +dependencies = [ + "PyYAML>=6.0", +] + +[project.scripts] +sap-preprocess-spec = "sap_openapi_generator.preprocess_spec:main" +sap-generate = "sap_openapi_generator.generate:main" + +[dependency-groups] +dev = [ + "pytest>=8.0", + "pytest-cov>=5.0", +] + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.pytest.ini_options] +testpaths = ["tests"] diff --git a/packages/openapi-generator/src/sap_openapi_generator/__init__.py b/packages/openapi-generator/src/sap_openapi_generator/__init__.py new file mode 100644 index 0000000..83f8e9c --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/__init__.py @@ -0,0 +1 @@ +"""SAP OpenAPI Generator package.""" diff --git a/packages/openapi-generator/src/sap_openapi_generator/generate.py b/packages/openapi-generator/src/sap_openapi_generator/generate.py new file mode 100644 index 0000000..8e83450 --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/generate.py @@ -0,0 +1,265 @@ +"""End-to-end OpenAPI generation pipeline for SAP Cloud SDK Python packages. + +Mirrors the SAP Cloud SDK JS generator interface: + + sap-generate -i -o [-s ] + +For each spec file found under : + 1. Reads per-service options from options-per-service.json (directoryName, basePath) + 2. Pre-processes the spec (vendor extension resolution, base-path injection) + 3. Invokes openapi-generator-cli via npx + 4. Rewrites bare 'generated.*' imports to the fully-qualified package path + 5. Touches py.typed (httpx template omits it) + +options-per-service.json keys are paths relative to . Supported fields: + directoryName - output subdirectory under (required) + basePath - overrides the servers[0].url baked into Configuration (optional) + packageName - ignored (JS npm name, not used in Python) +""" + +from __future__ import annotations + +import argparse +import json +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path, PurePosixPath + +from sap_openapi_generator.preprocess_spec import preprocess + +_DEFAULT_CONFIG = Path(__file__).parent.parent.parent / "config" / "python-config.yaml" +_SPEC_EXTENSIONS = {".yaml", ".yml", ".json"} + + +_EXCLUDED_FILENAMES = {"options-per-service.json"} + + +def _find_specs(input_path: Path) -> list[Path]: + if input_path.is_file(): + return [input_path] + return sorted( + p for p in input_path.rglob("*") + if p.suffix in _SPEC_EXTENSIONS and p.is_file() and p.name not in _EXCLUDED_FILENAMES + ) + + +def _load_options_per_service(options_path: Path) -> dict: + if options_path.is_dir(): + options_path = options_path / "options-per-service.json" + if not options_path.exists(): + return {} + return json.loads(options_path.read_text()) + + +def _service_key(spec_path: Path, input_dir: Path) -> str: + """Return the options-per-service.json key for a spec (POSIX relative path from input_dir).""" + return PurePosixPath(spec_path.relative_to(input_dir)).as_posix() + + +def _build_opid_flags(mappings_path: Path) -> list[str]: + if not mappings_path.exists() or not mappings_path.stat().st_size: + return [] + flags = [] + for line in mappings_path.read_text().splitlines(): + line = line.strip() + if line: + flags += ["--operation-id-name-mappings", line] + return flags + + +def _fix_numbered_duplicates(output_dir: Path) -> None: + """Rename fileN.py → file.py when the generator appends a digit to avoid collisions. + + The openapi-generator appends '0', '1', … to a filename when its snake_case + version collides with another file (e.g. filterconditions0.py vs filter_conditions.py). + The generated imports reference the un-suffixed name, so we rename the file to match. + Only renames when the un-suffixed target does not already exist. + """ + import re + for numbered in sorted(output_dir.rglob("*.py")): + m = re.fullmatch(r"(.+?)(0)\.py", numbered.name) + if not m: + continue + canonical = numbered.with_name(m.group(1) + ".py") + if not canonical.exists(): + numbered.rename(canonical) + + +def _fix_field_aliases(output_dir: Path) -> None: + """Replace Field(alias="camelCase") with serialization_alias="camelCase". + + The openapi-generator emits alias= which makes Pydantic use the camelCase name + as the __init__ parameter, hiding the snake_case field name from type checkers. + Replacing with serialization_alias= keeps camelCase JSON output while letting + the __init__ use the natural snake_case field name. + """ + import re + + ALIAS_RE = re.compile( + r'(Field\((?:[^"\')\n]|"[^"]*"|\'[^\']*\')*?)(? None: + import re + # Matches bare 'generated.' not preceded by a dot or word char (i.e. not already + # part of a fully-qualified path like 'gen_ai_hub.tab_ai_orchestration.generated.'). + _bare_generated_re = re.compile(r'(? None: + config_path = config_path or _DEFAULT_CONFIG + leaf = "generated" + + with tempfile.TemporaryDirectory(prefix="sap-openapi-") as tmp: + tmp_path = Path(tmp) + processed = tmp_path / "processed.yaml" + mappings = tmp_path / "mappings.txt" + gen_tmp = tmp_path / "gen-tmp" + + preprocess( + input_path=spec_path, + output_path=processed, + options_path=options_path, + spec_key=spec_key, + mappings_output_path=mappings, + ) + + template_dir = config_path.parent / "custom-templates" + + cmd = [ + "npx", "--yes", "@openapitools/openapi-generator-cli", "generate", + "-g", "python", + "-i", str(processed), + "-o", str(gen_tmp), + "-c", str(config_path), + "--additional-properties", f"packageName={leaf}", + ] + if template_dir.is_dir(): + cmd += ["--template-dir", str(template_dir)] + cmd += _build_opid_flags(mappings) + + result = subprocess.run(cmd, check=False) + if result.returncode != 0: + sys.exit(result.returncode) + + generated_src = gen_tmp / leaf + if not generated_src.exists(): + print(f"ERROR: expected generated output at {generated_src}", file=sys.stderr) + sys.exit(1) + + if output_dir.exists(): + shutil.rmtree(output_dir) + shutil.move(str(generated_src), str(output_dir)) + + _fix_numbered_duplicates(output_dir) + _fix_field_aliases(output_dir) + _rewrite_imports(output_dir, package_name) + (output_dir / "py.typed").touch() + + +def generate( + input_path: Path, + output_dir: Path, + options_per_service_path: Path | None = None, + config_path: Path | None = None, +) -> None: + specs = _find_specs(input_path) + if not specs: + print(f"ERROR: no spec files found under {input_path}", file=sys.stderr) + sys.exit(1) + + input_dir = input_path if input_path.is_dir() else input_path.parent + service_options = _load_options_per_service(options_per_service_path) if options_per_service_path else {} + + for spec in specs: + key = _service_key(spec, input_dir) + opts = service_options.get(key, {}) + + directory_name = opts.get("directoryName") + if not directory_name: + print( + f"ERROR: no 'directoryName' for spec '{key}' in options-per-service.json.", + file=sys.stderr, + ) + sys.exit(1) + + service_output = output_dir / directory_name + # Derive the Python import path from directoryName (slashes → dots) + python_package_name = directory_name.replace("/", ".") + + generate_one( + spec_path=spec, + output_dir=service_output, + package_name=python_package_name, + options_path=options_per_service_path, + spec_key=key, + config_path=config_path, + ) + print(f"Generated: {key} → {service_output}") + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Generate Python API clients from OpenAPI specs (SAP Cloud SDK style)." + ) + parser.add_argument( + "-i", "--input", required=True, type=Path, + help="Input directory or spec file (.yaml/.yml/.json)", + ) + parser.add_argument( + "-o", "--outputDir", required=True, type=Path, + help="Output base directory; each service is placed in a subdirectory per directoryName", + ) + parser.add_argument( + "-s", "--optionsPerService", type=Path, default=None, + help="Path to options-per-service.json (or directory containing it)", + ) + parser.add_argument( + "--config", type=Path, default=None, + help=f"openapi-generator config YAML (default: {_DEFAULT_CONFIG})", + ) + args = parser.parse_args() + generate( + input_path=args.input, + output_dir=args.outputDir, + options_per_service_path=args.optionsPerService, + config_path=args.config, + ) + + +if __name__ == "__main__": + main() diff --git a/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py new file mode 100644 index 0000000..64400a9 --- /dev/null +++ b/packages/openapi-generator/src/sap_openapi_generator/preprocess_spec.py @@ -0,0 +1,235 @@ +"""Pre-process an OpenAPI spec to apply SAP Cloud SDK vendor extensions. + +Replicates the Java ApiClassNameFieldPreprocessor and MethodNameFieldPreprocessor +logic so the standard openapi-generator-cli sees a clean, normalized spec. + +Two vendor extensions are handled: + + x-sap-cloud-sdk-api-name: + Sets operation tags[0] to the given value (trailing "Api" suffix stripped). + Cascade resolution: operation level > path level > root level. + + x-sap-cloud-sdk-operation-name: + Overwrites the operation's operationId with the given value. + The generator then derives the Python method name from that operationId. + +Additionally, an options-per-service.json file (same format as the JS SDK) can be +supplied to embed service-level config such as basePath into the spec servers list: + + options-per-service.json format: + { "": { "basePath": "/lm/document-grounding", "packageName": "..." } } + + Effect: spec["servers"] is replaced with [{"url": basePath}] so the generator + bakes it into Configuration._base_path. + +Usage: + sap-preprocess-spec --input path/to/spec.yaml --output path/to/processed.yaml + sap-preprocess-spec --input api.yaml --output out.yaml \\ + --options options-per-service.json --spec-key src/spec/api.yaml + python -m sap_openapi_generator.preprocess_spec --input ... --output ... +""" + +from __future__ import annotations + +import argparse +import copy +import json +import sys +from pathlib import Path + +import yaml + +HTTP_METHODS = ("get", "post", "put", "delete", "patch", "options", "head", "trace") + + +def strip_api_suffix(name: str) -> str: + """Remove a trailing literal 'Api' suffix (case-sensitive, matching Java behavior).""" + return name[:-3] if name.endswith("Api") else name + + +def apply_api_name_extension(spec: dict) -> None: + """Set operation tags[0] based on x-sap-cloud-sdk-api-name. + + Cascade resolution: operation level > path level > root level. + Strips a trailing literal 'Api' suffix from the resolved name before setting. + """ + root_name = spec.get("x-sap-cloud-sdk-api-name") + for path_item in spec.get("paths", {}).values(): + if not isinstance(path_item, dict): + continue + path_name = path_item.get("x-sap-cloud-sdk-api-name") + for method in HTTP_METHODS: + op = path_item.get(method) + if not isinstance(op, dict): + continue + effective = op.get("x-sap-cloud-sdk-api-name") or path_name or root_name + if effective: + op["tags"] = [strip_api_suffix(effective)] + + +def _snake_case(name: str) -> str: + """Convert camelCase or PascalCase to snake_case.""" + import re + s1 = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", name) + return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", s1).lower() + + +def apply_operation_name_extension(spec: dict) -> dict: + """Overwrite operationId with x-sap-cloud-sdk-operation-name when present. + + When two operations in different tags share the same desired name (e.g. both + VectorApi and RetrievalApi want a method called "search"), the OAS spec requires + globally unique operationIds. The operationId is scoped to tag+name to satisfy + this, and operationIdNameMappings are returned so the generator renames the + Python method back to the desired short name within its class. + + Returns an operationIdNameMappings dict (may be empty). + """ + # First pass: collect all desired (tag, name) pairs to detect cross-tag collisions + desired: list[tuple[dict, str, str]] = [] # (op_dict, desired_name, tag) + for path_item in spec.get("paths", {}).values(): + if not isinstance(path_item, dict): + continue + for method in HTTP_METHODS: + op = path_item.get(method) + if not isinstance(op, dict): + continue + override = op.get("x-sap-cloud-sdk-operation-name") + if override: + tag = (op.get("tags") or ["default"])[0] + desired.append((op, override, tag)) + + # Detect which names appear more than once (across different tags) + from collections import Counter + name_counts = Counter(name for _, name, _ in desired) + duplicates = {name for name, count in name_counts.items() if count > 1} + + mappings: dict[str, str] = {} + for op, name, tag in desired: + if name in duplicates: + # Scope the operationId: snake_case(tag) + "_" + snake_case(name) + scoped = f"{_snake_case(tag)}_{_snake_case(name)}" + op["operationId"] = scoped + # Map scoped → desired so the generator uses the desired method name + mappings[scoped] = _snake_case(name) + else: + op["operationId"] = name + + return mappings + +def apply_options_per_service(spec: dict, options_path: Path, spec_key: str) -> None: + """Inject service options from an options-per-service.json file into the spec. + + Replaces spec["servers"] with a single entry whose URL is the basePath from + the options file. This causes the generator to bake basePath into + Configuration._base_path rather than leaving it as "http://localhost". + """ + with options_path.open() as f: + options: dict = json.load(f) + + service_opts = options.get(spec_key) + if not service_opts: + print( + f"WARNING: spec key '{spec_key}' not found in {options_path}. " + "No service options applied.", + file=sys.stderr, + ) + return + + base_path = service_opts.get("basePath") + if base_path: + spec["servers"] = [{"url": base_path}] + + +def validate_unique_operation_ids(spec: dict) -> None: + """Exit with an error if duplicate operationIds exist after applying overrides.""" + seen: dict[str, str] = {} + for path, path_item in spec.get("paths", {}).items(): + if not isinstance(path_item, dict): + continue + for method in HTTP_METHODS: + op = path_item.get(method) + if not isinstance(op, dict): + continue + op_id = op.get("operationId") + if not op_id: + continue + if op_id in seen: + print( + f"ERROR: Duplicate operationId '{op_id}' at " + f"'{method.upper()} {path}' conflicts with '{seen[op_id]}'.", + file=sys.stderr, + ) + sys.exit(1) + seen[op_id] = f"{method.upper()} {path}" + + +def load_spec(path: Path) -> dict: + with path.open() as f: + if path.suffix == ".json": + return json.load(f) + return yaml.safe_load(f) + + +def dump_spec(spec: dict, path: Path) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("w") as f: + if path.suffix == ".json": + json.dump(spec, f, indent=2) + else: + yaml.dump(spec, f, allow_unicode=True, sort_keys=False) + + +def preprocess( + input_path: Path, + output_path: Path, + options_path: Path | None = None, + spec_key: str | None = None, + mappings_output_path: Path | None = None, +) -> None: + spec = copy.deepcopy(load_spec(input_path)) + if options_path: + apply_options_per_service(spec, options_path, spec_key or "") + apply_api_name_extension(spec) + mappings = apply_operation_name_extension(spec) + validate_unique_operation_ids(spec) + dump_spec(spec, output_path) + if mappings_output_path: + mappings_output_path.parent.mkdir(parents=True, exist_ok=True) + # Write as newline-separated key=value pairs for --operation-id-name-mappings. + lines = "\n".join( + f"{scoped}={desired}" + for scoped, desired in sorted(mappings.items()) + ) + mappings_output_path.write_text(lines) + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Pre-process an OpenAPI spec to apply SAP Cloud SDK vendor extensions." + ) + parser.add_argument("--input", required=True, type=Path, help="Source spec file (.yaml or .json)") + parser.add_argument("--output", required=True, type=Path, help="Output path for processed spec") + parser.add_argument( + "--options", + type=Path, + default=None, + help="Path to options-per-service.json (JS SDK format)", + ) + parser.add_argument( + "--spec-key", + default=None, + help="Key in options-per-service.json selecting this spec's options (e.g. 'src/spec/api.yaml')", + ) + parser.add_argument( + "--mappings-output", + type=Path, + default=None, + help="Optional path to write operationIdNameMappings YAML fragment (for --config merging)", + ) + args = parser.parse_args() + preprocess(args.input, args.output, args.options, args.spec_key, args.mappings_output) + + +if __name__ == "__main__": + main() diff --git a/packages/openapi-generator/tests/test_preprocess_spec.py b/packages/openapi-generator/tests/test_preprocess_spec.py new file mode 100644 index 0000000..1686704 --- /dev/null +++ b/packages/openapi-generator/tests/test_preprocess_spec.py @@ -0,0 +1,352 @@ +"""Unit tests for sap_openapi_generator.preprocess_spec.""" + +from __future__ import annotations + +import json +import pytest +from pathlib import Path + +from sap_openapi_generator.preprocess_spec import ( + apply_api_name_extension, + apply_operation_name_extension, + apply_options_per_service, + strip_api_suffix, + validate_unique_operation_ids, + _snake_case, +) + + +# --------------------------------------------------------------------------- +# strip_api_suffix +# --------------------------------------------------------------------------- + + +def test_strip_api_suffix_removes_trailing_Api(): + assert strip_api_suffix("FooApi") == "Foo" + + +def test_strip_api_suffix_case_sensitive_uppercase_unchanged(): + # Only literal "Api" is stripped — "API" is not (matches Java behavior) + assert strip_api_suffix("FooAPI") == "FooAPI" + + +def test_strip_api_suffix_not_at_end(): + assert strip_api_suffix("MyApiService") == "MyApiService" + + +def test_strip_api_suffix_only_api(): + # Edge case: name IS "Api" → empty string + assert strip_api_suffix("Api") == "" + + +def test_strip_api_suffix_no_suffix(): + assert strip_api_suffix("Foo") == "Foo" + + +# --------------------------------------------------------------------------- +# apply_api_name_extension +# --------------------------------------------------------------------------- + + +def _op(**kwargs) -> dict: + op: dict = {"operationId": "defaultOp", "responses": {"200": {"description": "ok"}}} + op.update(kwargs) + return op + + +def test_api_name_root_level_applied_to_all_operations(): + spec = { + "x-sap-cloud-sdk-api-name": "SodasApi", + "paths": { + "/sodas": {"get": _op(operationId="listSodas")}, + "/sodas/{id}": {"get": _op(operationId="getSoda")}, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/sodas"]["get"]["tags"] == ["Sodas"] + assert spec["paths"]["/sodas/{id}"]["get"]["tags"] == ["Sodas"] + + +def test_api_name_path_level_overrides_root(): + spec = { + "x-sap-cloud-sdk-api-name": "RootApi", + "paths": { + "/a": { + "x-sap-cloud-sdk-api-name": "PathApi", + "get": _op(operationId="opA"), + }, + "/b": {"get": _op(operationId="opB")}, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Path"] + assert spec["paths"]["/b"]["get"]["tags"] == ["Root"] + + +def test_api_name_operation_level_overrides_path_and_root(): + spec = { + "x-sap-cloud-sdk-api-name": "RootApi", + "paths": { + "/a": { + "x-sap-cloud-sdk-api-name": "PathApi", + "get": _op(operationId="opA", **{"x-sap-cloud-sdk-api-name": "OperationApi"}), + }, + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Operation"] + + +def test_api_name_no_extension_preserves_existing_tags(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "tags": ["existing"], "responses": {}}}, + } + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["existing"] + + +def test_api_name_multiple_methods_on_same_path(): + spec = { + "paths": { + "/items": { + "x-sap-cloud-sdk-api-name": "ItemsApi", + "get": _op(operationId="listItems"), + "post": _op(operationId="createItem"), + } + } + } + apply_api_name_extension(spec) + assert spec["paths"]["/items"]["get"]["tags"] == ["Items"] + assert spec["paths"]["/items"]["post"]["tags"] == ["Items"] + + +def test_api_name_non_http_method_keys_ignored(): + spec = { + "x-sap-cloud-sdk-api-name": "FooApi", + "paths": { + "/a": { + "parameters": [{"name": "id", "in": "path"}], + "get": _op(operationId="getA"), + } + }, + } + apply_api_name_extension(spec) + assert spec["paths"]["/a"]["get"]["tags"] == ["Foo"] + assert isinstance(spec["paths"]["/a"]["parameters"], list) + + +def test_api_name_empty_paths_does_not_crash(): + apply_api_name_extension({"paths": {}}) + + +def test_api_name_no_paths_key_does_not_crash(): + apply_api_name_extension({}) + + +# --------------------------------------------------------------------------- +# apply_operation_name_extension +# --------------------------------------------------------------------------- + + +def test_operation_name_overwrites_operation_id(): + spec = { + "paths": { + "/pets/{id}": { + "get": { + "operationId": "getPetById", + "tags": ["Pets"], + "x-sap-cloud-sdk-operation-name": "fetchPet", + "responses": {}, + } + } + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/pets/{id}"]["get"]["operationId"] == "fetchPet" + assert mappings == {} + + +def test_operation_name_absent_leaves_operation_id_unchanged(): + spec = {"paths": {"/pets": {"get": {"operationId": "listPets", "responses": {}}}}} + apply_operation_name_extension(spec) + assert spec["paths"]["/pets"]["get"]["operationId"] == "listPets" + + +def test_operation_name_no_paths_key_does_not_crash(): + apply_operation_name_extension({}) + + +def test_operation_name_disambiguates_cross_tag_collision(): + """Two operations in different tags both want 'search' — must be scoped.""" + spec = { + "paths": { + "/vector/search": { + "post": { + "operationId": "vector.search_chunk", + "tags": ["Vector"], + "x-sap-cloud-sdk-operation-name": "search", + "responses": {}, + } + }, + "/retrieval/search": { + "post": { + "operationId": "retrieval.search", + "tags": ["Retrieval"], + "x-sap-cloud-sdk-operation-name": "search", + "responses": {}, + } + }, + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/vector/search"]["post"]["operationId"] == "vector_search" + assert spec["paths"]["/retrieval/search"]["post"]["operationId"] == "retrieval_search" + assert mappings == {"vector_search": "search", "retrieval_search": "search"} + + +def test_operation_name_no_collision_no_mappings(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "tags": ["A"], + "x-sap-cloud-sdk-operation-name": "getA", "responses": {}}}, + "/b": {"get": {"operationId": "opB", "tags": ["B"], + "x-sap-cloud-sdk-operation-name": "getB", "responses": {}}}, + } + } + mappings = apply_operation_name_extension(spec) + assert spec["paths"]["/a"]["get"]["operationId"] == "getA" + assert spec["paths"]["/b"]["get"]["operationId"] == "getB" + assert mappings == {} + + +# --------------------------------------------------------------------------- +# _snake_case +# --------------------------------------------------------------------------- + + +def test_snake_case_camel(): + assert _snake_case("camelCase") == "camel_case" + + +def test_snake_case_pascal(): + assert _snake_case("PascalCase") == "pascal_case" + + +def test_snake_case_already_snake(): + assert _snake_case("already_snake") == "already_snake" + + +# --------------------------------------------------------------------------- +# Both extensions applied together +# --------------------------------------------------------------------------- + + +def test_both_extensions_applied_independently(): + spec = { + "paths": { + "/drinks/{id}": { + "get": { + "operationId": "getDrinkById", + "x-sap-cloud-sdk-api-name": "DrinksApi", + "x-sap-cloud-sdk-operation-name": "fetchDrink", + "responses": {}, + } + } + } + } + apply_api_name_extension(spec) + apply_operation_name_extension(spec) + op = spec["paths"]["/drinks/{id}"]["get"] + assert op["tags"] == ["Drinks"] + assert op["operationId"] == "fetchDrink" + +def test_no_extension_is_a_passthrough(): + spec = { + "paths": { + "/items": { + "get": {"operationId": "listItems", "tags": ["items"], "responses": {}} + } + } + } + import copy + original = copy.deepcopy(spec) + apply_api_name_extension(spec) + apply_operation_name_extension(spec) + assert spec == original + + +# --------------------------------------------------------------------------- +# validate_unique_operation_ids +# --------------------------------------------------------------------------- + + +def test_validate_passes_when_all_ids_unique(): + spec = { + "paths": { + "/a": {"get": {"operationId": "opA", "responses": {}}}, + "/b": {"get": {"operationId": "opB", "responses": {}}}, + } + } + validate_unique_operation_ids(spec) # must not raise or exit + + +def test_validate_exits_on_duplicate(capsys): + spec = { + "paths": { + "/a": {"get": {"operationId": "dupOp", "responses": {}}}, + "/b": {"post": {"operationId": "dupOp", "responses": {}}}, + } + } + with pytest.raises(SystemExit) as exc_info: + validate_unique_operation_ids(spec) + assert exc_info.value.code == 1 + assert "dupOp" in capsys.readouterr().err + + +# --------------------------------------------------------------------------- +# apply_options_per_service +# --------------------------------------------------------------------------- + + +def test_options_per_service_sets_servers(tmp_path): + options = {"src/spec/api.yaml": {"basePath": "/lm/document-grounding"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert spec["servers"] == [{"url": "/lm/document-grounding"}] + + +def test_options_per_service_overwrites_existing_servers(tmp_path): + options = {"src/spec/api.yaml": {"basePath": "/new/path"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {"servers": [{"url": "http://old-host"}]} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert spec["servers"] == [{"url": "/new/path"}] + + +def test_options_per_service_missing_key_warns_and_does_not_modify(tmp_path, capsys): + options = {"other/key.yaml": {"basePath": "/other"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert "servers" not in spec + assert "src/spec/api.yaml" in capsys.readouterr().err + + +def test_options_per_service_no_base_path_does_not_set_servers(tmp_path): + options = {"src/spec/api.yaml": {"packageName": "my_pkg"}} + options_file = tmp_path / "options-per-service.json" + options_file.write_text(json.dumps(options)) + + spec: dict = {} + apply_options_per_service(spec, options_file, "src/spec/api.yaml") + assert "servers" not in spec + diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 0000000..eae4dd6 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,9 @@ +{ + "venvPath": ".", + "venv": ".venv", + "extraPaths": [ + "packages/base", + "packages/core", + "packages/gen" + ] +} diff --git a/sample-code/sample_code/document_grounding_generation.py b/sample-code/sample_code/document_grounding_generation.py new file mode 100644 index 0000000..5209ab1 --- /dev/null +++ b/sample-code/sample_code/document_grounding_generation.py @@ -0,0 +1,78 @@ +from ai_core_sdk.ai_core_v2_client import AICoreV2Client +from gen_ai_hub.document_grounding_generation import ( + GroundingApiClient, + CollectionRequest, + DataRepositoryType, + EmbeddingConfig, + FiltersInner, + PipelinesApi, + RetrievalApi, + RetrievalSearchConfiguration, + RetrievalSearchFilter, + RetrievalSearchInput, + VectorApi, +) + +RESOURCE_GROUP = "default" + + +def _client() -> GroundingApiClient: + return GroundingApiClient(AICoreV2Client.from_env()) + + +async def create_collection(): + """ + Create a new vector collection through the Document Grounding Vector API. + + Returns: + JSON object containing the created collection details. + """ + client = _client() + await VectorApi(client).create_collection( + ai_resource_group=RESOURCE_GROUP, + collection_request=CollectionRequest( + title="my-collection", + embedding_config=EmbeddingConfig(model_name="text-embedding-3-small"), + ), + ) + return {"result": "collection creation initiated"} + + +async def get_all_pipelines(): + """ + List all document grounding pipelines through the Document Grounding Pipelines API. + + Returns: + JSON object containing the list of pipelines. + """ + client = _client() + result = await PipelinesApi(client).get_all_pipelines( + ai_resource_group=RESOURCE_GROUP, + ) + return {"result": result.to_dict()} + + +async def retrieval_search(): + """ + Search across data repositories through the Document Grounding Retrieval API. + + Returns: + JSON object containing the search results. + """ + client = _client() + result = await RetrievalApi(client).search( + ai_resource_group=RESOURCE_GROUP, + retrieval_search_input=RetrievalSearchInput( + query="What is SAP BTP?", + filters=[ + FiltersInner(RetrievalSearchFilter( + id="my-data-repository-id", + data_repository_type=DataRepositoryType.VECTOR, + search_configuration=RetrievalSearchConfiguration( + max_chunk_count=5, + ), + )) + ], + ), + ) + return {"result": result.to_dict()} diff --git a/sample-code/sample_code/server.py b/sample-code/sample_code/server.py index 4e011e3..6edeeac 100644 --- a/sample-code/sample_code/server.py +++ b/sample-code/sample_code/server.py @@ -1,7 +1,7 @@ from fastapi import FastAPI, Request from fastapi.responses import JSONResponse -from sample_code import amazon, core, google, openai, orchestration +from sample_code import amazon, core, document_grounding_generation, google, openai, orchestration, tab_ai_orchestration app = FastAPI(title="SAP AI Core Python SDK Sample Application") @@ -68,3 +68,12 @@ async def health(): app.get("/orchestration/tool-call-decorator")(orchestration.tool_call_decorator) app.get("/orchestration/tool-call-function-tool")(orchestration.tool_call_function_tool) app.get("/orchestration/tool-call-json")(orchestration.tool_call_json) + +# Document Grounding Generation (generated client) +app.post("/document-grounding-generation/collection/create")(document_grounding_generation.create_collection) +app.get("/document-grounding-generation/pipelines")(document_grounding_generation.get_all_pipelines) +app.post("/document-grounding-generation/retrieval/search")(document_grounding_generation.retrieval_search) + +# Tabular AI Orchestration +app.get("/tab-ai-orchestration/predict")(tab_ai_orchestration.predict) +app.get("/tab-ai-orchestration/predict-with-explanations")(tab_ai_orchestration.predict_with_explanations) diff --git a/sample-code/sample_code/tab_ai_orchestration.py b/sample-code/sample_code/tab_ai_orchestration.py new file mode 100644 index 0000000..bd08d19 --- /dev/null +++ b/sample-code/sample_code/tab_ai_orchestration.py @@ -0,0 +1,113 @@ +from gen_ai_hub.tab_ai_orchestration import TabAiOrchestrationClient +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_config import ContextSelectionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.context_selection_strategy_enum import ContextSelectionStrategyEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15 import ModelRpt15 +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_explanations import ModelRpt15Explanations +from gen_ai_hub.tab_ai_orchestration.generated.models.model_rpt15_prediction_config import ModelRpt15PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.modelconfig import Modelconfig +from gen_ai_hub.tab_ai_orchestration.generated.models.predict_request import PredictRequest +from gen_ai_hub.tab_ai_orchestration.generated.models.prediction_config import PredictionConfig +from gen_ai_hub.tab_ai_orchestration.generated.models.target_column import TargetColumn +from gen_ai_hub.tab_ai_orchestration.generated.models.task_type_enum import TaskTypeEnum +from gen_ai_hub.tab_ai_orchestration.generated.models.tfm_enum import TFMEnum + + +async def predict(): + """ + Make a tabular prediction using the Tabular AI Orchestration service. + + Returns: + JSON object containing the prediction response. + """ + request = PredictRequest( + model_name=TFMEnum.SAP_MINUS_RPT_MINUS_1_MINUS_SMALL, + scenario_config_name="product-prediction-scenario-lowercase", + context_selection_config=ContextSelectionConfig( + num_rows=3, + strategy=ContextSelectionStrategyEnum.RANDOM, + index_column="id", + ), + prediction_config=PredictionConfig( + target_columns=[ + TargetColumn( + name="salesgroup", + prediction_placeholder="[PREDICT]", + task_type=TaskTypeEnum.CLASSIFICATION, + ) + ] + ), + columns={ + "product": ["Laptop", "Office Chair"], + "price": [999.99, 142.99], + "date": ["2025-01-15", "2025-07-12"], + "id": ["35", "571"], + "salesgroup": ["[PREDICT]", "[PREDICT]"], + }, + ) + + async with TabAiOrchestrationClient(model_name="sap-rpt-1-small") as client: + response = await client.predict( + ai_resource_group="default", + predict_request=request, + ) + + return response.to_dict() + + +async def predict_with_explanations(): + """ + Make a tabular prediction with explanations using the Tabular AI Orchestration service. + + Returns: + JSON object containing the prediction response with top column scores and + relevant context rows for each prediction. + """ + request = PredictRequest( + model_name=TFMEnum.SAP_MINUS_RPT_MINUS_1_DOT_5, + scenario_config_name="product-prediction-scenario-lowercase", + context_selection_config=ContextSelectionConfig( + num_rows=3, + strategy=ContextSelectionStrategyEnum.RANDOM, + index_column="id", + ), + prediction_config=PredictionConfig( + target_columns=[ + TargetColumn( + name="salesgroup", + prediction_placeholder="[PREDICT]", + task_type=TaskTypeEnum.CLASSIFICATION, + ) + ] + ), + var_model_config=Modelconfig(ModelRpt15( + index_column="id", + data_schema={ + "product": {"dtype": "string"}, + "price": {"dtype": "numeric"}, + "date": {"dtype": "date"}, + "id": {"dtype": "string"}, + "salesgroup": {"dtype": "string"}, + }, + prediction_config=ModelRpt15PredictionConfig( + explanations=ModelRpt15Explanations( + top_column_scores=3, + top_relevant_context_rows=2, + ) + ), + )), + columns={ + "product": ["Laptop", "Office Chair"], + "price": [999.99, 142.99], + "date": ["2025-01-15", "2025-07-12"], + "id": ["35", "571"], + "salesgroup": ["[PREDICT]", "[PREDICT]"], + }, + ) + + async with TabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + response = await client.predict( + ai_resource_group="default", + predict_request=request, + ) + + return response.to_dict() diff --git a/uv.lock b/uv.lock index e7b0f3e..93ba7f4 100644 --- a/uv.lock +++ b/uv.lock @@ -24,6 +24,7 @@ members = [ "sap-ai-sdk-base", "sap-ai-sdk-core", "sap-ai-sdk-gen", + "sap-openapi-generator", ] [[package]] @@ -4313,6 +4314,29 @@ dev = [ { name = "sphinxawesome-theme" }, ] +[[package]] +name = "sap-openapi-generator" +version = "0.1.0" +source = { editable = "packages/openapi-generator" } +dependencies = [ + { name = "pyyaml" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-cov" }, +] + +[package.metadata] +requires-dist = [{ name = "pyyaml", specifier = ">=6.0" }] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.0" }, + { name = "pytest-cov", specifier = ">=5.0" }, +] + [[package]] name = "six" version = "1.17.0"