diff --git a/Makefile b/Makefile index 231787b3..ecfd850f 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 00000000..8dd0d745 --- /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 00000000..fcce1c01 --- /dev/null +++ b/packages/gen/Makefile @@ -0,0 +1,20 @@ +PKG_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SPECS := $(wildcard $(PKG_DIR)specs/*) + +.PHONY: generate generate-kiota + +generate: + $(foreach spec,$(SPECS), \ + uv run --package sap-openapi-generator sap-generate \ + -i $(spec) \ + -o $(PKG_DIR) \ + -s $(spec)/options-per-service.json; \ + ) + +generate-kiota: + $(foreach spec,$(SPECS), \ + uv run --package sap-kiota-generator sap-kiota-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 00000000..63d2cca9 --- /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 00000000..f02af11c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation/client.py @@ -0,0 +1,55 @@ +from __future__ import annotations + +from typing import Optional + +import httpx +from gen_ai_hub.proxy.core.base import BaseProxyClient +from gen_ai_hub.proxy import get_proxy_client + +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 _get_base_url(client: BaseProxyClient) -> str: + ai_core = getattr(client, "ai_core_client", None) + if ai_core is None: + raise ValueError("proxy client has no ai_core_client configured") + return ai_core.base_url.rstrip("/") + "/lm/document-grounding" + + +class _SapRESTClientObject(RESTClientObject): + def __init__(self, configuration: Configuration, client: BaseProxyClient) -> None: + super().__init__(configuration) + self._client = client + + def _create_pool_manager(self) -> httpx.AsyncClient: + pool = super()._create_pool_manager() + hooks = dict(pool.event_hooks) + hooks["request"] = list(hooks.get("request", [])) + [self._inject_auth] + pool.event_hooks = hooks + return pool + + async def _inject_auth(self, request: httpx.Request) -> None: + for key, value in self._client.request_header.items(): + request.headers[key] = value + + +class GroundingApiClient(ApiClient): + """ApiClient for the Document Grounding service. + + Resolves auth and base URL from the proxy client automatically. + If no proxy client is provided, one is created via get_proxy_client(). + """ + + def __init__( + self, + proxy_client: Optional[BaseProxyClient] = None, + base_url: Optional[str] = None, + ) -> None: + client = proxy_client or get_proxy_client() + config = Configuration(host=base_url or _get_base_url(client)) + super().__init__(configuration=config) + self.rest_client = _SapRESTClientObject(config, 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 00000000..17c372a9 --- /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 00000000..2f6ec93f --- /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 00000000..4eb8aa50 --- /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 00000000..3df1aa4a --- /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 00000000..e8ad827d --- /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 00000000..87c910d3 --- /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 00000000..04e24783 --- /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 00000000..9bc7c11f --- /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 00000000..b827a34c --- /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 00000000..f5e8536f --- /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 00000000..8f515861 --- /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 00000000..2f7b8d00 --- /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"), + "request_id": 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 00000000..924e366f --- /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 00000000..daa9f76f --- /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 00000000..83dd6134 --- /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 00000000..44503d5e --- /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 00000000..a77202a5 --- /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 00000000..8fa468af --- /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 00000000..681ac48f --- /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 00000000..8d360934 --- /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, + "score_computation_strategy": 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 00000000..7b645b8d --- /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 00000000..47219342 --- /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 00000000..2a56c357 --- /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"), + "embedding_config": 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 00000000..b3407ef4 --- /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({ + "collection_url": 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 00000000..8f0d44cf --- /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({ + "collection_url": 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 00000000..68069631 --- /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({ + "monitor_url": 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 00000000..347a3ce6 --- /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"), + "embedding_config": 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 00000000..7dd6df8b --- /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 00000000..d545102a --- /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"), + "absolute_file_path": obj.get("absoluteFilePath"), + "created_timestamp": 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 00000000..4b39eaea --- /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"), + "absolute_file_path": obj.get("absoluteFilePath"), + "created_timestamp": obj.get("createdTimestamp"), + "resource_uri": obj.get("resourceUri"), + "web_url": obj.get("webUrl"), + "document_etag": obj.get("documentEtag"), + "file_suffix": obj.get("fileSuffix"), + "view_location": obj.get("viewLocation"), + "download_location": obj.get("downloadLocation"), + "mime_type": obj.get("mimeType"), + "file_size_mb": 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 00000000..51bae012 --- /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 00000000..832e608c --- /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 00000000..ae4f71ef --- /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, + "remote_grounding_name": 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 00000000..0cf0cca3 --- /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({ + "filter_id": 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 00000000..31b56bb3 --- /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({ + "data_repository": 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 00000000..d61f5525 --- /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 00000000..a290173c --- /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 00000000..030d18cf --- /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, + "remote_grounding_name": 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 00000000..f1918997 --- /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 00000000..c5fc742c --- /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 00000000..ed450fd0 --- /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 00000000..dfe650e7 --- /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 00000000..0027162e --- /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"), + "not_found": 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 00000000..e3d7c20d --- /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 00000000..8d084203 --- /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 00000000..ac7105a8 --- /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"), + "match_mode": 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 00000000..9f383be4 --- /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"), + "match_mode": 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 00000000..6e698cd0 --- /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 00000000..548c88b5 --- /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 00000000..38a555cd --- /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 00000000..1b11251f --- /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 00000000..bd057d1d --- /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 00000000..96120a5e --- /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 00000000..249fc270 --- /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 00000000..b69b4691 --- /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 00000000..00803d32 --- /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 00000000..5f53cf8c --- /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 00000000..5086d8af --- /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 00000000..c4e871a6 --- /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 00000000..82f71e29 --- /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"), + "view_location": obj.get("viewLocation"), + "download_location": obj.get("downloadLocation"), + "absolute_url": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadata_id": obj.get("metadataId"), + "created_timestamp": obj.get("createdTimestamp"), + "last_updated_timestamp": 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 00000000..e462ec38 --- /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({ + "model_name": 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 00000000..5c7cd6bf --- /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 00000000..35b332b3 --- /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 00000000..1e2216f9 --- /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 00000000..caf90051 --- /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 00000000..65e4e932 --- /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 00000000..165811d2 --- /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 00000000..3a90f732 --- /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 00000000..8f248f5a --- /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 00000000..cb29093f --- /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 00000000..b1d01a5e --- /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"), + "created_at": obj.get("createdAt"), + "modified_at": 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 00000000..75c79fc7 --- /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 00000000..3a385575 --- /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({ + "last_started": obj.get("lastStarted"), + "created_at": obj.get("createdAt"), + "last_completed_at": 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 00000000..efd6e62c --- /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 00000000..e8a355cd --- /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({ + "resource_type": obj.get("resourceType"), + "resource_id": obj.get("resourceId"), + "include_paths": 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 00000000..d796a168 --- /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({ + "google_drive": 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 00000000..dabe4779 --- /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"), + "google_drive": GoogleDriveConfig.from_dict(obj["googleDrive"]) if obj.get("googleDrive") is not None else None, + "cron_expression": obj.get("cronExpression"), + "metadata_config_id": 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 00000000..3667fc20 --- /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 00000000..f1875866 --- /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 00000000..357bc53a --- /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 00000000..7f19c1db --- /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({ + "resource_type": obj.get("resourceType"), + "resource_id": obj.get("resourceId"), + "include_paths": 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 00000000..10e9fc33 --- /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 00000000..1a5f7169 --- /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 00000000..b211c5f9 --- /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, + "extract_key_words_from_query": 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 00000000..d6e6183c --- /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 00000000..81ae7aa8 --- /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 00000000..8f3c87b7 --- /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 00000000..99bfc329 --- /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 00000000..0a5f37be --- /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 00000000..3d1fa359 --- /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 00000000..ed2a851f --- /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({ + "pipeline_id": obj.get("pipelineId"), + "metadata_only": 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 00000000..fc242803 --- /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, + "include_all_meta_data": 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 00000000..63a2d07d --- /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 00000000..2ba34999 --- /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 00000000..85e49ed1 --- /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 00000000..7464e90f --- /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 00000000..ec5e26e3 --- /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"), + "data_repository_metadata": [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 00000000..e423d2ca --- /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 00000000..450d2376 --- /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 00000000..13c414be --- /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 00000000..7c356706 --- /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({ + "data_repository_metadata": [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 00000000..243a0ecc --- /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"), + "destination_name": obj.get("destinationName"), + "data_repository_type": obj.get("dataRepositoryType"), + "include_paths": 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 00000000..14c27d51 --- /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 00000000..31ec46a5 --- /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"), + "destination_name": obj.get("destinationName"), + "data_repository_type": obj.get("dataRepositoryType"), + "include_paths": obj.get("includePaths"), + "labels": [MetadataConfigurationRequestLabelsInner.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None, + "enumeration_status": 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 00000000..ea9ad36d --- /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({ + "metadata_config_id": obj.get("metadataConfigId"), + "cron_expression": 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 00000000..2c4670f7 --- /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 00000000..5b0e1a22 --- /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 00000000..6d44f8a1 --- /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 00000000..ef99f22d --- /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 00000000..b492b491 --- /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 00000000..740302d9 --- /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"), + "metadata_updates": [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 00000000..99b4f71a --- /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 00000000..a0ef4fb5 --- /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"), + "share_point": SharePointConfig.from_dict(obj["sharePoint"]) if obj.get("sharePoint") is not None else None, + "cron_expression": 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 00000000..e442c77c --- /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"), + "share_point": 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 00000000..c095a775 --- /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({ + "share_point": 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 00000000..c7296688 --- /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 00000000..84aa8199 --- /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 00000000..385c21ce --- /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 00000000..404cf1a1 --- /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 00000000..4c73506a --- /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({ + "cron_expression": 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 00000000..cab25b45 --- /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({ + "data_repository_metadata": [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 00000000..ddb2cc22 --- /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({ + "filter_id": 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 00000000..86628c87 --- /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 00000000..9f8fb0d0 --- /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({ + "filter_id": 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 00000000..1f688880 --- /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"), + "view_location": obj.get("viewLocation"), + "download_location": obj.get("downloadLocation"), + "absolute_url": obj.get("absoluteUrl"), + "title": obj.get("title"), + "metadata_id": obj.get("metadataId"), + "created_timestamp": obj.get("createdTimestamp"), + "last_updated_timestamp": 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 00000000..8866bdc3 --- /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"), + "created_at": obj.get("createdAt"), + "modified_at": 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 00000000..1b7eae72 --- /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 00000000..b05ef27e --- /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({ + "pipeline_id": 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 00000000..9ef685f9 --- /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 00000000..0fd66251 --- /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 00000000..135a1c6e --- /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', + "max_chunk_count": 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 00000000..fb68357b --- /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 00000000..68e93388 --- /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 00000000..fad54610 --- /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 00000000..72ab68e3 --- /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 00000000..e8d56a62 --- /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, + "search_scores": SearchScores.from_dict(obj["searchScores"]) if obj.get("searchScores") is not None else None, + "post_processing_score": 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 00000000..32d08221 --- /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({ + "data_repository": 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 00000000..41d81a55 --- /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"), + "match_mode": 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 00000000..56b36add --- /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 00000000..c3fc6559 --- /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({ + "filter_id": obj.get("filterId"), + "results": [RetrievalDataRepositorySearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "remote_grounding_name": 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 00000000..6f712924 --- /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 00000000..5a4e1a91 --- /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({ + "filter_id": 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 00000000..1cf9bb93 --- /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 00000000..7c0cfc35 --- /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({ + "max_chunk_count": obj.get("maxChunkCount"), + "max_document_count": 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 00000000..8d6f3a54 --- /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"), + "select_mode": 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 00000000..0fe91f40 --- /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"), + "search_configuration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "data_repositories": obj.get("dataRepositories"), + "data_repository_type": obj.get("dataRepositoryType"), + "remote_name": obj.get("remoteName"), + "data_repository_metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "document_metadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunk_metadata": [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 00000000..80cd1262 --- /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, + "post_processing": [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 00000000..b5c27a1d --- /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', + "max_chunk_count": 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 00000000..13834876 --- /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 00000000..61c18795 --- /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 00000000..02c4a54c --- /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 00000000..31e9eea7 --- /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 00000000..913ed5c8 --- /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"), + "search_configuration": RetrievalSearchConfiguration.from_dict(obj["searchConfiguration"]) if obj.get("searchConfiguration") is not None else None, + "data_repositories": obj.get("dataRepositories"), + "data_repository_type": obj.get("dataRepositoryType"), + "remote_name": obj.get("remoteName"), + "data_repository_metadata": [RetrievalKeyValueListPair.from_dict(_item) for _item in obj["dataRepositoryMetadata"]] if obj.get("dataRepositoryMetadata") is not None else None, + "document_metadata": [RetrievalSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunk_metadata": [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, + "scoring_configuration": 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 00000000..3ea17cc4 --- /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 00000000..4e268a96 --- /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 00000000..10277c58 --- /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 00000000..c6d966a5 --- /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, + "cron_expression": 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 00000000..9b836acf --- /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 00000000..23d35387 --- /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 00000000..7cbcad76 --- /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 00000000..51fa3ce5 --- /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 00000000..0cb6288c --- /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 00000000..f360da30 --- /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 00000000..a5668132 --- /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 00000000..899fb815 --- /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 00000000..d7d08933 --- /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 00000000..c321e850 --- /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 00000000..abc53fbe --- /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({ + "max_chunk_count": obj.get("maxChunkCount"), + "max_document_count": 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 00000000..0a1f30ca --- /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"), + "select_mode": 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 00000000..15de612d --- /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"), + "collection_ids": obj.get("collectionIds"), + "configuration": SearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collection_metadata": [KeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "document_metadata": [SearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunk_metadata": [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 00000000..985bb877 --- /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({ + "data_repository_metadata": [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 00000000..47d6766b --- /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 00000000..93be5eaf --- /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 00000000..28ebf01e --- /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({ + "aggregated_score": SearchScoresAggregatedScore.from_dict(obj["aggregatedScore"]) if obj.get("aggregatedScore") is not None else None, + "dense_retrieval_score": 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 00000000..bb8b78f2 --- /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 00000000..170a28a1 --- /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 00000000..6f49704b --- /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({ + "include_paths": 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 00000000..610e2d49 --- /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"), + "service_now": 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 00000000..04f111fb --- /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({ + "include_paths": 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 00000000..c98a42ff --- /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"), + "service_now": ServiceNowConfig.from_dict(obj["serviceNow"]) if obj.get("serviceNow") is not None else None, + "metadata_config_id": obj.get("metadataConfigId"), + "cron_expression": 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 00000000..0f237908 --- /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 00000000..df6ee8f8 --- /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 00000000..65cc2105 --- /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 00000000..04484552 --- /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, + "cron_expression": 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 00000000..e4f7bd18 --- /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 00000000..849cbdbc --- /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 00000000..78947aa0 --- /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 00000000..15d79fa6 --- /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 00000000..2c9b7dff --- /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 00000000..49a9688b --- /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 00000000..176301c2 --- /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"), + "include_paths": 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 00000000..9ae558f4 --- /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"), + "include_paths": 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 00000000..392f4625 --- /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"), + "include_paths": 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 00000000..75abb5fe --- /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 00000000..6a919db0 --- /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 00000000..7c84155a --- /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 00000000..a680f913 --- /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 00000000..590429d2 --- /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 00000000..c41018a1 --- /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 00000000..f51358db --- /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"), + "match_mode": 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 00000000..05daa4ee --- /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 00000000..5dcf52f1 --- /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({ + "filter_id": 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 00000000..3df12f8c --- /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({ + "dense_retrieval": DenseRetrievalScoringConfiguration.from_dict(obj["denseRetrieval"]) if obj.get("denseRetrieval") is not None else None, + "keyword_retrieval": 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, + "score_threshold": obj.get("scoreThreshold"), + "aggregation_strategy": 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 00000000..584d3c4e --- /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({ + "max_chunk_count": obj.get("maxChunkCount"), + "max_document_count": 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 00000000..520556d5 --- /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"), + "select_mode": 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 00000000..a85535a0 --- /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"), + "collection_ids": obj.get("collectionIds"), + "configuration": VectorSearchConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None, + "collection_metadata": [VectorKeyValueListPair.from_dict(_item) for _item in obj["collectionMetadata"]] if obj.get("collectionMetadata") is not None else None, + "document_metadata": [VectorSearchDocumentKeyValueListPair.from_dict(_item) for _item in obj["documentMetadata"]] if obj.get("documentMetadata") is not None else None, + "chunk_metadata": [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 00000000..a45c0416 --- /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 00000000..98754a0e --- /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 00000000..53da7ec2 --- /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 00000000..f720f1e6 --- /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 00000000..c91e0fab --- /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 00000000..e69de29b 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 00000000..e6b72c68 --- /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 00000000..dd7a6300 --- /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/document_grounding_generation_kiota/__init__.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/__init__.py new file mode 100644 index 00000000..3a4c3c7e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/__init__.py @@ -0,0 +1,5 @@ +"""Kiota-generated client for the SAP Document Grounding service.""" + +from gen_ai_hub.document_grounding_generation_kiota.client import KiotaGroundingApiClient + +__all__ = ["KiotaGroundingApiClient"] diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/client.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/client.py new file mode 100644 index 00000000..5b8094a2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/client.py @@ -0,0 +1,78 @@ +"""SAP wrapper client for the Document Grounding service using Kiota-generated code. + +The generated code under `generated/` is produced by running: + + cd packages/gen && make generate-kiota + +This requires `kiota` on PATH (install via `brew install kiota` or +`dotnet tool install --global Microsoft.OpenApi.Kiota`). + +Usage:: + + from gen_ai_hub.document_grounding_generation_kiota import KiotaGroundingApiClient + + client = KiotaGroundingApiClient() + result = await client.retrieval.search.post(body) +""" + +from __future__ import annotations + +from typing import Optional + +from kiota_abstractions.authentication.authentication_provider import AuthenticationProvider +from kiota_abstractions.request_information import RequestInformation +from kiota_http.httpx_request_adapter import HttpxRequestAdapter + +from gen_ai_hub.proxy.core.base import BaseProxyClient +from gen_ai_hub.proxy import get_proxy_client + +from gen_ai_hub.document_grounding_generation_kiota.generated.document_grounding_client import ( + DocumentGroundingClient, +) + + +class _SapAuthProvider(AuthenticationProvider): + """Injects SAP AI Core auth headers into every Kiota request.""" + + def __init__(self, proxy_client: BaseProxyClient) -> None: + self._client = proxy_client + + async def authenticate_request( + self, + request: RequestInformation, + additional_authentication_context: Optional[dict] = None, + ) -> None: + for key, value in self._client.request_header.items(): + request.headers.try_add(key, value) + + +def _get_base_url(client: BaseProxyClient) -> str: + ai_core = getattr(client, "ai_core_client", None) + if ai_core is None: + raise ValueError("proxy client has no ai_core_client configured") + return ai_core.base_url.rstrip("/") + "/lm/document-grounding" + + +class KiotaGroundingApiClient: + """Kiota-based async client for the Document Grounding service. + + Resolves auth and base URL from the proxy client automatically. + If no proxy client is provided, one is created via get_proxy_client(). + + Usage:: + + client = KiotaGroundingApiClient() + # access request builders directly on the generated root client + result = await client.generated.retrieval.search.post(body) + """ + + def __init__( + self, + proxy_client: Optional[BaseProxyClient] = None, + base_url: Optional[str] = None, + ) -> None: + client = proxy_client or get_proxy_client() + url = base_url or _get_base_url(client) + auth = _SapAuthProvider(client) + adapter = HttpxRequestAdapter(auth, base_url=url) + self.generated = DocumentGroundingClient(adapter) diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/document_grounding_client.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/document_grounding_client.py new file mode 100644 index 00000000..1e01e043 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/document_grounding_client.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from kiota_abstractions.api_client_builder import enable_backing_store_for_serialization_writer_factory, register_default_deserializer, register_default_serializer +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.serialization import ParseNodeFactoryRegistry, SerializationWriterFactoryRegistry +from kiota_serialization_form.form_parse_node_factory import FormParseNodeFactory +from kiota_serialization_form.form_serialization_writer_factory import FormSerializationWriterFactory +from kiota_serialization_json.json_parse_node_factory import JsonParseNodeFactory +from kiota_serialization_json.json_serialization_writer_factory import JsonSerializationWriterFactory +from kiota_serialization_multipart.multipart_serialization_writer_factory import MultipartSerializationWriterFactory +from kiota_serialization_text.text_parse_node_factory import TextParseNodeFactory +from kiota_serialization_text.text_serialization_writer_factory import TextSerializationWriterFactory +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .pipelines.pipelines_request_builder import PipelinesRequestBuilder + from .retrieval.retrieval_request_builder import RetrievalRequestBuilder + from .vector.vector_request_builder import VectorRequestBuilder + +class DocumentGroundingClient(BaseRequestBuilder): + """ + The main entry point of the SDK, exposes the configuration and the fluent API. + """ + def __init__(self,request_adapter: RequestAdapter) -> None: + """ + Instantiates a new DocumentGroundingClient and sets the default values. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + if request_adapter is None: + raise TypeError("request_adapter cannot be null.") + super().__init__(request_adapter, "{+baseurl}", None) + register_default_serializer(JsonSerializationWriterFactory) + register_default_serializer(TextSerializationWriterFactory) + register_default_serializer(FormSerializationWriterFactory) + register_default_serializer(MultipartSerializationWriterFactory) + register_default_deserializer(JsonParseNodeFactory) + register_default_deserializer(TextParseNodeFactory) + register_default_deserializer(FormParseNodeFactory) + if not self.request_adapter.base_url: + self.request_adapter.base_url = "/lm/document-grounding" + self.path_parameters["base_url"] = self.request_adapter.base_url + + @property + def pipelines(self) -> PipelinesRequestBuilder: + """ + The pipelines property + """ + from .pipelines.pipelines_request_builder import PipelinesRequestBuilder + + return PipelinesRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def retrieval(self) -> RetrievalRequestBuilder: + """ + The retrieval property + """ + from .retrieval.retrieval_request_builder import RetrievalRequestBuilder + + return RetrievalRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def vector(self) -> VectorRequestBuilder: + """ + The vector property + """ + from .vector.vector_request_builder import VectorRequestBuilder + + return VectorRequestBuilder(self.request_adapter, self.path_parameters) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/kiota-lock.json b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/kiota-lock.json new file mode 100644 index 00000000..461d96d8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/kiota-lock.json @@ -0,0 +1,35 @@ +{ + "descriptionHash": "988FEC0CE8490C48E945FE1A09F2A519599102A049E507924456D175C0A88A447F567492443C50EAA532B70E8CA8A748C7DF53F0BAC8BB8756610D483B512335", + "descriptionLocation": "../processed.yaml", + "lockFileVersion": "1.0.0", + "kiotaVersion": "1.35.0", + "clientClassName": "DocumentGroundingClient", + "typeAccessModifier": "Public", + "clientNamespaceName": "gen_ai_hub.document_grounding_generation_kiota.generated", + "language": "Python", + "usesBackingStore": false, + "excludeBackwardCompatible": true, + "includeAdditionalData": true, + "disableSSLValidation": false, + "serializers": [ + "Microsoft.Kiota.Serialization.Json.JsonSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Text.TextSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Form.FormSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Multipart.MultipartSerializationWriterFactory" + ], + "deserializers": [ + "Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory", + "Microsoft.Kiota.Serialization.Text.TextParseNodeFactory", + "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory" + ], + "structuredMimeTypes": [ + "application/json", + "text/plain;q=0.9", + "application/x-www-form-urlencoded;q=0.2", + "multipart/form-data;q=0.1" + ], + "includePatterns": [], + "excludePatterns": [], + "disabledValidationRules": [], + "allowedExternalOrigins": [] +} \ No newline at end of file diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/api_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/api_error.py new file mode 100644 index 00000000..a26c97ff --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/api_error.py @@ -0,0 +1,70 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .details_error_response import DetailsErrorResponse + +@dataclass +class ApiError(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Descriptive error code (not http status code). + code: Optional[str] = None + # The details property + details: Optional[list[DetailsErrorResponse]] = None + # plaintext error description + message: Optional[str] = None + # id of individual request + request_id: Optional[str] = None + # url that has been called + target: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ApiError: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ApiError + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ApiError() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .details_error_response import DetailsErrorResponse + + from .details_error_response import DetailsErrorResponse + + fields: dict[str, Callable[[Any], None]] = { + "code": lambda n : setattr(self, 'code', n.get_str_value()), + "details": lambda n : setattr(self, 'details', n.get_collection_of_object_values(DetailsErrorResponse)), + "message": lambda n : setattr(self, 'message', n.get_str_value()), + "requestId": lambda n : setattr(self, 'request_id', n.get_str_value()), + "target": lambda n : setattr(self, 'target', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("code", self.code) + writer.write_collection_of_object_values("details", self.details) + writer.write_str_value("message", self.message) + writer.write_str_value("requestId", self.request_id) + writer.write_str_value("target", self.target) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_document.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_document.py new file mode 100644 index 00000000..f4312ab6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_document.py @@ -0,0 +1,64 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .text_only_base_chunk_create import TextOnlyBaseChunkCreate + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + +@dataclass +class BaseDocument(AdditionalDataHolder, Parsable): + """ + Base class for documents, document requests and responses. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The chunks property + chunks: Optional[list[TextOnlyBaseChunkCreate]] = None + # The metadata property + metadata: Optional[list[VectorDocumentKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BaseDocument: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BaseDocument + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BaseDocument() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .text_only_base_chunk_create import TextOnlyBaseChunkCreate + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + from .text_only_base_chunk_create import TextOnlyBaseChunkCreate + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "chunks": lambda n : setattr(self, 'chunks', n.get_collection_of_object_values(TextOnlyBaseChunkCreate)), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorDocumentKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunks", self.chunks) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_pipeline_minimal_response.py new file mode 100644 index 00000000..6bcfb404 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_pipeline_minimal_response.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class BasePipelineMinimalResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The id property + id: Optional[str] = None + # The status property + status: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BasePipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BasePipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BasePipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_str_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_pipeline_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_pipeline_response.py new file mode 100644 index 00000000..373432a1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/base_pipeline_response.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + +@dataclass +class BasePipelineResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The id property + id: Optional[str] = None + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BasePipelineResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BasePipelineResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BasePipelineResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + + from .meta_data import MetaData + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_object_value("metadata", self.metadata) + writer.write_str_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/batch_update_documents_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/batch_update_documents_response400_error.py new file mode 100644 index 00000000..9c279ec0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/batch_update_documents_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class BatchUpdateDocumentsResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BatchUpdateDocumentsResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BatchUpdateDocumentsResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BatchUpdateDocumentsResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter.py new file mode 100644 index 00000000..d9b79812 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .binary_boolean_filter_left import BinaryBooleanFilter_left + from .binary_boolean_filter_operator import BinaryBooleanFilter_operator + from .binary_boolean_filter_right import BinaryBooleanFilter_right + +@dataclass +class BinaryBooleanFilter(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Left operand of the boolean expression + left: Optional[BinaryBooleanFilter_left] = None + # Boolean operator for combining filter conditions + operator: Optional[BinaryBooleanFilter_operator] = None + # Right operand of the boolean expression + right: Optional[BinaryBooleanFilter_right] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BinaryBooleanFilter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BinaryBooleanFilter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BinaryBooleanFilter() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .binary_boolean_filter_left import BinaryBooleanFilter_left + from .binary_boolean_filter_operator import BinaryBooleanFilter_operator + from .binary_boolean_filter_right import BinaryBooleanFilter_right + + from .binary_boolean_filter_left import BinaryBooleanFilter_left + from .binary_boolean_filter_operator import BinaryBooleanFilter_operator + from .binary_boolean_filter_right import BinaryBooleanFilter_right + + fields: dict[str, Callable[[Any], None]] = { + "left": lambda n : setattr(self, 'left', n.get_object_value(BinaryBooleanFilter_left)), + "operator": lambda n : setattr(self, 'operator', n.get_enum_value(BinaryBooleanFilter_operator)), + "right": lambda n : setattr(self, 'right', n.get_object_value(BinaryBooleanFilter_right)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("left", self.left) + writer.write_enum_value("operator", self.operator) + writer.write_object_value("right", self.right) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_left.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_left.py new file mode 100644 index 00000000..223a0768 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_left.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .binary_boolean_filter import BinaryBooleanFilter + from .scoped_key_value_list_pair import ScopedKeyValueListPair + +@dataclass +class BinaryBooleanFilter_left(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes BinaryBooleanFilter, ScopedKeyValueListPair + """ + # Composed type representation for type BinaryBooleanFilter + binary_boolean_filter: Optional[BinaryBooleanFilter] = None + # Composed type representation for type ScopedKeyValueListPair + scoped_key_value_list_pair: Optional[ScopedKeyValueListPair] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BinaryBooleanFilter_left: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BinaryBooleanFilter_left + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = BinaryBooleanFilter_left() + from .binary_boolean_filter import BinaryBooleanFilter + + result.binary_boolean_filter = BinaryBooleanFilter() + from .scoped_key_value_list_pair import ScopedKeyValueListPair + + result.scoped_key_value_list_pair = ScopedKeyValueListPair() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .binary_boolean_filter import BinaryBooleanFilter + from .scoped_key_value_list_pair import ScopedKeyValueListPair + + if self.binary_boolean_filter or self.scoped_key_value_list_pair: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.binary_boolean_filter, self.scoped_key_value_list_pair) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.binary_boolean_filter, self.scoped_key_value_list_pair) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_operator.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_operator.py new file mode 100644 index 00000000..62edad96 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_operator.py @@ -0,0 +1,6 @@ +from enum import Enum + +class BinaryBooleanFilter_operator(str, Enum): + And_ = "and", + Or_ = "or", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_right.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_right.py new file mode 100644 index 00000000..bf2db073 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/binary_boolean_filter_right.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .binary_boolean_filter import BinaryBooleanFilter + from .scoped_key_value_list_pair import ScopedKeyValueListPair + +@dataclass +class BinaryBooleanFilter_right(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes BinaryBooleanFilter, ScopedKeyValueListPair + """ + # Composed type representation for type BinaryBooleanFilter + binary_boolean_filter: Optional[BinaryBooleanFilter] = None + # Composed type representation for type ScopedKeyValueListPair + scoped_key_value_list_pair: Optional[ScopedKeyValueListPair] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BinaryBooleanFilter_right: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BinaryBooleanFilter_right + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = BinaryBooleanFilter_right() + from .binary_boolean_filter import BinaryBooleanFilter + + result.binary_boolean_filter = BinaryBooleanFilter() + from .scoped_key_value_list_pair import ScopedKeyValueListPair + + result.scoped_key_value_list_pair = ScopedKeyValueListPair() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .binary_boolean_filter import BinaryBooleanFilter + from .scoped_key_value_list_pair import ScopedKeyValueListPair + + if self.binary_boolean_filter or self.scoped_key_value_list_pair: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.binary_boolean_filter, self.scoped_key_value_list_pair) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.binary_boolean_filter, self.scoped_key_value_list_pair) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_score_computation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_score_computation_strategy.py new file mode 100644 index 00000000..7895eabe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_score_computation_strategy.py @@ -0,0 +1,6 @@ +from enum import Enum + +class BoostingScoreComputationStrategy(str, Enum): + Match_count = "match_count", + Embedding = "embedding", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration.py new file mode 100644 index 00000000..7fe6eae1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .boosting_score_computation_strategy import BoostingScoreComputationStrategy + from .boosting_scoring_configuration_metadata import BoostingScoringConfiguration_metadata + +@dataclass +class BoostingScoringConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Enable metadata-based boosting. + enabled: Optional[bool] = True + # Contribution to final score. + weight: Optional[int] = 1 + # The metadata property + metadata: Optional[list[BoostingScoringConfiguration_metadata]] = None + # The scoreComputationStrategy property + score_computation_strategy: Optional[BoostingScoreComputationStrategy] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BoostingScoringConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BoostingScoringConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BoostingScoringConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .boosting_score_computation_strategy import BoostingScoreComputationStrategy + from .boosting_scoring_configuration_metadata import BoostingScoringConfiguration_metadata + + from .boosting_score_computation_strategy import BoostingScoreComputationStrategy + from .boosting_scoring_configuration_metadata import BoostingScoringConfiguration_metadata + + fields: dict[str, Callable[[Any], None]] = { + "enabled": lambda n : setattr(self, 'enabled', n.get_bool_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(BoostingScoringConfiguration_metadata)), + "scoreComputationStrategy": lambda n : setattr(self, 'score_computation_strategy', n.get_enum_value(BoostingScoreComputationStrategy)), + "weight": lambda n : setattr(self, 'weight', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_bool_value("enabled", self.enabled) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_enum_value("scoreComputationStrategy", self.score_computation_strategy) + writer.write_int_value("weight", self.weight) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration_metadata.py new file mode 100644 index 00000000..81f068bc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration_metadata.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .boosting_scoring_configuration_metadata_scope import BoostingScoringConfiguration_metadata_scope + +@dataclass +class BoostingScoringConfiguration_metadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + from .boosting_scoring_configuration_metadata_scope import BoostingScoringConfiguration_metadata_scope + + # The scope property + scope: Optional[BoostingScoringConfiguration_metadata_scope] = BoostingScoringConfiguration_metadata_scope("document") + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + # The weight property + weight: Optional[int] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BoostingScoringConfiguration_metadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BoostingScoringConfiguration_metadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return BoostingScoringConfiguration_metadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .boosting_scoring_configuration_metadata_scope import BoostingScoringConfiguration_metadata_scope + + from .boosting_scoring_configuration_metadata_scope import BoostingScoringConfiguration_metadata_scope + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "scope": lambda n : setattr(self, 'scope', n.get_enum_value(BoostingScoringConfiguration_metadata_scope)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + "weight": lambda n : setattr(self, 'weight', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_enum_value("scope", self.scope) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_int_value("weight", self.weight) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration_metadata_scope.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration_metadata_scope.py new file mode 100644 index 00000000..04efbd5c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/boosting_scoring_configuration_metadata_scope.py @@ -0,0 +1,7 @@ +from enum import Enum + +class BoostingScoringConfiguration_metadata_scope(str, Enum): + Repository = "repository", + Document = "document", + Chunk = "chunk", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection.py new file mode 100644 index 00000000..2309faf7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .embedding_config import EmbeddingConfig + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class Collection(AdditionalDataHolder, Parsable): + """ + A logical grouping of content. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The embeddingConfig property + embedding_config: Optional[EmbeddingConfig] = None + # Unique identifier of a collection. + id: Optional[UUID] = None + # Metadata attached to collection. Useful to restrict search to a subset of collections. + metadata: Optional[list[VectorKeyValueListPair]] = None + # The title property + title: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Collection: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Collection + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Collection() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .embedding_config import EmbeddingConfig + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .embedding_config import EmbeddingConfig + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "embeddingConfig": lambda n : setattr(self, 'embedding_config', n.get_object_value(EmbeddingConfig)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("embeddingConfig", self.embedding_config) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_str_value("title", self.title) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection400_error.py new file mode 100644 index 00000000..4c9df47e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Collection400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Collection400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Collection400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Collection400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection404_error.py new file mode 100644 index 00000000..705cbfe6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Collection404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Collection404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Collection404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Collection404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection422_error.py new file mode 100644 index 00000000..f941a9e2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Collection422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Collection422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Collection422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Collection422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_created_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_created_response.py new file mode 100644 index 00000000..176c0bc0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_created_response.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class CollectionCreatedResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The collectionURL property + collection_u_r_l: Optional[str] = None + # The status property + status: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CollectionCreatedResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CollectionCreatedResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CollectionCreatedResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "collectionURL": lambda n : setattr(self, 'collection_u_r_l', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("collectionURL", self.collection_u_r_l) + writer.write_str_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_deleted_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_deleted_response.py new file mode 100644 index 00000000..c538e494 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_deleted_response.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class CollectionDeletedResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The collectionURL property + collection_u_r_l: Optional[str] = None + # The status property + status: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CollectionDeletedResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CollectionDeletedResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CollectionDeletedResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "collectionURL": lambda n : setattr(self, 'collection_u_r_l', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("collectionURL", self.collection_u_r_l) + writer.write_str_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_pending_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_pending_response.py new file mode 100644 index 00000000..4770e27e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_pending_response.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class CollectionPendingResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The monitorURL property + monitor_u_r_l: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CollectionPendingResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CollectionPendingResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CollectionPendingResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "monitorURL": lambda n : setattr(self, 'monitor_u_r_l', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("monitorURL", self.monitor_u_r_l) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_request.py new file mode 100644 index 00000000..8ac13068 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collection_request.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .embedding_config import EmbeddingConfig + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class CollectionRequest(AdditionalDataHolder, Parsable): + """ + A request for creating a new, single collection. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The embeddingConfig property + embedding_config: Optional[EmbeddingConfig] = None + # Unique identifier of a collection. + id: Optional[UUID] = None + # Metadata attached to collection. Useful to restrict search to a subset of collections. + metadata: Optional[list[VectorKeyValueListPair]] = None + # The title property + title: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CollectionRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CollectionRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CollectionRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .embedding_config import EmbeddingConfig + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .embedding_config import EmbeddingConfig + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "embeddingConfig": lambda n : setattr(self, 'embedding_config', n.get_object_value(EmbeddingConfig)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("embeddingConfig", self.embedding_config) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_str_value("title", self.title) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections400_error.py new file mode 100644 index 00000000..6e5dd8c5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Collections400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Collections400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Collections400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Collections400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections422_error.py new file mode 100644 index 00000000..4b0e5085 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Collections422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Collections422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Collections422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Collections422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections_list_response.py new file mode 100644 index 00000000..acbd24b9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections_list_response.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .collection import Collection + +@dataclass +class CollectionsListResponse(AdditionalDataHolder, Parsable): + """ + A response containing collections retrieved from the server. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[Collection]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CollectionsListResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CollectionsListResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CollectionsListResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .collection import Collection + + from .collection import Collection + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(Collection)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections_list_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections_list_response400_error.py new file mode 100644 index 00000000..1f882bb5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/collections_list_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class CollectionsListResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CollectionsListResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CollectionsListResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CollectionsListResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document.py new file mode 100644 index 00000000..97563b28 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document.py @@ -0,0 +1,78 @@ +from __future__ import annotations +import datetime +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .configuration_document_type import ConfigurationDocument_type + from .document_metadata import DocumentMetadata + +@dataclass +class ConfigurationDocument(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Absolute file path of the document in the repository. + absolute_file_path: Optional[str] = None + # UTC timestamp when the document was created (RFC 3339 format, e.g., 2025-08-28T06:15:30Z) + created_timestamp: Optional[datetime.datetime] = None + # Unique identifier for the document. + id: Optional[str] = None + # Metadata key-value pairs associated with the document. + metadata: Optional[list[DocumentMetadata]] = None + # Title of the document. + title: Optional[str] = None + # Type of the resource. Can be FOLDER, DOCUMENT. + type: Optional[ConfigurationDocument_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ConfigurationDocument: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ConfigurationDocument + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ConfigurationDocument() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .configuration_document_type import ConfigurationDocument_type + from .document_metadata import DocumentMetadata + + from .configuration_document_type import ConfigurationDocument_type + from .document_metadata import DocumentMetadata + + fields: dict[str, Callable[[Any], None]] = { + "absoluteFilePath": lambda n : setattr(self, 'absolute_file_path', n.get_str_value()), + "createdTimestamp": lambda n : setattr(self, 'created_timestamp', n.get_datetime_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(DocumentMetadata)), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(ConfigurationDocument_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("absoluteFilePath", self.absolute_file_path) + writer.write_datetime_value("createdTimestamp", self.created_timestamp) + writer.write_str_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_str_value("title", self.title) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document400_error.py new file mode 100644 index 00000000..acc9b2d6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class ConfigurationDocument400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ConfigurationDocument400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ConfigurationDocument400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ConfigurationDocument400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document_type.py new file mode 100644 index 00000000..fe4775e0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configuration_document_type.py @@ -0,0 +1,6 @@ +from enum import Enum + +class ConfigurationDocument_type(str, Enum): + FOLDER = "FOLDER", + DOCUMENT = "DOCUMENT", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configurations400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configurations400_error.py new file mode 100644 index 00000000..8c3d25f1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/configurations400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Configurations400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Configurations400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Configurations400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Configurations400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status400_error.py new file mode 100644 index 00000000..c49695eb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class CreationStatus400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CreationStatus400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CreationStatus400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CreationStatus400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status404_error.py new file mode 100644 index 00000000..ec2d419a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class CreationStatus404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CreationStatus404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CreationStatus404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CreationStatus404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status422_error.py new file mode 100644 index 00000000..32ec5813 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/creation_status422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class CreationStatus422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CreationStatus422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CreationStatus422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return CreationStatus422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repositories.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repositories.py new file mode 100644 index 00000000..301d5103 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repositories.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .data_repository import DataRepository + +@dataclass +class DataRepositories(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[DataRepository]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepositories: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepositories + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepositories() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .data_repository import DataRepository + + from .data_repository import DataRepository + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(DataRepository)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repositories400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repositories400_error.py new file mode 100644 index 00000000..574c0686 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repositories400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DataRepositories400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepositories400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepositories400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepositories400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository.py new file mode 100644 index 00000000..d2851b84 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository.py @@ -0,0 +1,81 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + +@dataclass +class DataRepository(AdditionalDataHolder, Parsable): + """ + DataRepository schema expected by Retrieval. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Unique identifier of this DataRepository. + id: Optional[UUID] = None + # The message property + message: Optional[str] = None + # Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + metadata: Optional[list[RetrievalKeyValueListPair]] = None + # The remoteGroundingName property + remote_grounding_name: Optional[str] = None + # The title property + title: Optional[str] = None + # Only include DataRepositories with the given type. + type: Optional[DataRepositoryType] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepository: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepository + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepository() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "message": lambda n : setattr(self, 'message', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "remoteGroundingName": lambda n : setattr(self, 'remote_grounding_name', n.get_str_value()), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(DataRepositoryType)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_uuid_value("id", self.id) + writer.write_str_value("message", self.message) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_str_value("remoteGroundingName", self.remote_grounding_name) + writer.write_str_value("title", self.title) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository400_error.py new file mode 100644 index 00000000..d2cbd4c5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DataRepository400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepository400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepository400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepository400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository404_error.py new file mode 100644 index 00000000..88a4f178 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DataRepository404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepository404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepository404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepository404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository422_error.py new file mode 100644 index 00000000..ae9d9245 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DataRepository422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepository422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepository422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepository422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository_type.py new file mode 100644 index 00000000..709cbd64 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository_type.py @@ -0,0 +1,7 @@ +from enum import Enum + +class DataRepositoryType(str, Enum): + Vector = "vector", + HelpSapCom = "help.sap.com", + RemoteDg = "remote:dg", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository_with_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository_with_documents.py new file mode 100644 index 00000000..cccaff54 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/data_repository_with_documents.py @@ -0,0 +1,81 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .document import Document + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + +@dataclass +class DataRepositoryWithDocuments(AdditionalDataHolder, Parsable): + """ + DataRepository schema returned by the Vector search endpoint + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The documents property + documents: Optional[list[Document]] = None + # Unique identifier of this DataRepository. + id: Optional[UUID] = None + # Optional message. + message: Optional[str] = None + # Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + metadata: Optional[list[RetrievalKeyValueListPair]] = None + # Friendly destination Name (grounding.name) of remote instance. + remote_grounding_name: Optional[str] = None + # The title property + title: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DataRepositoryWithDocuments: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DataRepositoryWithDocuments + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DataRepositoryWithDocuments() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document import Document + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + + from .document import Document + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "documents": lambda n : setattr(self, 'documents', n.get_collection_of_object_values(Document)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "message": lambda n : setattr(self, 'message', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "remoteGroundingName": lambda n : setattr(self, 'remote_grounding_name', n.get_str_value()), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("documents", self.documents) + writer.write_uuid_value("id", self.id) + writer.write_str_value("message", self.message) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_str_value("remoteGroundingName", self.remote_grounding_name) + writer.write_str_value("title", self.title) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status400_error.py new file mode 100644 index 00000000..146f4375 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DeletionStatus400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DeletionStatus400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DeletionStatus400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DeletionStatus400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status404_error.py new file mode 100644 index 00000000..e788f03c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DeletionStatus404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DeletionStatus404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DeletionStatus404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DeletionStatus404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status422_error.py new file mode 100644 index 00000000..0e248237 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/deletion_status422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DeletionStatus422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DeletionStatus422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DeletionStatus422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DeletionStatus422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/dense_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/dense_retrieval_scoring_configuration.py new file mode 100644 index 00000000..e0f6f0ac --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/dense_retrieval_scoring_configuration.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class DenseRetrievalScoringConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Enable dense retrieval. + enabled: Optional[bool] = True + # Contribution to final score. + weight: Optional[int] = 1 + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DenseRetrievalScoringConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DenseRetrievalScoringConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DenseRetrievalScoringConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "enabled": lambda n : setattr(self, 'enabled', n.get_bool_value()), + "weight": lambda n : setattr(self, 'weight', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_bool_value("enabled", self.enabled) + writer.write_int_value("weight", self.weight) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/details_error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/details_error_response.py new file mode 100644 index 00000000..b6a57942 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/details_error_response.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class DetailsErrorResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Descriptive error code (not http status code) + code: Optional[str] = None + # Plaintext error description + message: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DetailsErrorResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DetailsErrorResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DetailsErrorResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "code": lambda n : setattr(self, 'code', n.get_str_value()), + "message": lambda n : setattr(self, 'message', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("code", self.code) + writer.write_str_value("message", self.message) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document.py new file mode 100644 index 00000000..8056a8ab --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document.py @@ -0,0 +1,65 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_chunk import RetrievalChunk + from .retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair + +@dataclass +class Document(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The chunks property + chunks: Optional[list[RetrievalChunk]] = None + # The id property + id: Optional[str] = None + # The metadata property + metadata: Optional[list[RetrievalDocumentKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Document: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Document + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Document() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_chunk import RetrievalChunk + from .retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair + + from .retrieval_chunk import RetrievalChunk + from .retrieval_document_key_value_list_pair import RetrievalDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "chunks": lambda n : setattr(self, 'chunks', n.get_collection_of_object_values(RetrievalChunk)), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(RetrievalDocumentKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunks", self.chunks) + writer.write_str_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_request.py new file mode 100644 index 00000000..28f3d208 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_request.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +@dataclass +class DocumentBulkDeleteRequest(AdditionalDataHolder, Parsable): + """ + A request to delete documents by their IDs. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of document IDs to delete + ids: Optional[list[UUID]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentBulkDeleteRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentBulkDeleteRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentBulkDeleteRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "ids": lambda n : setattr(self, 'ids', n.get_collection_of_primitive_values(UUID)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("ids", self.ids) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response.py new file mode 100644 index 00000000..98ea2836 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +@dataclass +class DocumentBulkDeleteResponse(AdditionalDataHolder, Parsable): + """ + Response after deleting documents in bulk. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of successfully deleted document IDs + deleted: Optional[list[UUID]] = None + # List of document IDs that were not found + not_found: Optional[list[UUID]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentBulkDeleteResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentBulkDeleteResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentBulkDeleteResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "deleted": lambda n : setattr(self, 'deleted', n.get_collection_of_primitive_values(UUID)), + "notFound": lambda n : setattr(self, 'not_found', n.get_collection_of_primitive_values(UUID)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("deleted", self.deleted) + writer.write_collection_of_primitive_values("notFound", self.not_found) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response400_error.py new file mode 100644 index 00000000..87c53252 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentBulkDeleteResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentBulkDeleteResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentBulkDeleteResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentBulkDeleteResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response404_error.py new file mode 100644 index 00000000..9cdd9403 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentBulkDeleteResponse404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentBulkDeleteResponse404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentBulkDeleteResponse404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentBulkDeleteResponse404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response422_error.py new file mode 100644 index 00000000..f1e9bd20 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_bulk_delete_response422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentBulkDeleteResponse422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentBulkDeleteResponse422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentBulkDeleteResponse422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentBulkDeleteResponse422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_create_request.py new file mode 100644 index 00000000..b00927d0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_create_request.py @@ -0,0 +1,57 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_document import BaseDocument + +@dataclass +class DocumentCreateRequest(AdditionalDataHolder, Parsable): + """ + A create request containing one or more new documents to create and store in a collection. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The documents property + documents: Optional[list[BaseDocument]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_document import BaseDocument + + from .base_document import BaseDocument + + fields: dict[str, Callable[[Any], None]] = { + "documents": lambda n : setattr(self, 'documents', n.get_collection_of_object_values(BaseDocument)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("documents", self.documents) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_input.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_input.py new file mode 100644 index 00000000..53886111 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_input.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .text_only_base_chunk_create import TextOnlyBaseChunkCreate + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + +@dataclass +class DocumentInput(AdditionalDataHolder, Parsable): + """ + A single document stored in a collection by ID. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The chunks property + chunks: Optional[list[TextOnlyBaseChunkCreate]] = None + # Unique identifier of a document. + id: Optional[UUID] = None + # The metadata property + metadata: Optional[list[VectorDocumentKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentInput: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentInput + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentInput() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .text_only_base_chunk_create import TextOnlyBaseChunkCreate + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + from .text_only_base_chunk_create import TextOnlyBaseChunkCreate + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "chunks": lambda n : setattr(self, 'chunks', n.get_collection_of_object_values(TextOnlyBaseChunkCreate)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorDocumentKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunks", self.chunks) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata.py new file mode 100644 index 00000000..5562ea48 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .document_metadata_match_mode import DocumentMetadata_matchMode + +@dataclass +class DocumentMetadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Metadata key name. + key: Optional[str] = None + # Match mode for the metadata key (ANY or ALL). + match_mode: Optional[DocumentMetadata_matchMode] = None + # 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. + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentMetadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentMetadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentMetadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_metadata_match_mode import DocumentMetadata_matchMode + + from .document_metadata_match_mode import DocumentMetadata_matchMode + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "matchMode": lambda n : setattr(self, 'match_mode', n.get_enum_value(DocumentMetadata_matchMode)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_enum_value("matchMode", self.match_mode) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_batch_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_batch_request.py new file mode 100644 index 00000000..380907ce --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_batch_request.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .document_metadata_update import DocumentMetadataUpdate + +@dataclass +class DocumentMetadataBatchRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of document metadata updates to be applied in batch. + value: Optional[list[DocumentMetadataUpdate]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentMetadataBatchRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentMetadataBatchRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentMetadataBatchRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_metadata_update import DocumentMetadataUpdate + + from .document_metadata_update import DocumentMetadataUpdate + + fields: dict[str, Callable[[Any], None]] = { + "value": lambda n : setattr(self, 'value', n.get_collection_of_object_values(DocumentMetadataUpdate)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_match_mode.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_match_mode.py new file mode 100644 index 00000000..4843e4c9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_match_mode.py @@ -0,0 +1,6 @@ +from enum import Enum + +class DocumentMetadata_matchMode(str, Enum): + ANY = "ANY", + ALL = "ALL", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_update.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_update.py new file mode 100644 index 00000000..a0bb13c5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_update.py @@ -0,0 +1,59 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .document_metadata import DocumentMetadata + +@dataclass +class DocumentMetadataUpdate(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Unique identifier of the document to update. + id: Optional[UUID] = None + # Metadata updates for this document. + metadata: Optional[list[DocumentMetadata]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentMetadataUpdate: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentMetadataUpdate + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentMetadataUpdate() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_metadata import DocumentMetadata + + from .document_metadata import DocumentMetadata + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(DocumentMetadata)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_update_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_update_error.py new file mode 100644 index 00000000..dfb1a741 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_metadata_update_error.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class DocumentMetadataUpdateError(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # HTTP error status code. + code: Optional[int] = None + # Error message. + message: Optional[str] = None + # Document ID that caused the error. + target: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentMetadataUpdateError: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentMetadataUpdateError + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentMetadataUpdateError() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "code": lambda n : setattr(self, 'code', n.get_int_value()), + "message": lambda n : setattr(self, 'message', n.get_str_value()), + "target": lambda n : setattr(self, 'target', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("code", self.code) + writer.write_str_value("message", self.message) + writer.write_str_value("target", self.target) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_output.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_output.py new file mode 100644 index 00000000..1277e269 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_output.py @@ -0,0 +1,66 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .vector_chunk import VectorChunk + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + +@dataclass +class DocumentOutput(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The chunks property + chunks: Optional[list[VectorChunk]] = None + # The id property + id: Optional[UUID] = None + # The metadata property + metadata: Optional[list[VectorDocumentKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentOutput: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentOutput + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentOutput() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_chunk import VectorChunk + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + from .vector_chunk import VectorChunk + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "chunks": lambda n : setattr(self, 'chunks', n.get_collection_of_object_values(VectorChunk)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorDocumentKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunks", self.chunks) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response.py new file mode 100644 index 00000000..eecfcf43 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .text_only_base_chunk import TextOnlyBaseChunk + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + +@dataclass +class DocumentResponse(AdditionalDataHolder, Parsable): + """ + A response containing information about a newly created, single document. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The chunks property + chunks: Optional[list[TextOnlyBaseChunk]] = None + # Unique identifier of a document. + id: Optional[UUID] = None + # The metadata property + metadata: Optional[list[VectorDocumentKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .text_only_base_chunk import TextOnlyBaseChunk + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + from .text_only_base_chunk import TextOnlyBaseChunk + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "chunks": lambda n : setattr(self, 'chunks', n.get_collection_of_object_values(TextOnlyBaseChunk)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorDocumentKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunks", self.chunks) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response400_error.py new file mode 100644 index 00000000..eed14afa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response404_error.py new file mode 100644 index 00000000..910476e6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentResponse404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentResponse404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentResponse404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentResponse404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response422_error.py new file mode 100644 index 00000000..42fcd1fa --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_response422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentResponse422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentResponse422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentResponse422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentResponse422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_update_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_update_request.py new file mode 100644 index 00000000..efbf1367 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_update_request.py @@ -0,0 +1,57 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .document_input import DocumentInput + +@dataclass +class DocumentUpdateRequest(AdditionalDataHolder, Parsable): + """ + An update request containing one or more documents to update existing documents in a collection by ID. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The documents property + documents: Optional[list[DocumentInput]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentUpdateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentUpdateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentUpdateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_input import DocumentInput + + from .document_input import DocumentInput + + fields: dict[str, Callable[[Any], None]] = { + "documents": lambda n : setattr(self, 'documents', n.get_collection_of_object_values(DocumentInput)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("documents", self.documents) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_without_chunks.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_without_chunks.py new file mode 100644 index 00000000..9acc25f1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/document_without_chunks.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + +@dataclass +class DocumentWithoutChunks(AdditionalDataHolder, Parsable): + """ + A single document stored in a collection by ID without exposing its chunks. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Unique identifier of a document. + id: Optional[UUID] = None + # The metadata property + metadata: Optional[list[VectorDocumentKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentWithoutChunks: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentWithoutChunks + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentWithoutChunks() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + from .vector_document_key_value_list_pair import VectorDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorDocumentKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents.py new file mode 100644 index 00000000..eb440f30 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .document_without_chunks import DocumentWithoutChunks + +@dataclass +class Documents(AdditionalDataHolder, Parsable): + """ + A response containing documents retrieved from the server. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[DocumentWithoutChunks]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Documents: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Documents + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Documents() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_without_chunks import DocumentWithoutChunks + + from .document_without_chunks import DocumentWithoutChunks + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(DocumentWithoutChunks)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents400_error.py new file mode 100644 index 00000000..1e7830ff --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Documents400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Documents400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Documents400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Documents400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents404_error.py new file mode 100644 index 00000000..54dfbb8e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Documents404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Documents404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Documents404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Documents404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents422_error.py new file mode 100644 index 00000000..be0e5784 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Documents422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Documents422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Documents422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Documents422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_chunk.py new file mode 100644 index 00000000..df92978d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_chunk.py @@ -0,0 +1,70 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .document_output import DocumentOutput + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class DocumentsChunk(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The documents property + documents: Optional[list[DocumentOutput]] = None + # The id property + id: Optional[UUID] = None + # The metadata property + metadata: Optional[list[VectorKeyValueListPair]] = None + # The title property + title: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsChunk: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsChunk + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsChunk() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_output import DocumentOutput + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .document_output import DocumentOutput + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "documents": lambda n : setattr(self, 'documents', n.get_collection_of_object_values(DocumentOutput)), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("documents", self.documents) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_str_value("title", self.title) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response.py new file mode 100644 index 00000000..3a4b949c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response.py @@ -0,0 +1,57 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .document_without_chunks import DocumentWithoutChunks + +@dataclass +class DocumentsListResponse(AdditionalDataHolder, Parsable): + """ + A response containing documents retrieved from the server. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The documents property + documents: Optional[list[DocumentWithoutChunks]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsListResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsListResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsListResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .document_without_chunks import DocumentWithoutChunks + + from .document_without_chunks import DocumentWithoutChunks + + fields: dict[str, Callable[[Any], None]] = { + "documents": lambda n : setattr(self, 'documents', n.get_collection_of_object_values(DocumentWithoutChunks)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("documents", self.documents) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response400_error.py new file mode 100644 index 00000000..c91c0281 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentsListResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsListResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsListResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsListResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response404_error.py new file mode 100644 index 00000000..2ba10bd9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentsListResponse404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsListResponse404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsListResponse404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsListResponse404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response422_error.py new file mode 100644 index 00000000..93c26576 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_list_response422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class DocumentsListResponse422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsListResponse422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsListResponse422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsListResponse422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_status_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_status_response.py new file mode 100644 index 00000000..ed32e548 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_status_response.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .documents_status_response_resources import DocumentsStatusResponse_resources + +@dataclass +class DocumentsStatusResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[DocumentsStatusResponse_resources]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsStatusResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsStatusResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsStatusResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .documents_status_response_resources import DocumentsStatusResponse_resources + + from .documents_status_response_resources import DocumentsStatusResponse_resources + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(DocumentsStatusResponse_resources)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_status_response_resources.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_status_response_resources.py new file mode 100644 index 00000000..56ed8fd1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/documents_status_response_resources.py @@ -0,0 +1,79 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class DocumentsStatusResponse_resources(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The absoluteUrl property + absolute_url: Optional[str] = None + # The createdTimestamp property + created_timestamp: Optional[str] = None + # The downloadLocation property + download_location: Optional[str] = None + # The id property + id: Optional[str] = None + # The lastUpdatedTimestamp property + last_updated_timestamp: Optional[str] = None + # The metadataId property + metadata_id: Optional[str] = None + # The status property + status: Optional[str] = None + # The title property + title: Optional[str] = None + # The viewLocation property + view_location: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsStatusResponse_resources: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DocumentsStatusResponse_resources + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return DocumentsStatusResponse_resources() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "absoluteUrl": lambda n : setattr(self, 'absolute_url', n.get_str_value()), + "createdTimestamp": lambda n : setattr(self, 'created_timestamp', n.get_str_value()), + "downloadLocation": lambda n : setattr(self, 'download_location', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "lastUpdatedTimestamp": lambda n : setattr(self, 'last_updated_timestamp', n.get_str_value()), + "metadataId": lambda n : setattr(self, 'metadata_id', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + "viewLocation": lambda n : setattr(self, 'view_location', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("absoluteUrl", self.absolute_url) + writer.write_str_value("createdTimestamp", self.created_timestamp) + writer.write_str_value("downloadLocation", self.download_location) + writer.write_str_value("id", self.id) + writer.write_str_value("lastUpdatedTimestamp", self.last_updated_timestamp) + writer.write_str_value("metadataId", self.metadata_id) + writer.write_str_value("status", self.status) + writer.write_str_value("title", self.title) + writer.write_str_value("viewLocation", self.view_location) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/embedding_config.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/embedding_config.py new file mode 100644 index 00000000..1481de9b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/embedding_config.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class EmbeddingConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The modelName property + model_name: Optional[str] = "text-embedding-ada-002" + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> EmbeddingConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: EmbeddingConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return EmbeddingConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "modelName": lambda n : setattr(self, 'model_name', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("modelName", self.model_name) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/error_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/error_response.py new file mode 100644 index 00000000..0dd7848b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/error_response.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ErrorResponse(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ErrorResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ErrorResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ErrorResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/filter_match_mode_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/filter_match_mode_enum.py new file mode 100644 index 00000000..46a3b445 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/filter_match_mode_enum.py @@ -0,0 +1,6 @@ +from enum import Enum + +class FilterMatchModeEnum(str, Enum): + ANY = "ANY", + ALL = "ALL", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline.py new file mode 100644 index 00000000..1794b232 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline.py @@ -0,0 +1,133 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse + from .m_s_share_point_pipeline_get_response import MSSharePointPipelineGetResponse + from .s3_pipeline_get_response import S3PipelineGetResponse + from .service_now_pipeline_get_response import ServiceNowPipelineGetResponse + from .s_d_m_pipeline_get_response import SDMPipelineGetResponse + from .s_f_t_p_pipeline_get_response import SFTPPipelineGetResponse + from .work_zone_pipeline_get_response import WorkZonePipelineGetResponse + +@dataclass +class GetPipeline(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, ServiceNowPipelineGetResponse, SFTPPipelineGetResponse, WorkZonePipelineGetResponse + """ + # Composed type representation for type GoogleDrivePipelineGetResponse + google_drive_pipeline_get_response: Optional[GoogleDrivePipelineGetResponse] = None + # Composed type representation for type MSSharePointPipelineGetResponse + m_s_share_point_pipeline_get_response: Optional[MSSharePointPipelineGetResponse] = None + # Composed type representation for type SDMPipelineGetResponse + s_d_m_pipeline_get_response: Optional[SDMPipelineGetResponse] = None + # Composed type representation for type SFTPPipelineGetResponse + s_f_t_p_pipeline_get_response: Optional[SFTPPipelineGetResponse] = None + # Composed type representation for type S3PipelineGetResponse + s3_pipeline_get_response: Optional[S3PipelineGetResponse] = None + # Composed type representation for type ServiceNowPipelineGetResponse + service_now_pipeline_get_response: Optional[ServiceNowPipelineGetResponse] = None + # Composed type representation for type WorkZonePipelineGetResponse + work_zone_pipeline_get_response: Optional[WorkZonePipelineGetResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipeline: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipeline + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("type") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = GetPipeline() + if mapping_value and mapping_value.casefold() == "GoogleDrive".casefold(): + from .google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse + + result.google_drive_pipeline_get_response = GoogleDrivePipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "MSSharePoint".casefold(): + from .m_s_share_point_pipeline_get_response import MSSharePointPipelineGetResponse + + result.m_s_share_point_pipeline_get_response = MSSharePointPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "SDM".casefold(): + from .s_d_m_pipeline_get_response import SDMPipelineGetResponse + + result.s_d_m_pipeline_get_response = SDMPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "SFTP".casefold(): + from .s_f_t_p_pipeline_get_response import SFTPPipelineGetResponse + + result.s_f_t_p_pipeline_get_response = SFTPPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "S3".casefold(): + from .s3_pipeline_get_response import S3PipelineGetResponse + + result.s3_pipeline_get_response = S3PipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "ServiceNow".casefold(): + from .service_now_pipeline_get_response import ServiceNowPipelineGetResponse + + result.service_now_pipeline_get_response = ServiceNowPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "WorkZone".casefold(): + from .work_zone_pipeline_get_response import WorkZonePipelineGetResponse + + result.work_zone_pipeline_get_response = WorkZonePipelineGetResponse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse + from .m_s_share_point_pipeline_get_response import MSSharePointPipelineGetResponse + from .s3_pipeline_get_response import S3PipelineGetResponse + from .service_now_pipeline_get_response import ServiceNowPipelineGetResponse + from .s_d_m_pipeline_get_response import SDMPipelineGetResponse + from .s_f_t_p_pipeline_get_response import SFTPPipelineGetResponse + from .work_zone_pipeline_get_response import WorkZonePipelineGetResponse + + if self.google_drive_pipeline_get_response: + return self.google_drive_pipeline_get_response.get_field_deserializers() + if self.m_s_share_point_pipeline_get_response: + return self.m_s_share_point_pipeline_get_response.get_field_deserializers() + if self.s_d_m_pipeline_get_response: + return self.s_d_m_pipeline_get_response.get_field_deserializers() + if self.s_f_t_p_pipeline_get_response: + return self.s_f_t_p_pipeline_get_response.get_field_deserializers() + if self.s3_pipeline_get_response: + return self.s3_pipeline_get_response.get_field_deserializers() + if self.service_now_pipeline_get_response: + return self.service_now_pipeline_get_response.get_field_deserializers() + if self.work_zone_pipeline_get_response: + return self.work_zone_pipeline_get_response.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.google_drive_pipeline_get_response: + writer.write_object_value(None, self.google_drive_pipeline_get_response) + elif self.m_s_share_point_pipeline_get_response: + writer.write_object_value(None, self.m_s_share_point_pipeline_get_response) + elif self.s_d_m_pipeline_get_response: + writer.write_object_value(None, self.s_d_m_pipeline_get_response) + elif self.s_f_t_p_pipeline_get_response: + writer.write_object_value(None, self.s_f_t_p_pipeline_get_response) + elif self.s3_pipeline_get_response: + writer.write_object_value(None, self.s3_pipeline_get_response) + elif self.service_now_pipeline_get_response: + writer.write_object_value(None, self.service_now_pipeline_get_response) + elif self.work_zone_pipeline_get_response: + writer.write_object_value(None, self.work_zone_pipeline_get_response) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline400_error.py new file mode 100644 index 00000000..214f3fdd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class GetPipeline400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipeline400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipeline400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipeline400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_execution_by_id.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_execution_by_id.py new file mode 100644 index 00000000..1fd60407 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_execution_by_id.py @@ -0,0 +1,59 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class GetPipelineExecutionById(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The createdAt property + created_at: Optional[str] = None + # The id property + id: Optional[str] = None + # The modifiedAt property + modified_at: Optional[str] = None + # The status property + status: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipelineExecutionById: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipelineExecutionById + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipelineExecutionById() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "createdAt": lambda n : setattr(self, 'created_at', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "modifiedAt": lambda n : setattr(self, 'modified_at', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("createdAt", self.created_at) + writer.write_str_value("id", self.id) + writer.write_str_value("modifiedAt", self.modified_at) + writer.write_str_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_executions.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_executions.py new file mode 100644 index 00000000..88936f46 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_executions.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .pipeline_execution_data import PipelineExecutionData + +@dataclass +class GetPipelineExecutions(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[PipelineExecutionData]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipelineExecutions: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipelineExecutions + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipelineExecutions() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .pipeline_execution_data import PipelineExecutionData + + from .pipeline_execution_data import PipelineExecutionData + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(PipelineExecutionData)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_status.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_status.py new file mode 100644 index 00000000..5a0a6838 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_status.py @@ -0,0 +1,59 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class GetPipelineStatus(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The createdAt property + created_at: Optional[str] = None + # The lastCompletedAt property + last_completed_at: Optional[str] = None + # The lastStarted property + last_started: Optional[str] = None + # The status property + status: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipelineStatus: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipelineStatus + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipelineStatus() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "createdAt": lambda n : setattr(self, 'created_at', n.get_str_value()), + "lastCompletedAt": lambda n : setattr(self, 'last_completed_at', n.get_str_value()), + "lastStarted": lambda n : setattr(self, 'last_started', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("createdAt", self.created_at) + writer.write_str_value("lastCompletedAt", self.last_completed_at) + writer.write_str_value("lastStarted", self.last_started) + writer.write_str_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_status400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_status400_error.py new file mode 100644 index 00000000..072a14dc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipeline_status400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class GetPipelineStatus400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipelineStatus400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipelineStatus400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipelineStatus400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipelines.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipelines.py new file mode 100644 index 00000000..1e2ec567 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipelines.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .get_pipeline import GetPipeline + +@dataclass +class GetPipelines(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[GetPipeline]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipelines: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipelines + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipelines() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .get_pipeline import GetPipeline + + from .get_pipeline import GetPipeline + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(GetPipeline)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipelines400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipelines400_error.py new file mode 100644 index 00000000..ead16d2d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/get_pipelines400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class GetPipelines400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipelines400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipelines400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GetPipelines400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_config.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_config.py new file mode 100644 index 00000000..d93287e2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_config.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_config_resource_type import GoogleDriveConfig_resourceType + +@dataclass +class GoogleDriveConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + # The resourceId property + resource_id: Optional[str] = None + # The resourceType property + resource_type: Optional[GoogleDriveConfig_resourceType] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDriveConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDriveConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDriveConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_config_resource_type import GoogleDriveConfig_resourceType + + from .google_drive_config_resource_type import GoogleDriveConfig_resourceType + + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + "resourceId": lambda n : setattr(self, 'resource_id', n.get_str_value()), + "resourceType": lambda n : setattr(self, 'resource_type', n.get_enum_value(GoogleDriveConfig_resourceType)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_str_value("resourceId", self.resource_id) + writer.write_enum_value("resourceType", self.resource_type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_config_resource_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_config_resource_type.py new file mode 100644 index 00000000..79f799a6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_config_resource_type.py @@ -0,0 +1,6 @@ +from enum import Enum + +class GoogleDriveConfig_resourceType(str, Enum): + SHARED_FOLDER = "SHARED_FOLDER", + SHARED_DRIVE = "SHARED_DRIVE", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_configuration_minimal.py new file mode 100644 index 00000000..95f489ed --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_configuration_minimal.py @@ -0,0 +1,50 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_resource_detail import GoogleDriveResourceDetail + +@dataclass +class GoogleDriveConfigurationMinimal(Parsable): + # The googleDrive property + google_drive: Optional[GoogleDriveResourceDetail] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDriveConfigurationMinimal: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDriveConfigurationMinimal + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDriveConfigurationMinimal() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_resource_detail import GoogleDriveResourceDetail + + from .google_drive_resource_detail import GoogleDriveResourceDetail + + fields: dict[str, Callable[[Any], None]] = { + "googleDrive": lambda n : setattr(self, 'google_drive', n.get_object_value(GoogleDriveResourceDetail)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("googleDrive", self.google_drive) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_configuration_struct.py new file mode 100644 index 00000000..81d043d9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_configuration_struct.py @@ -0,0 +1,66 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_config import GoogleDriveConfig + +@dataclass +class GoogleDriveConfigurationStruct(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Optional cron expression for scheduling pipeline execution.Must represent an interval greater than 1 hour. + cron_expression: Optional[str] = None + # The destination property + destination: Optional[str] = None + # The googleDrive property + google_drive: Optional[GoogleDriveConfig] = None + # The metadataConfigId property + metadata_config_id: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDriveConfigurationStruct: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDriveConfigurationStruct + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDriveConfigurationStruct() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_config import GoogleDriveConfig + + from .google_drive_config import GoogleDriveConfig + + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "googleDrive": lambda n : setattr(self, 'google_drive', n.get_object_value(GoogleDriveConfig)), + "metadataConfigId": lambda n : setattr(self, 'metadata_config_id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_str_value("destination", self.destination) + writer.write_object_value("googleDrive", self.google_drive) + writer.write_str_value("metadataConfigId", self.metadata_config_id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_create_request.py new file mode 100644 index 00000000..7ca5e6e7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_create_request.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_configuration_struct import GoogleDriveConfigurationStruct + from .google_drive_pipeline_create_request_type import GoogleDrivePipelineCreateRequest_type + from .meta_data import MetaData + +@dataclass +class GoogleDrivePipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[GoogleDriveConfigurationStruct] = None + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[GoogleDrivePipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDrivePipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDrivePipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDrivePipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_configuration_struct import GoogleDriveConfigurationStruct + from .google_drive_pipeline_create_request_type import GoogleDrivePipelineCreateRequest_type + from .meta_data import MetaData + + from .google_drive_configuration_struct import GoogleDriveConfigurationStruct + from .google_drive_pipeline_create_request_type import GoogleDrivePipelineCreateRequest_type + from .meta_data import MetaData + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(GoogleDriveConfigurationStruct)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(GoogleDrivePipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_create_request_type.py new file mode 100644 index 00000000..4be1359a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class GoogleDrivePipelineCreateRequest_type(str, Enum): + GoogleDrive = "GoogleDrive", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_get_response.py new file mode 100644 index 00000000..e1ff3481 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_get_response.py @@ -0,0 +1,60 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + from .google_drive_configuration_minimal import GoogleDriveConfigurationMinimal + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class GoogleDrivePipelineGetResponse(BasePipelineResponse, Parsable): + # The configuration property + configuration: Optional[GoogleDriveConfigurationMinimal] = None + # The type property + type: Optional[GoogleDrivePipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDrivePipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDrivePipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDrivePipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + from .google_drive_configuration_minimal import GoogleDriveConfigurationMinimal + + from .base_pipeline_response import BasePipelineResponse + from .google_drive_configuration_minimal import GoogleDriveConfigurationMinimal + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(GoogleDriveConfigurationMinimal)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_get_response_type.py new file mode 100644 index 00000000..453c6a26 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class GoogleDrivePipelineGetResponse_type(str, Enum): + GoogleDrive = "GoogleDrive", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_minimal_response.py new file mode 100644 index 00000000..211aa0e6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_minimal_response.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .google_drive_configuration_minimal import GoogleDriveConfigurationMinimal + from .google_drive_pipeline_minimal_response_type import GoogleDrivePipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class GoogleDrivePipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The configuration property + configuration: Optional[GoogleDriveConfigurationMinimal] = None + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[GoogleDrivePipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDrivePipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDrivePipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDrivePipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .google_drive_configuration_minimal import GoogleDriveConfigurationMinimal + from .google_drive_pipeline_minimal_response_type import GoogleDrivePipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .google_drive_configuration_minimal import GoogleDriveConfigurationMinimal + from .google_drive_pipeline_minimal_response_type import GoogleDrivePipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(GoogleDriveConfigurationMinimal)), + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(GoogleDrivePipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_minimal_response_type.py new file mode 100644 index 00000000..f3e366d0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class GoogleDrivePipelineMinimalResponse_type(str, Enum): + GoogleDrive = "GoogleDrive", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_resource_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_resource_detail.py new file mode 100644 index 00000000..e75c9514 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_resource_detail.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_resource_detail_resource_type import GoogleDriveResourceDetail_resourceType + +@dataclass +class GoogleDriveResourceDetail(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + # The resourceId property + resource_id: Optional[str] = None + # The resourceType property + resource_type: Optional[GoogleDriveResourceDetail_resourceType] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GoogleDriveResourceDetail: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GoogleDriveResourceDetail + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return GoogleDriveResourceDetail() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_resource_detail_resource_type import GoogleDriveResourceDetail_resourceType + + from .google_drive_resource_detail_resource_type import GoogleDriveResourceDetail_resourceType + + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + "resourceId": lambda n : setattr(self, 'resource_id', n.get_str_value()), + "resourceType": lambda n : setattr(self, 'resource_type', n.get_enum_value(GoogleDriveResourceDetail_resourceType)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_str_value("resourceId", self.resource_id) + writer.write_enum_value("resourceType", self.resource_type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_resource_detail_resource_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_resource_detail_resource_type.py new file mode 100644 index 00000000..247dced1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/google_drive_resource_detail_resource_type.py @@ -0,0 +1,6 @@ +from enum import Enum + +class GoogleDriveResourceDetail_resourceType(str, Enum): + SHARED_FOLDER = "SHARED_FOLDER", + SHARED_DRIVE = "SHARED_DRIVE", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/key_word_retrieval_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/key_word_retrieval_scoring_configuration.py new file mode 100644 index 00000000..e9ce7ac0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/key_word_retrieval_scoring_configuration.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class KeyWordRetrievalScoringConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Enable dense retrieval. + enabled: Optional[bool] = True + # Extract Keywords from Query. + extract_key_words_from_query: Optional[bool] = False + # Contribution to final score. + weight: Optional[int] = 1 + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> KeyWordRetrievalScoringConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: KeyWordRetrievalScoringConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return KeyWordRetrievalScoringConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "enabled": lambda n : setattr(self, 'enabled', n.get_bool_value()), + "extractKeyWordsFromQuery": lambda n : setattr(self, 'extract_key_words_from_query', n.get_bool_value()), + "weight": lambda n : setattr(self, 'weight', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_bool_value("enabled", self.enabled) + writer.write_bool_value("extractKeyWordsFromQuery", self.extract_key_words_from_query) + writer.write_int_value("weight", self.weight) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_configuration_documents.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_configuration_documents.py new file mode 100644 index 00000000..cb29d9f0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_configuration_documents.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .configuration_document import ConfigurationDocument + +@dataclass +class ListConfigurationDocuments(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Total number of documents returned. + count: Optional[int] = None + # List of document objects. It will be empty array if no records found. + resources: Optional[list[ConfigurationDocument]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ListConfigurationDocuments: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ListConfigurationDocuments + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ListConfigurationDocuments() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .configuration_document import ConfigurationDocument + + from .configuration_document import ConfigurationDocument + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(ConfigurationDocument)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_metadata_configurations.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_metadata_configurations.py new file mode 100644 index 00000000..e702dd5e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_metadata_configurations.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_configuration_response import MetadataConfigurationResponse + +@dataclass +class ListMetadataConfigurations(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Total number of metadata configurations returned. + count: Optional[int] = None + # List of metadata configuration objects. It will be empty array if no records found. + resources: Optional[list[MetadataConfigurationResponse]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ListMetadataConfigurations: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ListMetadataConfigurations + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ListMetadataConfigurations() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_configuration_response import MetadataConfigurationResponse + + from .metadata_configuration_response import MetadataConfigurationResponse + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(MetadataConfigurationResponse)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_metadata_configurations400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_metadata_configurations400_error.py new file mode 100644 index 00000000..8bcd15bb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/list_metadata_configurations400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class ListMetadataConfigurations400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ListMetadataConfigurations400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ListMetadataConfigurations400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ListMetadataConfigurations400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration.py new file mode 100644 index 00000000..2a273657 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .share_point_config import SharePointConfig + +@dataclass +class MSSharePointConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The cronExpression property + cron_expression: Optional[str] = None + # The destination property + destination: Optional[str] = None + # The sharePoint property + share_point: Optional[SharePointConfig] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MSSharePointConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MSSharePointConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MSSharePointConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .share_point_config import SharePointConfig + + from .share_point_config import SharePointConfig + + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "sharePoint": lambda n : setattr(self, 'share_point', n.get_object_value(SharePointConfig)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_str_value("destination", self.destination) + writer.write_object_value("sharePoint", self.share_point) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration_get_response.py new file mode 100644 index 00000000..23e701bf --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration_get_response.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .share_point_config_get_response import SharePointConfigGetResponse + +@dataclass +class MSSharePointConfigurationGetResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The destination property + destination: Optional[str] = None + # The sharePoint property + share_point: Optional[SharePointConfigGetResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MSSharePointConfigurationGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MSSharePointConfigurationGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MSSharePointConfigurationGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .share_point_config_get_response import SharePointConfigGetResponse + + from .share_point_config_get_response import SharePointConfigGetResponse + + fields: dict[str, Callable[[Any], None]] = { + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "sharePoint": lambda n : setattr(self, 'share_point', n.get_object_value(SharePointConfigGetResponse)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("destination", self.destination) + writer.write_object_value("sharePoint", self.share_point) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration_minimal.py new file mode 100644 index 00000000..6ecc8830 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_configuration_minimal.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .share_point_site_detail import SharePointSiteDetail + +@dataclass +class MSSharePointConfigurationMinimal(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The sharePoint property + share_point: Optional[SharePointSiteDetail] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MSSharePointConfigurationMinimal: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MSSharePointConfigurationMinimal + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MSSharePointConfigurationMinimal() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .share_point_site_detail import SharePointSiteDetail + + from .share_point_site_detail import SharePointSiteDetail + + fields: dict[str, Callable[[Any], None]] = { + "sharePoint": lambda n : setattr(self, 'share_point', n.get_object_value(SharePointSiteDetail)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("sharePoint", self.share_point) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_create_request.py new file mode 100644 index 00000000..39298e21 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_create_request.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + from .m_s_share_point_configuration import MSSharePointConfiguration + from .m_s_share_point_pipeline_create_request_type import MSSharePointPipelineCreateRequest_type + +@dataclass +class MSSharePointPipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[MSSharePointConfiguration] = None + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[MSSharePointPipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MSSharePointPipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MSSharePointPipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MSSharePointPipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + from .m_s_share_point_configuration import MSSharePointConfiguration + from .m_s_share_point_pipeline_create_request_type import MSSharePointPipelineCreateRequest_type + + from .meta_data import MetaData + from .m_s_share_point_configuration import MSSharePointConfiguration + from .m_s_share_point_pipeline_create_request_type import MSSharePointPipelineCreateRequest_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(MSSharePointConfiguration)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(MSSharePointPipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_create_request_type.py new file mode 100644 index 00000000..114bf76e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class MSSharePointPipelineCreateRequest_type(str, Enum): + MSSharePoint = "MSSharePoint", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_get_response.py new file mode 100644 index 00000000..4f8f8f94 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_get_response.py @@ -0,0 +1,60 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + from .m_s_share_point_configuration_get_response import MSSharePointConfigurationGetResponse + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class MSSharePointPipelineGetResponse(BasePipelineResponse, Parsable): + # The configuration property + configuration: Optional[MSSharePointConfigurationGetResponse] = None + # The type property + type: Optional[MSSharePointPipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MSSharePointPipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MSSharePointPipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MSSharePointPipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + from .m_s_share_point_configuration_get_response import MSSharePointConfigurationGetResponse + + from .base_pipeline_response import BasePipelineResponse + from .m_s_share_point_configuration_get_response import MSSharePointConfigurationGetResponse + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(MSSharePointConfigurationGetResponse)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_get_response_type.py new file mode 100644 index 00000000..621c64e0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class MSSharePointPipelineGetResponse_type(str, Enum): + MSSharePoint = "MSSharePoint", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_minimal_response.py new file mode 100644 index 00000000..c17f7cb1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_minimal_response.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .m_s_share_point_configuration_minimal import MSSharePointConfigurationMinimal + from .m_s_share_point_pipeline_minimal_response_type import MSSharePointPipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class MSSharePointPipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The configuration property + configuration: Optional[MSSharePointConfigurationMinimal] = None + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[MSSharePointPipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MSSharePointPipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MSSharePointPipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MSSharePointPipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .m_s_share_point_configuration_minimal import MSSharePointConfigurationMinimal + from .m_s_share_point_pipeline_minimal_response_type import MSSharePointPipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .m_s_share_point_configuration_minimal import MSSharePointConfigurationMinimal + from .m_s_share_point_pipeline_minimal_response_type import MSSharePointPipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(MSSharePointConfigurationMinimal)), + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(MSSharePointPipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_minimal_response_type.py new file mode 100644 index 00000000..33f5dccb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/m_s_share_point_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class MSSharePointPipelineMinimalResponse_type(str, Enum): + MSSharePoint = "MSSharePoint", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/manual_pipeline_trigger.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/manual_pipeline_trigger.py new file mode 100644 index 00000000..4279fa9e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/manual_pipeline_trigger.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ManualPipelineTrigger(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The metadataOnly property + metadata_only: Optional[bool] = None + # The pipelineId property + pipeline_id: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ManualPipelineTrigger: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ManualPipelineTrigger + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ManualPipelineTrigger() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "metadataOnly": lambda n : setattr(self, 'metadata_only', n.get_bool_value()), + "pipelineId": lambda n : setattr(self, 'pipeline_id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_bool_value("metadataOnly", self.metadata_only) + writer.write_str_value("pipelineId", self.pipeline_id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker.py new file mode 100644 index 00000000..e2171a39 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker.py @@ -0,0 +1,77 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .merge_strategy_reranker_boosting import MergeStrategyReranker_boosting + from .merge_strategy_reranker_model import MergeStrategyReranker_model + from .merge_strategy_type import MergeStrategyType + +@dataclass +class MergeStrategyReranker(AdditionalDataHolder, Parsable): + """ + The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult instances. This strategy adds latency, but yields good results. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk. + include_all_meta_data: Optional[bool] = False + from .merge_strategy_reranker_model import MergeStrategyReranker_model + + # The RerankerModel to use. + model: Optional[MergeStrategyReranker_model] = MergeStrategyReranker_model("cohere-3.5") + # Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true. + boosting: Optional[list[MergeStrategyReranker_boosting]] = None + # The type property + type: Optional[MergeStrategyType] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MergeStrategyReranker: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MergeStrategyReranker + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MergeStrategyReranker() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .merge_strategy_reranker_boosting import MergeStrategyReranker_boosting + from .merge_strategy_reranker_model import MergeStrategyReranker_model + from .merge_strategy_type import MergeStrategyType + + from .merge_strategy_reranker_boosting import MergeStrategyReranker_boosting + from .merge_strategy_reranker_model import MergeStrategyReranker_model + from .merge_strategy_type import MergeStrategyType + + fields: dict[str, Callable[[Any], None]] = { + "boosting": lambda n : setattr(self, 'boosting', n.get_collection_of_object_values(MergeStrategyReranker_boosting)), + "includeAllMetaData": lambda n : setattr(self, 'include_all_meta_data', n.get_bool_value()), + "model": lambda n : setattr(self, 'model', n.get_enum_value(MergeStrategyReranker_model)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(MergeStrategyType)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("boosting", self.boosting) + writer.write_bool_value("includeAllMetaData", self.include_all_meta_data) + writer.write_enum_value("model", self.model) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker_boosting.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker_boosting.py new file mode 100644 index 00000000..913de6b1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker_boosting.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class MergeStrategyReranker_boosting(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + scope: Optional[list[str]] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MergeStrategyReranker_boosting: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MergeStrategyReranker_boosting + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MergeStrategyReranker_boosting() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "scope": lambda n : setattr(self, 'scope', n.get_collection_of_primitive_values(str)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("scope", self.scope) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker_model.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker_model.py new file mode 100644 index 00000000..9c419df1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_reranker_model.py @@ -0,0 +1,5 @@ +from enum import Enum + +class MergeStrategyReranker_model(str, Enum): + Cohere35 = "cohere-3.5", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_score_reuse.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_score_reuse.py new file mode 100644 index 00000000..c8c7af80 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_score_reuse.py @@ -0,0 +1,57 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .merge_strategy_type import MergeStrategyType + +@dataclass +class MergeStrategyScoreReuse(AdditionalDataHolder, Parsable): + """ + 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. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The type property + type: Optional[MergeStrategyType] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MergeStrategyScoreReuse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MergeStrategyScoreReuse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MergeStrategyScoreReuse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .merge_strategy_type import MergeStrategyType + + from .merge_strategy_type import MergeStrategyType + + fields: dict[str, Callable[[Any], None]] = { + "type": lambda n : setattr(self, 'type', n.get_enum_value(MergeStrategyType)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_type.py new file mode 100644 index 00000000..ba23d053 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/merge_strategy_type.py @@ -0,0 +1,8 @@ +from enum import Enum + +class MergeStrategyType(str, Enum): + Reranker = "reranker", + ScoreReuse = "scoreReuse", + ReciprocalRankFusion = "reciprocalRankFusion", + Random = "random", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data.py new file mode 100644 index 00000000..b41adb24 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data_data_repository_metadata import MetaData_dataRepositoryMetadata + +@dataclass +class MetaData(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The dataRepositoryMetadata property + data_repository_metadata: Optional[list[MetaData_dataRepositoryMetadata]] = None + # The destination property + destination: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetaData: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetaData + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetaData() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data_data_repository_metadata import MetaData_dataRepositoryMetadata + + from .meta_data_data_repository_metadata import MetaData_dataRepositoryMetadata + + fields: dict[str, Callable[[Any], None]] = { + "dataRepositoryMetadata": lambda n : setattr(self, 'data_repository_metadata', n.get_collection_of_object_values(MetaData_dataRepositoryMetadata)), + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("dataRepositoryMetadata", self.data_repository_metadata) + writer.write_str_value("destination", self.destination) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data_data_repository_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data_data_repository_metadata.py new file mode 100644 index 00000000..145cec19 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data_data_repository_metadata.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class MetaData_dataRepositoryMetadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetaData_dataRepositoryMetadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetaData_dataRepositoryMetadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetaData_dataRepositoryMetadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data_key_value_pair_strict.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data_key_value_pair_strict.py new file mode 100644 index 00000000..7360ae06 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/meta_data_key_value_pair_strict.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class MetaDataKeyValuePairStrict(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetaDataKeyValuePairStrict: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetaDataKeyValuePairStrict + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetaDataKeyValuePairStrict() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration.py new file mode 100644 index 00000000..9cfe6e2e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_configuration_metadata import MetadataConfiguration_metadata + from .metadata_configuration_struct import MetadataConfigurationStruct + from .metadata_configuration_type import MetadataConfiguration_type + +@dataclass +class MetadataConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[MetadataConfigurationStruct] = None + # The metadata property + metadata: Optional[MetadataConfiguration_metadata] = None + # The type property + type: Optional[MetadataConfiguration_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_configuration_metadata import MetadataConfiguration_metadata + from .metadata_configuration_struct import MetadataConfigurationStruct + from .metadata_configuration_type import MetadataConfiguration_type + + from .metadata_configuration_metadata import MetadataConfiguration_metadata + from .metadata_configuration_struct import MetadataConfigurationStruct + from .metadata_configuration_type import MetadataConfiguration_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(MetadataConfigurationStruct)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetadataConfiguration_metadata)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(MetadataConfiguration_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_metadata.py new file mode 100644 index 00000000..d5e56573 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_metadata.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict + +@dataclass +class MetadataConfiguration_metadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The dataRepositoryMetadata property + data_repository_metadata: Optional[list[MetaDataKeyValuePairStrict]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfiguration_metadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfiguration_metadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfiguration_metadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict + + from .meta_data_key_value_pair_strict import MetaDataKeyValuePairStrict + + fields: dict[str, Callable[[Any], None]] = { + "dataRepositoryMetadata": lambda n : setattr(self, 'data_repository_metadata', n.get_collection_of_object_values(MetaDataKeyValuePairStrict)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("dataRepositoryMetadata", self.data_repository_metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request.py new file mode 100644 index 00000000..a66a982e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request.py @@ -0,0 +1,77 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_configuration_request_data_repository_type import MetadataConfigurationRequest_dataRepositoryType + from .metadata_configuration_request_labels import MetadataConfigurationRequest_labels + +@dataclass +class MetadataConfigurationRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The data repository type for which this configuration is being created. + data_repository_type: Optional[MetadataConfigurationRequest_dataRepositoryType] = None + # Contains destination name containing credentials to access the data repository. + destination_name: Optional[str] = None + # If provided, must be a valid UUID. If not provided, a new UUID will be generated. + id: Optional[str] = None + # The includePaths property + include_paths: Optional[list[str]] = None + # The labels property + labels: Optional[list[MetadataConfigurationRequest_labels]] = None + # If provided, must be a valid string. If not provided, will be same as id. + name: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfigurationRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfigurationRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfigurationRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_configuration_request_data_repository_type import MetadataConfigurationRequest_dataRepositoryType + from .metadata_configuration_request_labels import MetadataConfigurationRequest_labels + + from .metadata_configuration_request_data_repository_type import MetadataConfigurationRequest_dataRepositoryType + from .metadata_configuration_request_labels import MetadataConfigurationRequest_labels + + fields: dict[str, Callable[[Any], None]] = { + "dataRepositoryType": lambda n : setattr(self, 'data_repository_type', n.get_enum_value(MetadataConfigurationRequest_dataRepositoryType)), + "destinationName": lambda n : setattr(self, 'destination_name', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + "labels": lambda n : setattr(self, 'labels', n.get_collection_of_object_values(MetadataConfigurationRequest_labels)), + "name": lambda n : setattr(self, 'name', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_enum_value("dataRepositoryType", self.data_repository_type) + writer.write_str_value("destinationName", self.destination_name) + writer.write_str_value("id", self.id) + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_collection_of_object_values("labels", self.labels) + writer.write_str_value("name", self.name) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request_data_repository_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request_data_repository_type.py new file mode 100644 index 00000000..3837753e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request_data_repository_type.py @@ -0,0 +1,7 @@ +from enum import Enum + +class MetadataConfigurationRequest_dataRepositoryType(str, Enum): + MSSharePoint = "MSSharePoint", + S3 = "S3", + SFTP = "SFTP", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request_labels.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request_labels.py new file mode 100644 index 00000000..ad9c1043 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_request_labels.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class MetadataConfigurationRequest_labels(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfigurationRequest_labels: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfigurationRequest_labels + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfigurationRequest_labels() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_str_value("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response.py new file mode 100644 index 00000000..1045b241 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_configuration_request import MetadataConfigurationRequest + from .metadata_configuration_response_enumeration_status import MetadataConfigurationResponse_enumerationStatus + +from .metadata_configuration_request import MetadataConfigurationRequest + +@dataclass +class MetadataConfigurationResponse(MetadataConfigurationRequest, Parsable): + # Status of metadata enumeration for the configuration. + enumeration_status: Optional[MetadataConfigurationResponse_enumerationStatus] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfigurationResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfigurationResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfigurationResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_configuration_request import MetadataConfigurationRequest + from .metadata_configuration_response_enumeration_status import MetadataConfigurationResponse_enumerationStatus + + from .metadata_configuration_request import MetadataConfigurationRequest + from .metadata_configuration_response_enumeration_status import MetadataConfigurationResponse_enumerationStatus + + fields: dict[str, Callable[[Any], None]] = { + "enumerationStatus": lambda n : setattr(self, 'enumeration_status', n.get_enum_value(MetadataConfigurationResponse_enumerationStatus)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_enum_value("enumerationStatus", self.enumeration_status) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response400_error.py new file mode 100644 index 00000000..c82648b1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class MetadataConfigurationResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfigurationResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfigurationResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfigurationResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response_enumeration_status.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response_enumeration_status.py new file mode 100644 index 00000000..486a0dfd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_response_enumeration_status.py @@ -0,0 +1,8 @@ +from enum import Enum + +class MetadataConfigurationResponse_enumerationStatus(str, Enum): + NEW = "NEW", + IN_PROGRESS = "IN_PROGRESS", + COMPLETED = "COMPLETED", + ERROR = "ERROR", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_struct.py new file mode 100644 index 00000000..9d76c4b0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_struct.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class MetadataConfigurationStruct(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Optional cron expression for scheduling pipeline execution.Must represent an interval greater than 1 hour. + cron_expression: Optional[str] = None + # The metadataConfigId property + metadata_config_id: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataConfigurationStruct: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataConfigurationStruct + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataConfigurationStruct() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + "metadataConfigId": lambda n : setattr(self, 'metadata_config_id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_str_value("metadataConfigId", self.metadata_config_id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_type.py new file mode 100644 index 00000000..acca08e2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_configuration_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class MetadataConfiguration_type(str, Enum): + Metadata = "metadata", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_item.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_item.py new file mode 100644 index 00000000..5c0abd83 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_item.py @@ -0,0 +1,59 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class MetadataItem(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # ID of collection + id: Optional[UUID] = None + # List of metadata of the collections or documents or chunks + metadata: Optional[list[VectorKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataItem: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataItem + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataItem() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_key_update.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_key_update.py new file mode 100644 index 00000000..61ecb31d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_key_update.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_operation import MetadataOperation + +@dataclass +class MetadataKeyUpdate(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Key to update + key: Optional[str] = None + # Update operation executed for the key + operations: Optional[list[MetadataOperation]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataKeyUpdate: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataKeyUpdate + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataKeyUpdate() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_operation import MetadataOperation + + from .metadata_operation import MetadataOperation + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "operations": lambda n : setattr(self, 'operations', n.get_collection_of_object_values(MetadataOperation)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_object_values("operations", self.operations) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_operation.py new file mode 100644 index 00000000..4c95c9f3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_operation.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_operation_enum import MetadataOperationEnum + +@dataclass +class MetadataOperation(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The op property + op: Optional[MetadataOperationEnum] = None + # List of values to update. + values: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataOperation: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataOperation + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataOperation() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_operation_enum import MetadataOperationEnum + + from .metadata_operation_enum import MetadataOperationEnum + + fields: dict[str, Callable[[Any], None]] = { + "op": lambda n : setattr(self, 'op', n.get_enum_value(MetadataOperationEnum)), + "values": lambda n : setattr(self, 'values', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_enum_value("op", self.op) + writer.write_collection_of_primitive_values("values", self.values) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_operation_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_operation_enum.py new file mode 100644 index 00000000..d7cd9581 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_operation_enum.py @@ -0,0 +1,8 @@ +from enum import Enum + +class MetadataOperationEnum(str, Enum): + Add = "add", + Remove = "remove", + Replace = "replace", + Delete_key = "delete_key", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response.py new file mode 100644 index 00000000..d0b26a74 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_item import MetadataItem + +@dataclass +class MetadataResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of metadata after updates. + current_metadata: Optional[list[MetadataItem]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_item import MetadataItem + + from .metadata_item import MetadataItem + + fields: dict[str, Callable[[Any], None]] = { + "current_metadata": lambda n : setattr(self, 'current_metadata', n.get_collection_of_object_values(MetadataItem)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("current_metadata", self.current_metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response400_error.py new file mode 100644 index 00000000..7838f242 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class MetadataResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response404_error.py new file mode 100644 index 00000000..b849d04e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class MetadataResponse404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataResponse404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataResponse404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataResponse404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response422_error.py new file mode 100644 index 00000000..d6fd22b4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_response422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class MetadataResponse422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataResponse422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataResponse422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataResponse422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_update_item.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_update_item.py new file mode 100644 index 00000000..1de23e11 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_update_item.py @@ -0,0 +1,59 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .metadata_key_update import MetadataKeyUpdate + +@dataclass +class MetadataUpdateItem(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of collection or document or chunk ids for which the metadata should be updated + ids: Optional[list[UUID]] = None + # List of metadata updates for the given resource ids + metadata_updates: Optional[list[MetadataKeyUpdate]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataUpdateItem: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataUpdateItem + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataUpdateItem() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_key_update import MetadataKeyUpdate + + from .metadata_key_update import MetadataKeyUpdate + + fields: dict[str, Callable[[Any], None]] = { + "ids": lambda n : setattr(self, 'ids', n.get_collection_of_primitive_values(UUID)), + "metadataUpdates": lambda n : setattr(self, 'metadata_updates', n.get_collection_of_object_values(MetadataKeyUpdate)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("ids", self.ids) + writer.write_collection_of_object_values("metadataUpdates", self.metadata_updates) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_updates.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_updates.py new file mode 100644 index 00000000..a72a214a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/metadata_updates.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata_update_item import MetadataUpdateItem + +@dataclass +class MetadataUpdates(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of metadata updates. + updates: Optional[list[MetadataUpdateItem]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> MetadataUpdates: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: MetadataUpdates + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return MetadataUpdates() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .metadata_update_item import MetadataUpdateItem + + from .metadata_update_item import MetadataUpdateItem + + fields: dict[str, Callable[[Any], None]] = { + "updates": lambda n : setattr(self, 'updates', n.get_collection_of_object_values(MetadataUpdateItem)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("updates", self.updates) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline.py new file mode 100644 index 00000000..5fe4e94e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .patch_pipeline_configuration import PatchPipeline_configuration + from .patch_pipeline_metadata import PatchPipeline_metadata + +@dataclass +class PatchPipeline(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[PatchPipeline_configuration] = None + # The metadata property + metadata: Optional[PatchPipeline_metadata] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PatchPipeline: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PatchPipeline + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PatchPipeline() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .patch_pipeline_configuration import PatchPipeline_configuration + from .patch_pipeline_metadata import PatchPipeline_metadata + + from .patch_pipeline_configuration import PatchPipeline_configuration + from .patch_pipeline_metadata import PatchPipeline_metadata + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(PatchPipeline_configuration)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(PatchPipeline_metadata)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_configuration.py new file mode 100644 index 00000000..7d6ac8b3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_configuration.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PatchPipeline_configuration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The cronExpression property + cron_expression: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PatchPipeline_configuration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PatchPipeline_configuration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PatchPipeline_configuration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_metadata.py new file mode 100644 index 00000000..71f08fe6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_metadata.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .patch_pipeline_metadata_data_repository_metadata import PatchPipeline_metadata_dataRepositoryMetadata + +@dataclass +class PatchPipeline_metadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Patch for metadata happens at key level. Value for the specific key would be inserted/replaced. + data_repository_metadata: Optional[list[PatchPipeline_metadata_dataRepositoryMetadata]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PatchPipeline_metadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PatchPipeline_metadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PatchPipeline_metadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .patch_pipeline_metadata_data_repository_metadata import PatchPipeline_metadata_dataRepositoryMetadata + + from .patch_pipeline_metadata_data_repository_metadata import PatchPipeline_metadata_dataRepositoryMetadata + + fields: dict[str, Callable[[Any], None]] = { + "dataRepositoryMetadata": lambda n : setattr(self, 'data_repository_metadata', n.get_collection_of_object_values(PatchPipeline_metadata_dataRepositoryMetadata)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("dataRepositoryMetadata", self.data_repository_metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_metadata_data_repository_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_metadata_data_repository_metadata.py new file mode 100644 index 00000000..0cfa19ed --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/patch_pipeline_metadata_data_repository_metadata.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PatchPipeline_metadata_dataRepositoryMetadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PatchPipeline_metadata_dataRepositoryMetadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PatchPipeline_metadata_dataRepositoryMetadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PatchPipeline_metadata_dataRepositoryMetadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_document_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_document_response.py new file mode 100644 index 00000000..9eac98a0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_document_response.py @@ -0,0 +1,79 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PipelineDocumentResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The absoluteUrl property + absolute_url: Optional[str] = None + # The createdTimestamp property + created_timestamp: Optional[str] = None + # The downloadLocation property + download_location: Optional[str] = None + # The id property + id: Optional[str] = None + # The lastUpdatedTimestamp property + last_updated_timestamp: Optional[str] = None + # The metadataId property + metadata_id: Optional[str] = None + # The status property + status: Optional[str] = None + # The title property + title: Optional[str] = None + # The viewLocation property + view_location: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PipelineDocumentResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PipelineDocumentResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PipelineDocumentResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "absoluteUrl": lambda n : setattr(self, 'absolute_url', n.get_str_value()), + "createdTimestamp": lambda n : setattr(self, 'created_timestamp', n.get_str_value()), + "downloadLocation": lambda n : setattr(self, 'download_location', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "lastUpdatedTimestamp": lambda n : setattr(self, 'last_updated_timestamp', n.get_str_value()), + "metadataId": lambda n : setattr(self, 'metadata_id', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + "title": lambda n : setattr(self, 'title', n.get_str_value()), + "viewLocation": lambda n : setattr(self, 'view_location', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("absoluteUrl", self.absolute_url) + writer.write_str_value("createdTimestamp", self.created_timestamp) + writer.write_str_value("downloadLocation", self.download_location) + writer.write_str_value("id", self.id) + writer.write_str_value("lastUpdatedTimestamp", self.last_updated_timestamp) + writer.write_str_value("metadataId", self.metadata_id) + writer.write_str_value("status", self.status) + writer.write_str_value("title", self.title) + writer.write_str_value("viewLocation", self.view_location) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_execution_data.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_execution_data.py new file mode 100644 index 00000000..31bd53c4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_execution_data.py @@ -0,0 +1,59 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PipelineExecutionData(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The createdAt property + created_at: Optional[str] = None + # The id property + id: Optional[str] = None + # The modifiedAt property + modified_at: Optional[str] = None + # The status property + status: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PipelineExecutionData: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PipelineExecutionData + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PipelineExecutionData() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "createdAt": lambda n : setattr(self, 'created_at', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "modifiedAt": lambda n : setattr(self, 'modified_at', n.get_str_value()), + "status": lambda n : setattr(self, 'status', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("createdAt", self.created_at) + writer.write_str_value("id", self.id) + writer.write_str_value("modifiedAt", self.modified_at) + writer.write_str_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_id.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_id.py new file mode 100644 index 00000000..23b31072 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_id.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PipelineId(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The pipelineId property + pipeline_id: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PipelineId: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PipelineId + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PipelineId() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "pipelineId": lambda n : setattr(self, 'pipeline_id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("pipelineId", self.pipeline_id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_id400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_id400_error.py new file mode 100644 index 00000000..bfdfb59b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_id400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class PipelineId400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PipelineId400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PipelineId400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PipelineId400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_minimal_response.py new file mode 100644 index 00000000..c923a48e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/pipeline_minimal_response.py @@ -0,0 +1,133 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse + from .m_s_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse + from .s3_pipeline_minimal_response import S3PipelineMinimalResponse + from .service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse + from .s_d_m_pipeline_minimal_response import SDMPipelineMinimalResponse + from .s_f_t_p_pipeline_minimal_response import SFTPPipelineMinimalResponse + from .work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse + +@dataclass +class PipelineMinimalResponse(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes GoogleDrivePipelineMinimalResponse, MSSharePointPipelineMinimalResponse, S3PipelineMinimalResponse, SDMPipelineMinimalResponse, ServiceNowPipelineMinimalResponse, SFTPPipelineMinimalResponse, WorkZonePipelineMinimalResponse + """ + # Composed type representation for type GoogleDrivePipelineMinimalResponse + google_drive_pipeline_minimal_response: Optional[GoogleDrivePipelineMinimalResponse] = None + # Composed type representation for type MSSharePointPipelineMinimalResponse + m_s_share_point_pipeline_minimal_response: Optional[MSSharePointPipelineMinimalResponse] = None + # Composed type representation for type SDMPipelineMinimalResponse + s_d_m_pipeline_minimal_response: Optional[SDMPipelineMinimalResponse] = None + # Composed type representation for type SFTPPipelineMinimalResponse + s_f_t_p_pipeline_minimal_response: Optional[SFTPPipelineMinimalResponse] = None + # Composed type representation for type S3PipelineMinimalResponse + s3_pipeline_minimal_response: Optional[S3PipelineMinimalResponse] = None + # Composed type representation for type ServiceNowPipelineMinimalResponse + service_now_pipeline_minimal_response: Optional[ServiceNowPipelineMinimalResponse] = None + # Composed type representation for type WorkZonePipelineMinimalResponse + work_zone_pipeline_minimal_response: Optional[WorkZonePipelineMinimalResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("type") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = PipelineMinimalResponse() + if mapping_value and mapping_value.casefold() == "GoogleDrive".casefold(): + from .google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse + + result.google_drive_pipeline_minimal_response = GoogleDrivePipelineMinimalResponse() + elif mapping_value and mapping_value.casefold() == "MSSharePoint".casefold(): + from .m_s_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse + + result.m_s_share_point_pipeline_minimal_response = MSSharePointPipelineMinimalResponse() + elif mapping_value and mapping_value.casefold() == "SDM".casefold(): + from .s_d_m_pipeline_minimal_response import SDMPipelineMinimalResponse + + result.s_d_m_pipeline_minimal_response = SDMPipelineMinimalResponse() + elif mapping_value and mapping_value.casefold() == "SFTP".casefold(): + from .s_f_t_p_pipeline_minimal_response import SFTPPipelineMinimalResponse + + result.s_f_t_p_pipeline_minimal_response = SFTPPipelineMinimalResponse() + elif mapping_value and mapping_value.casefold() == "S3".casefold(): + from .s3_pipeline_minimal_response import S3PipelineMinimalResponse + + result.s3_pipeline_minimal_response = S3PipelineMinimalResponse() + elif mapping_value and mapping_value.casefold() == "ServiceNow".casefold(): + from .service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse + + result.service_now_pipeline_minimal_response = ServiceNowPipelineMinimalResponse() + elif mapping_value and mapping_value.casefold() == "WorkZone".casefold(): + from .work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse + + result.work_zone_pipeline_minimal_response = WorkZonePipelineMinimalResponse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .google_drive_pipeline_minimal_response import GoogleDrivePipelineMinimalResponse + from .m_s_share_point_pipeline_minimal_response import MSSharePointPipelineMinimalResponse + from .s3_pipeline_minimal_response import S3PipelineMinimalResponse + from .service_now_pipeline_minimal_response import ServiceNowPipelineMinimalResponse + from .s_d_m_pipeline_minimal_response import SDMPipelineMinimalResponse + from .s_f_t_p_pipeline_minimal_response import SFTPPipelineMinimalResponse + from .work_zone_pipeline_minimal_response import WorkZonePipelineMinimalResponse + + if self.google_drive_pipeline_minimal_response: + return self.google_drive_pipeline_minimal_response.get_field_deserializers() + if self.m_s_share_point_pipeline_minimal_response: + return self.m_s_share_point_pipeline_minimal_response.get_field_deserializers() + if self.s_d_m_pipeline_minimal_response: + return self.s_d_m_pipeline_minimal_response.get_field_deserializers() + if self.s_f_t_p_pipeline_minimal_response: + return self.s_f_t_p_pipeline_minimal_response.get_field_deserializers() + if self.s3_pipeline_minimal_response: + return self.s3_pipeline_minimal_response.get_field_deserializers() + if self.service_now_pipeline_minimal_response: + return self.service_now_pipeline_minimal_response.get_field_deserializers() + if self.work_zone_pipeline_minimal_response: + return self.work_zone_pipeline_minimal_response.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.google_drive_pipeline_minimal_response: + writer.write_object_value(None, self.google_drive_pipeline_minimal_response) + elif self.m_s_share_point_pipeline_minimal_response: + writer.write_object_value(None, self.m_s_share_point_pipeline_minimal_response) + elif self.s_d_m_pipeline_minimal_response: + writer.write_object_value(None, self.s_d_m_pipeline_minimal_response) + elif self.s_f_t_p_pipeline_minimal_response: + writer.write_object_value(None, self.s_f_t_p_pipeline_minimal_response) + elif self.s3_pipeline_minimal_response: + writer.write_object_value(None, self.s3_pipeline_minimal_response) + elif self.service_now_pipeline_minimal_response: + writer.write_object_value(None, self.service_now_pipeline_minimal_response) + elif self.work_zone_pipeline_minimal_response: + writer.write_object_value(None, self.work_zone_pipeline_minimal_response) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_object_reference.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_object_reference.py new file mode 100644 index 00000000..8657db8b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_object_reference.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PostProcessingObjectReference(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # PerFilterSearchResult ID or PostProcessingOperation ID. + id: Optional[str] = "6d3eeafd-f3db-4e8e-949a-0e40e50eab64" + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PostProcessingObjectReference: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PostProcessingObjectReference + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PostProcessingObjectReference() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation.py new file mode 100644 index 00000000..1f4e10dc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .post_processing_operation_inputs import PostProcessingOperation_inputs + from .post_processing_operation_strategy import PostProcessingOperation_strategy + +@dataclass +class PostProcessingOperation(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # New ID for each PostProcessingOperation. + id: Optional[str] = "ae9eee48-4671-4321-a3e5-640adaaf26ae" + # Maximum number of chunks to be retained in final PerSearchFilterResult. + max_chunk_count: Optional[int] = 5 + # The inputs property + inputs: Optional[list[PostProcessingOperation_inputs]] = None + # Merging and scoring strategy to derive final PerSearchFilterResult. + strategy: Optional[PostProcessingOperation_strategy] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PostProcessingOperation: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PostProcessingOperation + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PostProcessingOperation() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .post_processing_operation_inputs import PostProcessingOperation_inputs + from .post_processing_operation_strategy import PostProcessingOperation_strategy + + from .post_processing_operation_inputs import PostProcessingOperation_inputs + from .post_processing_operation_strategy import PostProcessingOperation_strategy + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "inputs": lambda n : setattr(self, 'inputs', n.get_collection_of_object_values(PostProcessingOperation_inputs)), + "maxChunkCount": lambda n : setattr(self, 'max_chunk_count', n.get_int_value()), + "strategy": lambda n : setattr(self, 'strategy', n.get_object_value(PostProcessingOperation_strategy)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_collection_of_object_values("inputs", self.inputs) + writer.write_int_value("maxChunkCount", self.max_chunk_count) + writer.write_object_value("strategy", self.strategy) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation_inputs.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation_inputs.py new file mode 100644 index 00000000..dbf2ae4a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation_inputs.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .post_processing_object_reference import PostProcessingObjectReference + from .post_processing_operation import PostProcessingOperation + +@dataclass +class PostProcessingOperation_inputs(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes PostProcessingObjectReference, PostProcessingOperation + """ + # Composed type representation for type PostProcessingObjectReference + post_processing_object_reference: Optional[PostProcessingObjectReference] = None + # Composed type representation for type PostProcessingOperation + post_processing_operation: Optional[PostProcessingOperation] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PostProcessingOperation_inputs: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PostProcessingOperation_inputs + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = PostProcessingOperation_inputs() + if mapping_value and mapping_value.casefold() == "PostProcessingObjectReference".casefold(): + from .post_processing_object_reference import PostProcessingObjectReference + + result.post_processing_object_reference = PostProcessingObjectReference() + elif mapping_value and mapping_value.casefold() == "PostProcessingOperation".casefold(): + from .post_processing_operation import PostProcessingOperation + + result.post_processing_operation = PostProcessingOperation() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .post_processing_object_reference import PostProcessingObjectReference + from .post_processing_operation import PostProcessingOperation + + if self.post_processing_object_reference: + return self.post_processing_object_reference.get_field_deserializers() + if self.post_processing_operation: + return self.post_processing_operation.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.post_processing_object_reference: + writer.write_object_value(None, self.post_processing_object_reference) + elif self.post_processing_operation: + writer.write_object_value(None, self.post_processing_operation) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation_strategy.py new file mode 100644 index 00000000..0a7b74f1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/post_processing_operation_strategy.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .merge_strategy_reranker import MergeStrategyReranker + from .merge_strategy_score_reuse import MergeStrategyScoreReuse + +@dataclass +class PostProcessingOperation_strategy(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes MergeStrategyReranker, MergeStrategyScoreReuse + """ + # Composed type representation for type MergeStrategyReranker + merge_strategy_reranker: Optional[MergeStrategyReranker] = None + # Composed type representation for type MergeStrategyScoreReuse + merge_strategy_score_reuse: Optional[MergeStrategyScoreReuse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PostProcessingOperation_strategy: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PostProcessingOperation_strategy + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = PostProcessingOperation_strategy() + if mapping_value and mapping_value.casefold() == "MergeStrategyReranker".casefold(): + from .merge_strategy_reranker import MergeStrategyReranker + + result.merge_strategy_reranker = MergeStrategyReranker() + elif mapping_value and mapping_value.casefold() == "MergeStrategyScoreReuse".casefold(): + from .merge_strategy_score_reuse import MergeStrategyScoreReuse + + result.merge_strategy_score_reuse = MergeStrategyScoreReuse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .merge_strategy_reranker import MergeStrategyReranker + from .merge_strategy_score_reuse import MergeStrategyScoreReuse + + if self.merge_strategy_reranker: + return self.merge_strategy_reranker.get_field_deserializers() + if self.merge_strategy_score_reuse: + return self.merge_strategy_score_reuse.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.merge_strategy_reranker: + writer.write_object_value(None, self.merge_strategy_reranker) + elif self.merge_strategy_score_reuse: + writer.write_object_value(None, self.merge_strategy_score_reuse) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter.py new file mode 100644 index 00000000..85808aec --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_binary_boolean_filter_left import RetrievalBinaryBooleanFilter_left + from .retrieval_binary_boolean_filter_operator import RetrievalBinaryBooleanFilter_operator + from .retrieval_binary_boolean_filter_right import RetrievalBinaryBooleanFilter_right + +@dataclass +class RetrievalBinaryBooleanFilter(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The left property + left: Optional[RetrievalBinaryBooleanFilter_left] = None + # The operator property + operator: Optional[RetrievalBinaryBooleanFilter_operator] = None + # The right property + right: Optional[RetrievalBinaryBooleanFilter_right] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalBinaryBooleanFilter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalBinaryBooleanFilter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalBinaryBooleanFilter() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_binary_boolean_filter_left import RetrievalBinaryBooleanFilter_left + from .retrieval_binary_boolean_filter_operator import RetrievalBinaryBooleanFilter_operator + from .retrieval_binary_boolean_filter_right import RetrievalBinaryBooleanFilter_right + + from .retrieval_binary_boolean_filter_left import RetrievalBinaryBooleanFilter_left + from .retrieval_binary_boolean_filter_operator import RetrievalBinaryBooleanFilter_operator + from .retrieval_binary_boolean_filter_right import RetrievalBinaryBooleanFilter_right + + fields: dict[str, Callable[[Any], None]] = { + "left": lambda n : setattr(self, 'left', n.get_object_value(RetrievalBinaryBooleanFilter_left)), + "operator": lambda n : setattr(self, 'operator', n.get_enum_value(RetrievalBinaryBooleanFilter_operator)), + "right": lambda n : setattr(self, 'right', n.get_object_value(RetrievalBinaryBooleanFilter_right)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("left", self.left) + writer.write_enum_value("operator", self.operator) + writer.write_object_value("right", self.right) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_left.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_left.py new file mode 100644 index 00000000..833ea8b1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_left.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + +@dataclass +class RetrievalBinaryBooleanFilter_left(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair + """ + # Composed type representation for type RetrievalBinaryBooleanFilter + retrieval_binary_boolean_filter: Optional[RetrievalBinaryBooleanFilter] = None + # Composed type representation for type RetrievalScopedKeyValueListPair + retrieval_scoped_key_value_list_pair: Optional[RetrievalScopedKeyValueListPair] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalBinaryBooleanFilter_left: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalBinaryBooleanFilter_left + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = RetrievalBinaryBooleanFilter_left() + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + + result.retrieval_binary_boolean_filter = RetrievalBinaryBooleanFilter() + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + + result.retrieval_scoped_key_value_list_pair = RetrievalScopedKeyValueListPair() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + + if self.retrieval_binary_boolean_filter or self.retrieval_scoped_key_value_list_pair: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.retrieval_binary_boolean_filter, self.retrieval_scoped_key_value_list_pair) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.retrieval_binary_boolean_filter, self.retrieval_scoped_key_value_list_pair) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_operator.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_operator.py new file mode 100644 index 00000000..055c47b5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_operator.py @@ -0,0 +1,6 @@ +from enum import Enum + +class RetrievalBinaryBooleanFilter_operator(str, Enum): + And_ = "and", + Or_ = "or", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_right.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_right.py new file mode 100644 index 00000000..60afeeaf --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_binary_boolean_filter_right.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + +@dataclass +class RetrievalBinaryBooleanFilter_right(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair + """ + # Composed type representation for type RetrievalBinaryBooleanFilter + retrieval_binary_boolean_filter: Optional[RetrievalBinaryBooleanFilter] = None + # Composed type representation for type RetrievalScopedKeyValueListPair + retrieval_scoped_key_value_list_pair: Optional[RetrievalScopedKeyValueListPair] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalBinaryBooleanFilter_right: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalBinaryBooleanFilter_right + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = RetrievalBinaryBooleanFilter_right() + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + + result.retrieval_binary_boolean_filter = RetrievalBinaryBooleanFilter() + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + + result.retrieval_scoped_key_value_list_pair = RetrievalScopedKeyValueListPair() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + + if self.retrieval_binary_boolean_filter or self.retrieval_scoped_key_value_list_pair: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.retrieval_binary_boolean_filter, self.retrieval_scoped_key_value_list_pair) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.retrieval_binary_boolean_filter, self.retrieval_scoped_key_value_list_pair) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_chunk.py new file mode 100644 index 00000000..5caa0885 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_chunk.py @@ -0,0 +1,76 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .score import Score + from .search_scores import SearchScores + +@dataclass +class RetrievalChunk(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The content property + content: Optional[str] = None + # The id property + id: Optional[str] = None + # The metadata property + metadata: Optional[list[RetrievalKeyValueListPair]] = None + # The postProcessingScore property + post_processing_score: Optional[Score] = None + # The searchScores property + search_scores: Optional[SearchScores] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalChunk: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalChunk + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalChunk() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .score import Score + from .search_scores import SearchScores + + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .score import Score + from .search_scores import SearchScores + + fields: dict[str, Callable[[Any], None]] = { + "content": lambda n : setattr(self, 'content', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "postProcessingScore": lambda n : setattr(self, 'post_processing_score', n.get_object_value(Score)), + "searchScores": lambda n : setattr(self, 'search_scores', n.get_object_value(SearchScores)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("content", self.content) + writer.write_str_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_object_value("postProcessingScore", self.post_processing_score) + writer.write_object_value("searchScores", self.search_scores) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_data_repository_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_data_repository_search_result.py new file mode 100644 index 00000000..884cb0a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_data_repository_search_result.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .data_repository_with_documents import DataRepositoryWithDocuments + +@dataclass +class RetrievalDataRepositorySearchResult(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # DataRepository schema returned by the Vector search endpoint + data_repository: Optional[DataRepositoryWithDocuments] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalDataRepositorySearchResult: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalDataRepositorySearchResult + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalDataRepositorySearchResult() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .data_repository_with_documents import DataRepositoryWithDocuments + + from .data_repository_with_documents import DataRepositoryWithDocuments + + fields: dict[str, Callable[[Any], None]] = { + "dataRepository": lambda n : setattr(self, 'data_repository', n.get_object_value(DataRepositoryWithDocuments)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("dataRepository", self.data_repository) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_document_key_value_list_pair.py new file mode 100644 index 00000000..8383cbe6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_document_key_value_list_pair.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .filter_match_mode_enum import FilterMatchModeEnum + +@dataclass +class RetrievalDocumentKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The matchMode property + match_mode: Optional[FilterMatchModeEnum] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalDocumentKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalDocumentKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalDocumentKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .filter_match_mode_enum import FilterMatchModeEnum + + from .filter_match_mode_enum import FilterMatchModeEnum + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "matchMode": lambda n : setattr(self, 'match_mode', n.get_enum_value(FilterMatchModeEnum)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_enum_value("matchMode", self.match_mode) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_key_value_list_pair.py new file mode 100644 index 00000000..8cd5345d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_key_value_list_pair.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class RetrievalKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result.py new file mode 100644 index 00000000..cc0e6a88 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult + +@dataclass +class RetrievalPerFilterSearchResult(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The filterId property + filter_id: Optional[str] = None + # Friendly Destination Name of remote instance (grounding.name). Only present if dataRepositoryType = remote:dg. + remote_grounding_name: Optional[str] = None + # List of returned results. + results: Optional[list[RetrievalDataRepositorySearchResult]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalPerFilterSearchResult: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalPerFilterSearchResult + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalPerFilterSearchResult() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult + + from .retrieval_data_repository_search_result import RetrievalDataRepositorySearchResult + + fields: dict[str, Callable[[Any], None]] = { + "filterId": lambda n : setattr(self, 'filter_id', n.get_str_value()), + "remoteGroundingName": lambda n : setattr(self, 'remote_grounding_name', n.get_str_value()), + "results": lambda n : setattr(self, 'results', n.get_collection_of_object_values(RetrievalDataRepositorySearchResult)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("filterId", self.filter_id) + writer.write_str_value("remoteGroundingName", self.remote_grounding_name) + writer.write_collection_of_object_values("results", self.results) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result_error.py new file mode 100644 index 00000000..bd4ade17 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result_error.py @@ -0,0 +1,50 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class RetrievalPerFilterSearchResultError(AdditionalDataHolder, Parsable): + """ + Error message if any. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The message property + message: Optional[str] = "Unknown Error Occurred" + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalPerFilterSearchResultError: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalPerFilterSearchResultError + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalPerFilterSearchResultError() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "message": lambda n : setattr(self, 'message', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("message", self.message) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result_with_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result_with_error.py new file mode 100644 index 00000000..a87f056a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_per_filter_search_result_with_error.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError + +@dataclass +class RetrievalPerFilterSearchResultWithError(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Error message if any. + error: Optional[RetrievalPerFilterSearchResultError] = None + # The filterId property + filter_id: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalPerFilterSearchResultWithError: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalPerFilterSearchResultWithError + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalPerFilterSearchResultWithError() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError + + from .retrieval_per_filter_search_result_error import RetrievalPerFilterSearchResultError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(RetrievalPerFilterSearchResultError)), + "filterId": lambda n : setattr(self, 'filter_id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_str_value("filterId", self.filter_id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_scoped_key_value_list_pair.py new file mode 100644 index 00000000..1eaf66f2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_scoped_key_value_list_pair.py @@ -0,0 +1,64 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_scoped_key_value_list_pair_scope import RetrievalScopedKeyValueListPair_scope + +@dataclass +class RetrievalScopedKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + from .retrieval_scoped_key_value_list_pair_scope import RetrievalScopedKeyValueListPair_scope + + # The scope property + scope: Optional[RetrievalScopedKeyValueListPair_scope] = RetrievalScopedKeyValueListPair_scope("document") + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalScopedKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalScopedKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalScopedKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_scoped_key_value_list_pair_scope import RetrievalScopedKeyValueListPair_scope + + from .retrieval_scoped_key_value_list_pair_scope import RetrievalScopedKeyValueListPair_scope + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "scope": lambda n : setattr(self, 'scope', n.get_enum_value(RetrievalScopedKeyValueListPair_scope)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_enum_value("scope", self.scope) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_scoped_key_value_list_pair_scope.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_scoped_key_value_list_pair_scope.py new file mode 100644 index 00000000..c3e7259b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_scoped_key_value_list_pair_scope.py @@ -0,0 +1,7 @@ +from enum import Enum + +class RetrievalScopedKeyValueListPair_scope(str, Enum): + Repository = "repository", + Document = "document", + Chunk = "chunk", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_configuration.py new file mode 100644 index 00000000..0feaca24 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_configuration.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class RetrievalSearchConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + max_chunk_count: Optional[int] = None + # [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. + max_document_count: Optional[int] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "maxChunkCount": lambda n : setattr(self, 'max_chunk_count', n.get_int_value()), + "maxDocumentCount": lambda n : setattr(self, 'max_document_count', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("maxChunkCount", self.max_chunk_count) + writer.write_int_value("maxDocumentCount", self.max_document_count) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_document_key_value_list_pair.py new file mode 100644 index 00000000..82c53738 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_document_key_value_list_pair.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum + +@dataclass +class RetrievalSearchDocumentKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # Select mode for search filters + select_mode: Optional[list[RetrievalSearchSelectOptionEnum]] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchDocumentKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchDocumentKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchDocumentKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum + + from .retrieval_search_select_option_enum import RetrievalSearchSelectOptionEnum + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "selectMode": lambda n : setattr(self, 'select_mode', n.get_collection_of_enum_values(RetrievalSearchSelectOptionEnum)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_enum_values("selectMode", self.select_mode) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_filter.py new file mode 100644 index 00000000..a4771a98 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_filter.py @@ -0,0 +1,94 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .retrieval_search_configuration import RetrievalSearchConfiguration + from .retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair + +@dataclass +class RetrievalSearchFilter(AdditionalDataHolder, Parsable): + """ + Limit scope of search to certain DataRepositories, Documents or Chunks. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Restrict chunks considered during search to those with the given metadata. + chunk_metadata: Optional[list[RetrievalKeyValueListPair]] = None + # Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + data_repositories: Optional[list[str]] = None + # Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + data_repository_metadata: Optional[list[RetrievalKeyValueListPair]] = None + # Only include DataRepositories with the given type. + data_repository_type: Optional[DataRepositoryType] = None + # Restrict documents considered during search to those annotated with the given metadata. + document_metadata: Optional[list[RetrievalSearchDocumentKeyValueListPair]] = None + # Identifier of this RetrievalSearchFilter - unique per request. + id: Optional[str] = None + # Destination Name of remote instance. + remote_name: Optional[str] = None + # The searchConfiguration property + search_configuration: Optional[RetrievalSearchConfiguration] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchFilter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchFilter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchFilter() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .retrieval_search_configuration import RetrievalSearchConfiguration + from .retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair + + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .retrieval_search_configuration import RetrievalSearchConfiguration + from .retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "chunkMetadata": lambda n : setattr(self, 'chunk_metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "dataRepositories": lambda n : setattr(self, 'data_repositories', n.get_collection_of_primitive_values(str)), + "dataRepositoryMetadata": lambda n : setattr(self, 'data_repository_metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "dataRepositoryType": lambda n : setattr(self, 'data_repository_type', n.get_enum_value(DataRepositoryType)), + "documentMetadata": lambda n : setattr(self, 'document_metadata', n.get_collection_of_object_values(RetrievalSearchDocumentKeyValueListPair)), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "remoteName": lambda n : setattr(self, 'remote_name', n.get_str_value()), + "searchConfiguration": lambda n : setattr(self, 'search_configuration', n.get_object_value(RetrievalSearchConfiguration)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunkMetadata", self.chunk_metadata) + writer.write_collection_of_primitive_values("dataRepositories", self.data_repositories) + writer.write_collection_of_object_values("dataRepositoryMetadata", self.data_repository_metadata) + writer.write_enum_value("dataRepositoryType", self.data_repository_type) + writer.write_collection_of_object_values("documentMetadata", self.document_metadata) + writer.write_str_value("id", self.id) + writer.write_str_value("remoteName", self.remote_name) + writer.write_object_value("searchConfiguration", self.search_configuration) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input.py new file mode 100644 index 00000000..cd95de54 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input.py @@ -0,0 +1,65 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_search_input_filters import RetrievalSearchInput_filters + from .retrieval_search_input_post_processing import RetrievalSearchInput_postProcessing + +@dataclass +class RetrievalSearchInput(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The filters property + filters: Optional[list[RetrievalSearchInput_filters]] = None + # List of operations to be performed across PerFilterSearchResults. + post_processing: Optional[list[RetrievalSearchInput_postProcessing]] = None + # Query string + query: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchInput: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchInput + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchInput() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_search_input_filters import RetrievalSearchInput_filters + from .retrieval_search_input_post_processing import RetrievalSearchInput_postProcessing + + from .retrieval_search_input_filters import RetrievalSearchInput_filters + from .retrieval_search_input_post_processing import RetrievalSearchInput_postProcessing + + fields: dict[str, Callable[[Any], None]] = { + "filters": lambda n : setattr(self, 'filters', n.get_collection_of_object_values(RetrievalSearchInput_filters)), + "postProcessing": lambda n : setattr(self, 'post_processing', n.get_collection_of_object_values(RetrievalSearchInput_postProcessing)), + "query": lambda n : setattr(self, 'query', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("filters", self.filters) + writer.write_collection_of_object_values("postProcessing", self.post_processing) + writer.write_str_value("query", self.query) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_filters.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_filters.py new file mode 100644 index 00000000..9d548a04 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_filters.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_search_filter import RetrievalSearchFilter + from .retrieval_vector_search_filter import RetrievalVectorSearchFilter + +@dataclass +class RetrievalSearchInput_filters(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes RetrievalSearchFilter, RetrievalVectorSearchFilter + """ + # Composed type representation for type RetrievalSearchFilter + retrieval_search_filter: Optional[RetrievalSearchFilter] = None + # Composed type representation for type RetrievalVectorSearchFilter + retrieval_vector_search_filter: Optional[RetrievalVectorSearchFilter] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchInput_filters: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchInput_filters + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = RetrievalSearchInput_filters() + from .retrieval_search_filter import RetrievalSearchFilter + + result.retrieval_search_filter = RetrievalSearchFilter() + from .retrieval_vector_search_filter import RetrievalVectorSearchFilter + + result.retrieval_vector_search_filter = RetrievalVectorSearchFilter() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_search_filter import RetrievalSearchFilter + from .retrieval_vector_search_filter import RetrievalVectorSearchFilter + + if self.retrieval_search_filter or self.retrieval_vector_search_filter: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.retrieval_search_filter, self.retrieval_vector_search_filter) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.retrieval_search_filter, self.retrieval_vector_search_filter) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing.py new file mode 100644 index 00000000..fb768718 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_search_input_post_processing_inputs import RetrievalSearchInput_postProcessing_inputs + from .retrieval_search_input_post_processing_strategy import RetrievalSearchInput_postProcessing_strategy + +@dataclass +class RetrievalSearchInput_postProcessing(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # New ID for each PostProcessingOperation. + id: Optional[str] = "ae9eee48-4671-4321-a3e5-640adaaf26ae" + # Maximum number of chunks to be retained in final PerSearchFilterResult. + max_chunk_count: Optional[int] = 5 + # The inputs property + inputs: Optional[list[RetrievalSearchInput_postProcessing_inputs]] = None + # Merging and scoring strategy to derive final PerSearchFilterResult. + strategy: Optional[RetrievalSearchInput_postProcessing_strategy] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchInput_postProcessing: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchInput_postProcessing + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchInput_postProcessing() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_search_input_post_processing_inputs import RetrievalSearchInput_postProcessing_inputs + from .retrieval_search_input_post_processing_strategy import RetrievalSearchInput_postProcessing_strategy + + from .retrieval_search_input_post_processing_inputs import RetrievalSearchInput_postProcessing_inputs + from .retrieval_search_input_post_processing_strategy import RetrievalSearchInput_postProcessing_strategy + + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "inputs": lambda n : setattr(self, 'inputs', n.get_collection_of_object_values(RetrievalSearchInput_postProcessing_inputs)), + "maxChunkCount": lambda n : setattr(self, 'max_chunk_count', n.get_int_value()), + "strategy": lambda n : setattr(self, 'strategy', n.get_object_value(RetrievalSearchInput_postProcessing_strategy)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_collection_of_object_values("inputs", self.inputs) + writer.write_int_value("maxChunkCount", self.max_chunk_count) + writer.write_object_value("strategy", self.strategy) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing_inputs.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing_inputs.py new file mode 100644 index 00000000..4ce69347 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing_inputs.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .post_processing_object_reference import PostProcessingObjectReference + from .post_processing_operation import PostProcessingOperation + +@dataclass +class RetrievalSearchInput_postProcessing_inputs(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes PostProcessingObjectReference, PostProcessingOperation + """ + # Composed type representation for type PostProcessingObjectReference + post_processing_object_reference: Optional[PostProcessingObjectReference] = None + # Composed type representation for type PostProcessingOperation + post_processing_operation: Optional[PostProcessingOperation] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchInput_postProcessing_inputs: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchInput_postProcessing_inputs + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = RetrievalSearchInput_postProcessing_inputs() + if mapping_value and mapping_value.casefold() == "PostProcessingObjectReference".casefold(): + from .post_processing_object_reference import PostProcessingObjectReference + + result.post_processing_object_reference = PostProcessingObjectReference() + elif mapping_value and mapping_value.casefold() == "PostProcessingOperation".casefold(): + from .post_processing_operation import PostProcessingOperation + + result.post_processing_operation = PostProcessingOperation() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .post_processing_object_reference import PostProcessingObjectReference + from .post_processing_operation import PostProcessingOperation + + if self.post_processing_object_reference: + return self.post_processing_object_reference.get_field_deserializers() + if self.post_processing_operation: + return self.post_processing_operation.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.post_processing_object_reference: + writer.write_object_value(None, self.post_processing_object_reference) + elif self.post_processing_operation: + writer.write_object_value(None, self.post_processing_operation) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing_strategy.py new file mode 100644 index 00000000..4ea99600 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_input_post_processing_strategy.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .merge_strategy_reranker import MergeStrategyReranker + from .merge_strategy_score_reuse import MergeStrategyScoreReuse + +@dataclass +class RetrievalSearchInput_postProcessing_strategy(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes MergeStrategyReranker, MergeStrategyScoreReuse + """ + # Composed type representation for type MergeStrategyReranker + merge_strategy_reranker: Optional[MergeStrategyReranker] = None + # Composed type representation for type MergeStrategyScoreReuse + merge_strategy_score_reuse: Optional[MergeStrategyScoreReuse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchInput_postProcessing_strategy: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchInput_postProcessing_strategy + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = RetrievalSearchInput_postProcessing_strategy() + if mapping_value and mapping_value.casefold() == "MergeStrategyReranker".casefold(): + from .merge_strategy_reranker import MergeStrategyReranker + + result.merge_strategy_reranker = MergeStrategyReranker() + elif mapping_value and mapping_value.casefold() == "MergeStrategyScoreReuse".casefold(): + from .merge_strategy_score_reuse import MergeStrategyScoreReuse + + result.merge_strategy_score_reuse = MergeStrategyScoreReuse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .merge_strategy_reranker import MergeStrategyReranker + from .merge_strategy_score_reuse import MergeStrategyScoreReuse + + if self.merge_strategy_reranker: + return self.merge_strategy_reranker.get_field_deserializers() + if self.merge_strategy_score_reuse: + return self.merge_strategy_score_reuse.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.merge_strategy_reranker: + writer.write_object_value(None, self.merge_strategy_reranker) + elif self.merge_strategy_score_reuse: + writer.write_object_value(None, self.merge_strategy_score_reuse) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results.py new file mode 100644 index 00000000..72560dce --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_search_results_results import RetrievalSearchResults_results + +@dataclass +class RetrievalSearchResults(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of returned results. + results: Optional[list[RetrievalSearchResults_results]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchResults: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchResults + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchResults() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_search_results_results import RetrievalSearchResults_results + + from .retrieval_search_results_results import RetrievalSearchResults_results + + fields: dict[str, Callable[[Any], None]] = { + "results": lambda n : setattr(self, 'results', n.get_collection_of_object_values(RetrievalSearchResults_results)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("results", self.results) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results400_error.py new file mode 100644 index 00000000..b4d49197 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class RetrievalSearchResults400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchResults400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchResults400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchResults400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results422_error.py new file mode 100644 index 00000000..76b5ad07 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class RetrievalSearchResults422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchResults422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchResults422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalSearchResults422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results_results.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results_results.py new file mode 100644 index 00000000..79ce4a36 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_results_results.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_per_filter_search_result import RetrievalPerFilterSearchResult + from .retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError + +@dataclass +class RetrievalSearchResults_results(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes RetrievalPerFilterSearchResult, RetrievalPerFilterSearchResultWithError + """ + # Composed type representation for type RetrievalPerFilterSearchResult + retrieval_per_filter_search_result: Optional[RetrievalPerFilterSearchResult] = None + # Composed type representation for type RetrievalPerFilterSearchResultWithError + retrieval_per_filter_search_result_with_error: Optional[RetrievalPerFilterSearchResultWithError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalSearchResults_results: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalSearchResults_results + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = RetrievalSearchResults_results() + from .retrieval_per_filter_search_result import RetrievalPerFilterSearchResult + + result.retrieval_per_filter_search_result = RetrievalPerFilterSearchResult() + from .retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError + + result.retrieval_per_filter_search_result_with_error = RetrievalPerFilterSearchResultWithError() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_per_filter_search_result import RetrievalPerFilterSearchResult + from .retrieval_per_filter_search_result_with_error import RetrievalPerFilterSearchResultWithError + + if self.retrieval_per_filter_search_result or self.retrieval_per_filter_search_result_with_error: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.retrieval_per_filter_search_result, self.retrieval_per_filter_search_result_with_error) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.retrieval_per_filter_search_result, self.retrieval_per_filter_search_result_with_error) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_select_option_enum.py new file mode 100644 index 00000000..14e06112 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_search_select_option_enum.py @@ -0,0 +1,5 @@ +from enum import Enum + +class RetrievalSearchSelectOptionEnum(str, Enum): + IgnoreIfKeyAbsent = "ignoreIfKeyAbsent", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_vector_search_filter.py new file mode 100644 index 00000000..16533865 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_vector_search_filter.py @@ -0,0 +1,105 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .retrieval_search_configuration import RetrievalSearchConfiguration + from .retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair + from .retrieval_vector_search_filter_filter import RetrievalVectorSearchFilter_filter + from .vector_scoring_configuration import VectorScoringConfiguration + +@dataclass +class RetrievalVectorSearchFilter(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Restrict chunks considered during search to those with the given metadata. + chunk_metadata: Optional[list[RetrievalKeyValueListPair]] = None + # Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + data_repositories: Optional[list[str]] = None + # Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + data_repository_metadata: Optional[list[RetrievalKeyValueListPair]] = None + # Only include DataRepositories with the given type. + data_repository_type: Optional[DataRepositoryType] = None + # Restrict documents considered during search to those annotated with the given metadata. + document_metadata: Optional[list[RetrievalSearchDocumentKeyValueListPair]] = None + # Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + filter: Optional[RetrievalVectorSearchFilter_filter] = None + # Identifier of this RetrievalSearchFilter - unique per request. + id: Optional[str] = None + # Destination Name of remote instance. + remote_name: Optional[str] = None + # The scoringConfiguration property + scoring_configuration: Optional[VectorScoringConfiguration] = None + # The searchConfiguration property + search_configuration: Optional[RetrievalSearchConfiguration] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalVectorSearchFilter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalVectorSearchFilter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return RetrievalVectorSearchFilter() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .retrieval_search_configuration import RetrievalSearchConfiguration + from .retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair + from .retrieval_vector_search_filter_filter import RetrievalVectorSearchFilter_filter + from .vector_scoring_configuration import VectorScoringConfiguration + + from .data_repository_type import DataRepositoryType + from .retrieval_key_value_list_pair import RetrievalKeyValueListPair + from .retrieval_search_configuration import RetrievalSearchConfiguration + from .retrieval_search_document_key_value_list_pair import RetrievalSearchDocumentKeyValueListPair + from .retrieval_vector_search_filter_filter import RetrievalVectorSearchFilter_filter + from .vector_scoring_configuration import VectorScoringConfiguration + + fields: dict[str, Callable[[Any], None]] = { + "chunkMetadata": lambda n : setattr(self, 'chunk_metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "dataRepositories": lambda n : setattr(self, 'data_repositories', n.get_collection_of_primitive_values(str)), + "dataRepositoryMetadata": lambda n : setattr(self, 'data_repository_metadata', n.get_collection_of_object_values(RetrievalKeyValueListPair)), + "dataRepositoryType": lambda n : setattr(self, 'data_repository_type', n.get_enum_value(DataRepositoryType)), + "documentMetadata": lambda n : setattr(self, 'document_metadata', n.get_collection_of_object_values(RetrievalSearchDocumentKeyValueListPair)), + "filter": lambda n : setattr(self, 'filter', n.get_object_value(RetrievalVectorSearchFilter_filter)), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "remoteName": lambda n : setattr(self, 'remote_name', n.get_str_value()), + "scoringConfiguration": lambda n : setattr(self, 'scoring_configuration', n.get_object_value(VectorScoringConfiguration)), + "searchConfiguration": lambda n : setattr(self, 'search_configuration', n.get_object_value(RetrievalSearchConfiguration)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunkMetadata", self.chunk_metadata) + writer.write_collection_of_primitive_values("dataRepositories", self.data_repositories) + writer.write_collection_of_object_values("dataRepositoryMetadata", self.data_repository_metadata) + writer.write_enum_value("dataRepositoryType", self.data_repository_type) + writer.write_collection_of_object_values("documentMetadata", self.document_metadata) + writer.write_object_value("filter", self.filter) + writer.write_str_value("id", self.id) + writer.write_str_value("remoteName", self.remote_name) + writer.write_object_value("scoringConfiguration", self.scoring_configuration) + writer.write_object_value("searchConfiguration", self.search_configuration) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_vector_search_filter_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_vector_search_filter_filter.py new file mode 100644 index 00000000..1e077222 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/retrieval_vector_search_filter_filter.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + +@dataclass +class RetrievalVectorSearchFilter_filter(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes RetrievalBinaryBooleanFilter, RetrievalScopedKeyValueListPair + """ + # Composed type representation for type RetrievalBinaryBooleanFilter + retrieval_binary_boolean_filter: Optional[RetrievalBinaryBooleanFilter] = None + # Composed type representation for type RetrievalScopedKeyValueListPair + retrieval_scoped_key_value_list_pair: Optional[RetrievalScopedKeyValueListPair] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> RetrievalVectorSearchFilter_filter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: RetrievalVectorSearchFilter_filter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = RetrievalVectorSearchFilter_filter() + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + + result.retrieval_binary_boolean_filter = RetrievalBinaryBooleanFilter() + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + + result.retrieval_scoped_key_value_list_pair = RetrievalScopedKeyValueListPair() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .retrieval_binary_boolean_filter import RetrievalBinaryBooleanFilter + from .retrieval_scoped_key_value_list_pair import RetrievalScopedKeyValueListPair + + if self.retrieval_binary_boolean_filter or self.retrieval_scoped_key_value_list_pair: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.retrieval_binary_boolean_filter, self.retrieval_scoped_key_value_list_pair) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.retrieval_binary_boolean_filter, self.retrieval_scoped_key_value_list_pair) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration.py new file mode 100644 index 00000000..c51626e9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .s3_configuration_s3 import S3Configuration_s3 + +@dataclass +class S3Configuration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The cronExpression property + cron_expression: Optional[str] = None + # The destination property + destination: Optional[str] = None + # The s3 property + s3: Optional[S3Configuration_s3] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3Configuration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3Configuration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3Configuration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .s3_configuration_s3 import S3Configuration_s3 + + from .s3_configuration_s3 import S3Configuration_s3 + + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "s3": lambda n : setattr(self, 's3', n.get_object_value(S3Configuration_s3)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_str_value("destination", self.destination) + writer.write_object_value("s3", self.s3) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_minimal.py new file mode 100644 index 00000000..2c934bb4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_minimal.py @@ -0,0 +1,50 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .s3_configuration_minimal_s3 import S3ConfigurationMinimal_s3 + +@dataclass +class S3ConfigurationMinimal(Parsable): + # The s3 property + s3: Optional[S3ConfigurationMinimal_s3] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3ConfigurationMinimal: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3ConfigurationMinimal + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3ConfigurationMinimal() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .s3_configuration_minimal_s3 import S3ConfigurationMinimal_s3 + + from .s3_configuration_minimal_s3 import S3ConfigurationMinimal_s3 + + fields: dict[str, Callable[[Any], None]] = { + "s3": lambda n : setattr(self, 's3', n.get_object_value(S3ConfigurationMinimal_s3)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("s3", self.s3) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_minimal_s3.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_minimal_s3.py new file mode 100644 index 00000000..7491a801 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_minimal_s3.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class S3ConfigurationMinimal_s3(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3ConfigurationMinimal_s3: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3ConfigurationMinimal_s3 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3ConfigurationMinimal_s3() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_s3.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_s3.py new file mode 100644 index 00000000..102893b9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_configuration_s3.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class S3Configuration_s3(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3Configuration_s3: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3Configuration_s3 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3Configuration_s3() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_create_request.py new file mode 100644 index 00000000..418e54fe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_create_request.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + from .s3_configuration import S3Configuration + from .s3_pipeline_create_request_type import S3PipelineCreateRequest_type + +@dataclass +class S3PipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[S3Configuration] = None + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[S3PipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3PipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3PipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3PipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + from .s3_configuration import S3Configuration + from .s3_pipeline_create_request_type import S3PipelineCreateRequest_type + + from .meta_data import MetaData + from .s3_configuration import S3Configuration + from .s3_pipeline_create_request_type import S3PipelineCreateRequest_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(S3Configuration)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(S3PipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_create_request_type.py new file mode 100644 index 00000000..71fd8bc4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class S3PipelineCreateRequest_type(str, Enum): + S3 = "S3", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_get_response.py new file mode 100644 index 00000000..199bda7f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_get_response.py @@ -0,0 +1,60 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + from .s3_configuration import S3Configuration + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class S3PipelineGetResponse(BasePipelineResponse, Parsable): + # The configuration property + configuration: Optional[S3Configuration] = None + # The type property + type: Optional[S3PipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3PipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3PipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3PipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + from .s3_configuration import S3Configuration + + from .base_pipeline_response import BasePipelineResponse + from .s3_configuration import S3Configuration + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(S3Configuration)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_get_response_type.py new file mode 100644 index 00000000..b278d481 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class S3PipelineGetResponse_type(str, Enum): + S3 = "S3", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_minimal_response.py new file mode 100644 index 00000000..7f56c0a2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_minimal_response.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s3_configuration_minimal import S3ConfigurationMinimal + from .s3_pipeline_minimal_response_type import S3PipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class S3PipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The configuration property + configuration: Optional[S3ConfigurationMinimal] = None + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[S3PipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> S3PipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: S3PipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return S3PipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s3_configuration_minimal import S3ConfigurationMinimal + from .s3_pipeline_minimal_response_type import S3PipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s3_configuration_minimal import S3ConfigurationMinimal + from .s3_pipeline_minimal_response_type import S3PipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(S3ConfigurationMinimal)), + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(S3PipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_minimal_response_type.py new file mode 100644 index 00000000..25aa7ae3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s3_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class S3PipelineMinimalResponse_type(str, Enum): + S3 = "S3", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_create_request.py new file mode 100644 index 00000000..b2253b2e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_create_request.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + from .s_d_m_pipeline_create_request_type import SDMPipelineCreateRequest_type + +@dataclass +class SDMPipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[SDMPipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SDMPipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SDMPipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SDMPipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + from .s_d_m_pipeline_create_request_type import SDMPipelineCreateRequest_type + + from .meta_data import MetaData + from .s_d_m_pipeline_create_request_type import SDMPipelineCreateRequest_type + + fields: dict[str, Callable[[Any], None]] = { + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(SDMPipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_create_request_type.py new file mode 100644 index 00000000..c8bf5193 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class SDMPipelineCreateRequest_type(str, Enum): + SDM = "SDM", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_get_response.py new file mode 100644 index 00000000..2d4abb7f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_get_response.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class SDMPipelineGetResponse(BasePipelineResponse, Parsable): + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[SDMPipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SDMPipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SDMPipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SDMPipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + + from .base_pipeline_response import BasePipelineResponse + + fields: dict[str, Callable[[Any], None]] = { + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_get_response_type.py new file mode 100644 index 00000000..7998ab87 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class SDMPipelineGetResponse_type(str, Enum): + SDM = "SDM", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_minimal_response.py new file mode 100644 index 00000000..d82438a4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_minimal_response.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s_d_m_pipeline_minimal_response_type import SDMPipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class SDMPipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[SDMPipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SDMPipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SDMPipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SDMPipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s_d_m_pipeline_minimal_response_type import SDMPipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s_d_m_pipeline_minimal_response_type import SDMPipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(SDMPipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_minimal_response_type.py new file mode 100644 index 00000000..6f285c17 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_d_m_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class SDMPipelineMinimalResponse_type(str, Enum): + SDM = "SDM", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration.py new file mode 100644 index 00000000..0e3274a1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .s_f_t_p_configuration_sftp import SFTPConfiguration_sftp + +@dataclass +class SFTPConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The cronExpression property + cron_expression: Optional[str] = None + # The destination property + destination: Optional[str] = None + # The sftp property + sftp: Optional[SFTPConfiguration_sftp] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .s_f_t_p_configuration_sftp import SFTPConfiguration_sftp + + from .s_f_t_p_configuration_sftp import SFTPConfiguration_sftp + + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "sftp": lambda n : setattr(self, 'sftp', n.get_object_value(SFTPConfiguration_sftp)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_str_value("destination", self.destination) + writer.write_object_value("sftp", self.sftp) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_minimal.py new file mode 100644 index 00000000..ccdf2181 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_minimal.py @@ -0,0 +1,50 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .s_f_t_p_configuration_minimal_sftp import SFTPConfigurationMinimal_sftp + +@dataclass +class SFTPConfigurationMinimal(Parsable): + # The sftp property + sftp: Optional[SFTPConfigurationMinimal_sftp] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPConfigurationMinimal: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPConfigurationMinimal + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPConfigurationMinimal() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .s_f_t_p_configuration_minimal_sftp import SFTPConfigurationMinimal_sftp + + from .s_f_t_p_configuration_minimal_sftp import SFTPConfigurationMinimal_sftp + + fields: dict[str, Callable[[Any], None]] = { + "sftp": lambda n : setattr(self, 'sftp', n.get_object_value(SFTPConfigurationMinimal_sftp)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("sftp", self.sftp) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_minimal_sftp.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_minimal_sftp.py new file mode 100644 index 00000000..ddf98f37 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_minimal_sftp.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SFTPConfigurationMinimal_sftp(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPConfigurationMinimal_sftp: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPConfigurationMinimal_sftp + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPConfigurationMinimal_sftp() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_sftp.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_sftp.py new file mode 100644 index 00000000..58c1dd08 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_configuration_sftp.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SFTPConfiguration_sftp(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPConfiguration_sftp: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPConfiguration_sftp + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPConfiguration_sftp() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_create_request.py new file mode 100644 index 00000000..d50bc092 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_create_request.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + from .s_f_t_p_configuration import SFTPConfiguration + from .s_f_t_p_pipeline_create_request_type import SFTPPipelineCreateRequest_type + +@dataclass +class SFTPPipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[SFTPConfiguration] = None + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[SFTPPipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPPipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPPipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPPipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + from .s_f_t_p_configuration import SFTPConfiguration + from .s_f_t_p_pipeline_create_request_type import SFTPPipelineCreateRequest_type + + from .meta_data import MetaData + from .s_f_t_p_configuration import SFTPConfiguration + from .s_f_t_p_pipeline_create_request_type import SFTPPipelineCreateRequest_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(SFTPConfiguration)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(SFTPPipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_create_request_type.py new file mode 100644 index 00000000..41d99f8a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class SFTPPipelineCreateRequest_type(str, Enum): + SFTP = "SFTP", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_get_response.py new file mode 100644 index 00000000..4488b22e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_get_response.py @@ -0,0 +1,60 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + from .s_f_t_p_configuration import SFTPConfiguration + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class SFTPPipelineGetResponse(BasePipelineResponse, Parsable): + # The configuration property + configuration: Optional[SFTPConfiguration] = None + # The type property + type: Optional[SFTPPipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPPipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPPipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPPipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + from .s_f_t_p_configuration import SFTPConfiguration + + from .base_pipeline_response import BasePipelineResponse + from .s_f_t_p_configuration import SFTPConfiguration + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(SFTPConfiguration)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_get_response_type.py new file mode 100644 index 00000000..4a069ecd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class SFTPPipelineGetResponse_type(str, Enum): + SFTP = "SFTP", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_minimal_response.py new file mode 100644 index 00000000..5cb56ec0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_minimal_response.py @@ -0,0 +1,69 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s_f_t_p_configuration_minimal import SFTPConfigurationMinimal + from .s_f_t_p_pipeline_minimal_response_type import SFTPPipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class SFTPPipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The configuration property + configuration: Optional[SFTPConfigurationMinimal] = None + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[SFTPPipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SFTPPipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SFTPPipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SFTPPipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s_f_t_p_configuration_minimal import SFTPConfigurationMinimal + from .s_f_t_p_pipeline_minimal_response_type import SFTPPipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .s_f_t_p_configuration_minimal import SFTPConfigurationMinimal + from .s_f_t_p_pipeline_minimal_response_type import SFTPPipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(SFTPConfigurationMinimal)), + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(SFTPPipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_minimal_response_type.py new file mode 100644 index 00000000..6fd56681 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/s_f_t_p_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class SFTPPipelineMinimalResponse_type(str, Enum): + SFTP = "SFTP", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scoped_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scoped_key_value_list_pair.py new file mode 100644 index 00000000..3acb2604 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scoped_key_value_list_pair.py @@ -0,0 +1,64 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .scoped_key_value_list_pair_scope import ScopedKeyValueListPair_scope + +@dataclass +class ScopedKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + from .scoped_key_value_list_pair_scope import ScopedKeyValueListPair_scope + + # Scope of the metadata filter (e.g., collection, document, chunk) + scope: Optional[ScopedKeyValueListPair_scope] = ScopedKeyValueListPair_scope("document") + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ScopedKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ScopedKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ScopedKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .scoped_key_value_list_pair_scope import ScopedKeyValueListPair_scope + + from .scoped_key_value_list_pair_scope import ScopedKeyValueListPair_scope + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "scope": lambda n : setattr(self, 'scope', n.get_enum_value(ScopedKeyValueListPair_scope)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_enum_value("scope", self.scope) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scoped_key_value_list_pair_scope.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scoped_key_value_list_pair_scope.py new file mode 100644 index 00000000..7ce4c743 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scoped_key_value_list_pair_scope.py @@ -0,0 +1,7 @@ +from enum import Enum + +class ScopedKeyValueListPair_scope(str, Enum): + Collection = "collection", + Document = "document", + Chunk = "chunk", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/score.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/score.py new file mode 100644 index 00000000..d5a8a1e7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/score.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class Score(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The value property + value: Optional[float] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Score: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Score + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Score() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "value": lambda n : setattr(self, 'value', n.get_float_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_float_value("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scores_aggregation_strategy.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scores_aggregation_strategy.py new file mode 100644 index 00000000..5d1a3ba8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/scores_aggregation_strategy.py @@ -0,0 +1,7 @@ +from enum import Enum + +class ScoresAggregationStrategy(str, Enum): + Weighted_average = "weighted_average", + Rrf = "rrf", + Weighted_rrf = "weighted_rrf", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipeline.py new file mode 100644 index 00000000..068849e2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipeline.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .search_pipeline_data_repository_metadata import SearchPipeline_dataRepositoryMetadata + +@dataclass +class SearchPipeline(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Search for metadata happens at key level. Pipelines matching the search criteria will be returned. + data_repository_metadata: Optional[list[SearchPipeline_dataRepositoryMetadata]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchPipeline: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchPipeline + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchPipeline() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .search_pipeline_data_repository_metadata import SearchPipeline_dataRepositoryMetadata + + from .search_pipeline_data_repository_metadata import SearchPipeline_dataRepositoryMetadata + + fields: dict[str, Callable[[Any], None]] = { + "dataRepositoryMetadata": lambda n : setattr(self, 'data_repository_metadata', n.get_collection_of_object_values(SearchPipeline_dataRepositoryMetadata)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("dataRepositoryMetadata", self.data_repository_metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipeline_data_repository_metadata.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipeline_data_repository_metadata.py new file mode 100644 index 00000000..74b99fee --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipeline_data_repository_metadata.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SearchPipeline_dataRepositoryMetadata(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchPipeline_dataRepositoryMetadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchPipeline_dataRepositoryMetadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchPipeline_dataRepositoryMetadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipelines_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipelines_response.py new file mode 100644 index 00000000..69f8eae0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipelines_response.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .pipeline_minimal_response import PipelineMinimalResponse + +@dataclass +class SearchPipelinesResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The count property + count: Optional[int] = None + # The resources property + resources: Optional[list[PipelineMinimalResponse]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchPipelinesResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchPipelinesResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchPipelinesResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .pipeline_minimal_response import PipelineMinimalResponse + + from .pipeline_minimal_response import PipelineMinimalResponse + + fields: dict[str, Callable[[Any], None]] = { + "count": lambda n : setattr(self, 'count', n.get_int_value()), + "resources": lambda n : setattr(self, 'resources', n.get_collection_of_object_values(PipelineMinimalResponse)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("count", self.count) + writer.write_collection_of_object_values("resources", self.resources) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipelines_response400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipelines_response400_error.py new file mode 100644 index 00000000..9d7fa5c3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_pipelines_response400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class SearchPipelinesResponse400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchPipelinesResponse400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchPipelinesResponse400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchPipelinesResponse400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores.py new file mode 100644 index 00000000..0819cf0c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .search_scores_aggregated_score import SearchScores_aggregatedScore + from .search_scores_dense_retrieval_score import SearchScores_denseRetrievalScore + +@dataclass +class SearchScores(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The aggregatedScore property + aggregated_score: Optional[SearchScores_aggregatedScore] = None + # The denseRetrievalScore property + dense_retrieval_score: Optional[SearchScores_denseRetrievalScore] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchScores: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchScores + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchScores() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .search_scores_aggregated_score import SearchScores_aggregatedScore + from .search_scores_dense_retrieval_score import SearchScores_denseRetrievalScore + + from .search_scores_aggregated_score import SearchScores_aggregatedScore + from .search_scores_dense_retrieval_score import SearchScores_denseRetrievalScore + + fields: dict[str, Callable[[Any], None]] = { + "aggregatedScore": lambda n : setattr(self, 'aggregated_score', n.get_object_value(SearchScores_aggregatedScore)), + "denseRetrievalScore": lambda n : setattr(self, 'dense_retrieval_score', n.get_object_value(SearchScores_denseRetrievalScore)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("aggregatedScore", self.aggregated_score) + writer.write_object_value("denseRetrievalScore", self.dense_retrieval_score) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores_aggregated_score.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores_aggregated_score.py new file mode 100644 index 00000000..bd9089f5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores_aggregated_score.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SearchScores_aggregatedScore(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The value property + value: Optional[float] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchScores_aggregatedScore: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchScores_aggregatedScore + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchScores_aggregatedScore() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "value": lambda n : setattr(self, 'value', n.get_float_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_float_value("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores_dense_retrieval_score.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores_dense_retrieval_score.py new file mode 100644 index 00000000..7016e002 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/search_scores_dense_retrieval_score.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SearchScores_denseRetrievalScore(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The value property + value: Optional[float] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SearchScores_denseRetrievalScore: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SearchScores_denseRetrievalScore + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SearchScores_denseRetrievalScore() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "value": lambda n : setattr(self, 'value', n.get_float_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_float_value("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_config.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_config.py new file mode 100644 index 00000000..dd55b53a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_config.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ServiceNowConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_minimal.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_minimal.py new file mode 100644 index 00000000..aaf00fbe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_minimal.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimal_serviceNow + +@dataclass +class ServiceNowConfigurationMinimal(Parsable): + # The destination property + destination: Optional[str] = None + # The serviceNow property + service_now: Optional[ServiceNowConfigurationMinimal_serviceNow] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowConfigurationMinimal: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowConfigurationMinimal + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowConfigurationMinimal() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimal_serviceNow + + from .service_now_configuration_minimal_service_now import ServiceNowConfigurationMinimal_serviceNow + + fields: dict[str, Callable[[Any], None]] = { + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "serviceNow": lambda n : setattr(self, 'service_now', n.get_object_value(ServiceNowConfigurationMinimal_serviceNow)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("destination", self.destination) + writer.write_object_value("serviceNow", self.service_now) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_minimal_service_now.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_minimal_service_now.py new file mode 100644 index 00000000..09945d26 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_minimal_service_now.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ServiceNowConfigurationMinimal_serviceNow(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowConfigurationMinimal_serviceNow: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowConfigurationMinimal_serviceNow + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowConfigurationMinimal_serviceNow() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_struct.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_struct.py new file mode 100644 index 00000000..75777dbf --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_configuration_struct.py @@ -0,0 +1,66 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .service_now_config import ServiceNowConfig + +@dataclass +class ServiceNowConfigurationStruct(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Optional cron expression for scheduling pipeline execution.Must represent an interval greater than 1 hour. + cron_expression: Optional[str] = None + # The destination property + destination: Optional[str] = None + # The metadataConfigId property + metadata_config_id: Optional[str] = None + # The serviceNow property + service_now: Optional[ServiceNowConfig] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowConfigurationStruct: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowConfigurationStruct + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowConfigurationStruct() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .service_now_config import ServiceNowConfig + + from .service_now_config import ServiceNowConfig + + fields: dict[str, Callable[[Any], None]] = { + "cronExpression": lambda n : setattr(self, 'cron_expression', n.get_str_value()), + "destination": lambda n : setattr(self, 'destination', n.get_str_value()), + "metadataConfigId": lambda n : setattr(self, 'metadata_config_id', n.get_str_value()), + "serviceNow": lambda n : setattr(self, 'service_now', n.get_object_value(ServiceNowConfig)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("cronExpression", self.cron_expression) + writer.write_str_value("destination", self.destination) + writer.write_str_value("metadataConfigId", self.metadata_config_id) + writer.write_object_value("serviceNow", self.service_now) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_create_request.py new file mode 100644 index 00000000..4e020ea6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_create_request.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + from .service_now_configuration_struct import ServiceNowConfigurationStruct + from .service_now_pipeline_create_request_type import ServiceNowPipelineCreateRequest_type + +@dataclass +class ServiceNowPipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The configuration property + configuration: Optional[ServiceNowConfigurationStruct] = None + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[ServiceNowPipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowPipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowPipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowPipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + from .service_now_configuration_struct import ServiceNowConfigurationStruct + from .service_now_pipeline_create_request_type import ServiceNowPipelineCreateRequest_type + + from .meta_data import MetaData + from .service_now_configuration_struct import ServiceNowConfigurationStruct + from .service_now_pipeline_create_request_type import ServiceNowPipelineCreateRequest_type + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(ServiceNowConfigurationStruct)), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(ServiceNowPipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("configuration", self.configuration) + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_create_request_type.py new file mode 100644 index 00000000..c6e92f71 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class ServiceNowPipelineCreateRequest_type(str, Enum): + ServiceNow = "ServiceNow", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_get_response.py new file mode 100644 index 00000000..b2117e37 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_get_response.py @@ -0,0 +1,60 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + from .service_now_configuration_minimal import ServiceNowConfigurationMinimal + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class ServiceNowPipelineGetResponse(BasePipelineResponse, Parsable): + # The configuration property + configuration: Optional[ServiceNowConfigurationMinimal] = None + # The type property + type: Optional[ServiceNowPipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowPipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowPipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowPipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + from .service_now_configuration_minimal import ServiceNowConfigurationMinimal + + from .base_pipeline_response import BasePipelineResponse + from .service_now_configuration_minimal import ServiceNowConfigurationMinimal + + fields: dict[str, Callable[[Any], None]] = { + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(ServiceNowConfigurationMinimal)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_object_value("configuration", self.configuration) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_get_response_type.py new file mode 100644 index 00000000..41b724cd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class ServiceNowPipelineGetResponse_type(str, Enum): + ServiceNow = "ServiceNow", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_minimal_response.py new file mode 100644 index 00000000..d98e2ed0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_minimal_response.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .service_now_pipeline_minimal_response_type import ServiceNowPipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class ServiceNowPipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[ServiceNowPipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ServiceNowPipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ServiceNowPipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ServiceNowPipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .service_now_pipeline_minimal_response_type import ServiceNowPipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .service_now_pipeline_minimal_response_type import ServiceNowPipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(ServiceNowPipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_minimal_response_type.py new file mode 100644 index 00000000..4467b80a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/service_now_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class ServiceNowPipelineMinimalResponse_type(str, Enum): + ServiceNow = "ServiceNow", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_config.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_config.py new file mode 100644 index 00000000..9cc6e6a5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_config.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .share_point_site import SharePointSite + +@dataclass +class SharePointConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The site property + site: Optional[SharePointSite] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SharePointConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SharePointConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SharePointConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .share_point_site import SharePointSite + + from .share_point_site import SharePointSite + + fields: dict[str, Callable[[Any], None]] = { + "site": lambda n : setattr(self, 'site', n.get_object_value(SharePointSite)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("site", self.site) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_config_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_config_get_response.py new file mode 100644 index 00000000..c3e6a921 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_config_get_response.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .share_point_site_get_response import SharePointSiteGetResponse + +@dataclass +class SharePointConfigGetResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The site property + site: Optional[SharePointSiteGetResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SharePointConfigGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SharePointConfigGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SharePointConfigGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .share_point_site_get_response import SharePointSiteGetResponse + + from .share_point_site_get_response import SharePointSiteGetResponse + + fields: dict[str, Callable[[Any], None]] = { + "site": lambda n : setattr(self, 'site', n.get_object_value(SharePointSiteGetResponse)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("site", self.site) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site.py new file mode 100644 index 00000000..b2dd8c6b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SharePointSite(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The includePaths property + include_paths: Optional[list[str]] = None + # The name property + name: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SharePointSite: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SharePointSite + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SharePointSite() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + "name": lambda n : setattr(self, 'name', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_str_value("name", self.name) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site_detail.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site_detail.py new file mode 100644 index 00000000..8716ddfe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site_detail.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SharePointSiteDetail(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The id property + id: Optional[str] = None + # The includePaths property + include_paths: Optional[list[str]] = None + # The name property + name: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SharePointSiteDetail: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SharePointSiteDetail + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SharePointSiteDetail() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + "name": lambda n : setattr(self, 'name', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_str_value("name", self.name) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site_get_response.py new file mode 100644 index 00000000..4f2ee7a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/share_point_site_get_response.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SharePointSiteGetResponse(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The id property + id: Optional[str] = None + # The includePaths property + include_paths: Optional[list[str]] = None + # The name property + name: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SharePointSiteGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SharePointSiteGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SharePointSiteGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "includePaths": lambda n : setattr(self, 'include_paths', n.get_collection_of_primitive_values(str)), + "name": lambda n : setattr(self, 'name', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("id", self.id) + writer.write_collection_of_primitive_values("includePaths", self.include_paths) + writer.write_str_value("name", self.name) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_only_base_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_only_base_chunk.py new file mode 100644 index 00000000..6cc38718 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_only_base_chunk.py @@ -0,0 +1,66 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID + +if TYPE_CHECKING: + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class TextOnlyBaseChunk(AdditionalDataHolder, Parsable): + """ + Schema for a text-only chunk. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The content property + content: Optional[str] = None + # Unique identifier of a chuk. + id: Optional[UUID] = None + # The metadata property + metadata: Optional[list[VectorKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> TextOnlyBaseChunk: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: TextOnlyBaseChunk + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return TextOnlyBaseChunk() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "content": lambda n : setattr(self, 'content', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_uuid_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("content", self.content) + writer.write_uuid_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_only_base_chunk_create.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_only_base_chunk_create.py new file mode 100644 index 00000000..a5dcda9d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_only_base_chunk_create.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class TextOnlyBaseChunkCreate(AdditionalDataHolder, Parsable): + """ + Schema for a text-only chunk. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The content property + content: Optional[str] = None + # The metadata property + metadata: Optional[list[VectorKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> TextOnlyBaseChunkCreate: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: TextOnlyBaseChunkCreate + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return TextOnlyBaseChunkCreate() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "content": lambda n : setattr(self, 'content', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("content", self.content) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_search_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_search_request.py new file mode 100644 index 00000000..9693ac05 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/text_search_request.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .vector_search_filter import VectorSearchFilter + +@dataclass +class TextSearchRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The filters property + filters: Optional[list[VectorSearchFilter]] = None + # Query string + query: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> TextSearchRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: TextSearchRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return TextSearchRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_search_filter import VectorSearchFilter + + from .vector_search_filter import VectorSearchFilter + + fields: dict[str, Callable[[Any], None]] = { + "filters": lambda n : setattr(self, 'filters', n.get_collection_of_object_values(VectorSearchFilter)), + "query": lambda n : setattr(self, 'query', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("filters", self.filters) + writer.write_str_value("query", self.query) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/trigger400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/trigger400_error.py new file mode 100644 index 00000000..7c14631b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/trigger400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class Trigger400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> Trigger400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: Trigger400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return Trigger400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_chunk.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_chunk.py new file mode 100644 index 00000000..62ab19bb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_chunk.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .vector_key_value_list_pair import VectorKeyValueListPair + +@dataclass +class VectorChunk(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The content property + content: Optional[str] = None + # The id property + id: Optional[str] = None + # The metadata property + metadata: Optional[list[VectorKeyValueListPair]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorChunk: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorChunk + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorChunk() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_key_value_list_pair import VectorKeyValueListPair + + from .vector_key_value_list_pair import VectorKeyValueListPair + + fields: dict[str, Callable[[Any], None]] = { + "content": lambda n : setattr(self, 'content', n.get_str_value()), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("content", self.content) + writer.write_str_value("id", self.id) + writer.write_collection_of_object_values("metadata", self.metadata) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_document_key_value_list_pair.py new file mode 100644 index 00000000..67a0e875 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_document_key_value_list_pair.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .filter_match_mode_enum import FilterMatchModeEnum + +@dataclass +class VectorDocumentKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The matchMode property + match_mode: Optional[FilterMatchModeEnum] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorDocumentKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorDocumentKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorDocumentKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .filter_match_mode_enum import FilterMatchModeEnum + + from .filter_match_mode_enum import FilterMatchModeEnum + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "matchMode": lambda n : setattr(self, 'match_mode', n.get_enum_value(FilterMatchModeEnum)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_enum_value("matchMode", self.match_mode) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_key_value_list_pair.py new file mode 100644 index 00000000..d1b2a269 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_key_value_list_pair.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class VectorKeyValueListPair(AdditionalDataHolder, Parsable): + """ + Collection metadata during ingestion + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_per_filter_search_result.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_per_filter_search_result.py new file mode 100644 index 00000000..879f69f6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_per_filter_search_result.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .documents_chunk import DocumentsChunk + +@dataclass +class VectorPerFilterSearchResult(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The filterId property + filter_id: Optional[str] = None + # The results property + results: Optional[list[DocumentsChunk]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorPerFilterSearchResult: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorPerFilterSearchResult + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorPerFilterSearchResult() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .documents_chunk import DocumentsChunk + + from .documents_chunk import DocumentsChunk + + fields: dict[str, Callable[[Any], None]] = { + "filterId": lambda n : setattr(self, 'filter_id', n.get_str_value()), + "results": lambda n : setattr(self, 'results', n.get_collection_of_object_values(DocumentsChunk)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("filterId", self.filter_id) + writer.write_collection_of_object_values("results", self.results) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_scoring_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_scoring_configuration.py new file mode 100644 index 00000000..6f26b8f8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_scoring_configuration.py @@ -0,0 +1,79 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .boosting_scoring_configuration import BoostingScoringConfiguration + from .dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration + from .key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration + from .scores_aggregation_strategy import ScoresAggregationStrategy + +@dataclass +class VectorScoringConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The aggregationStrategy property + aggregation_strategy: Optional[ScoresAggregationStrategy] = None + # The boosting property + boosting: Optional[BoostingScoringConfiguration] = None + # The denseRetrieval property + dense_retrieval: Optional[DenseRetrievalScoringConfiguration] = None + # The keywordRetrieval property + keyword_retrieval: Optional[KeyWordRetrievalScoringConfiguration] = None + # Minimum chunk score threshold. + score_threshold: Optional[float] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorScoringConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorScoringConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorScoringConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .boosting_scoring_configuration import BoostingScoringConfiguration + from .dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration + from .key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration + from .scores_aggregation_strategy import ScoresAggregationStrategy + + from .boosting_scoring_configuration import BoostingScoringConfiguration + from .dense_retrieval_scoring_configuration import DenseRetrievalScoringConfiguration + from .key_word_retrieval_scoring_configuration import KeyWordRetrievalScoringConfiguration + from .scores_aggregation_strategy import ScoresAggregationStrategy + + fields: dict[str, Callable[[Any], None]] = { + "aggregationStrategy": lambda n : setattr(self, 'aggregation_strategy', n.get_enum_value(ScoresAggregationStrategy)), + "boosting": lambda n : setattr(self, 'boosting', n.get_object_value(BoostingScoringConfiguration)), + "denseRetrieval": lambda n : setattr(self, 'dense_retrieval', n.get_object_value(DenseRetrievalScoringConfiguration)), + "keywordRetrieval": lambda n : setattr(self, 'keyword_retrieval', n.get_object_value(KeyWordRetrievalScoringConfiguration)), + "scoreThreshold": lambda n : setattr(self, 'score_threshold', n.get_float_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_enum_value("aggregationStrategy", self.aggregation_strategy) + writer.write_object_value("boosting", self.boosting) + writer.write_object_value("denseRetrieval", self.dense_retrieval) + writer.write_object_value("keywordRetrieval", self.keyword_retrieval) + writer.write_float_value("scoreThreshold", self.score_threshold) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_configuration.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_configuration.py new file mode 100644 index 00000000..4d7569e3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_configuration.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class VectorSearchConfiguration(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + max_chunk_count: Optional[int] = None + # [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. + max_document_count: Optional[int] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchConfiguration: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchConfiguration + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchConfiguration() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "maxChunkCount": lambda n : setattr(self, 'max_chunk_count', n.get_int_value()), + "maxDocumentCount": lambda n : setattr(self, 'max_document_count', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("maxChunkCount", self.max_chunk_count) + writer.write_int_value("maxDocumentCount", self.max_document_count) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_document_key_value_list_pair.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_document_key_value_list_pair.py new file mode 100644 index 00000000..7510b1f8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_document_key_value_list_pair.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .vector_search_select_option_enum import VectorSearchSelectOptionEnum + +@dataclass +class VectorSearchDocumentKeyValueListPair(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The key property + key: Optional[str] = None + # Select mode for search filters + select_mode: Optional[list[VectorSearchSelectOptionEnum]] = None + # The value property + value: Optional[list[str]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchDocumentKeyValueListPair: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchDocumentKeyValueListPair + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchDocumentKeyValueListPair() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_search_select_option_enum import VectorSearchSelectOptionEnum + + from .vector_search_select_option_enum import VectorSearchSelectOptionEnum + + fields: dict[str, Callable[[Any], None]] = { + "key": lambda n : setattr(self, 'key', n.get_str_value()), + "selectMode": lambda n : setattr(self, 'select_mode', n.get_collection_of_enum_values(VectorSearchSelectOptionEnum)), + "value": lambda n : setattr(self, 'value', n.get_collection_of_primitive_values(str)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("key", self.key) + writer.write_collection_of_enum_values("selectMode", self.select_mode) + writer.write_collection_of_primitive_values("value", self.value) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_filter.py new file mode 100644 index 00000000..147bd06a --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_filter.py @@ -0,0 +1,87 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .vector_key_value_list_pair import VectorKeyValueListPair + from .vector_search_configuration import VectorSearchConfiguration + from .vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair + from .vector_search_filter_filter import VectorSearchFilter_filter + +@dataclass +class VectorSearchFilter(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Restrict chunks considered during search to those with the given metadata. + chunk_metadata: Optional[list[VectorKeyValueListPair]] = None + # The collectionIds property + collection_ids: Optional[list[str]] = None + # Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*'] + collection_metadata: Optional[list[VectorKeyValueListPair]] = None + # The configuration property + configuration: Optional[VectorSearchConfiguration] = None + # Restrict documents considered during search to those annotated with the given metadata. + document_metadata: Optional[list[VectorSearchDocumentKeyValueListPair]] = None + # Advanced filter expression for combining metadata filters with boolean logic + filter: Optional[VectorSearchFilter_filter] = None + # Identifier of this VectorSearchFilter - unique per request. + id: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchFilter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchFilter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchFilter() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_key_value_list_pair import VectorKeyValueListPair + from .vector_search_configuration import VectorSearchConfiguration + from .vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair + from .vector_search_filter_filter import VectorSearchFilter_filter + + from .vector_key_value_list_pair import VectorKeyValueListPair + from .vector_search_configuration import VectorSearchConfiguration + from .vector_search_document_key_value_list_pair import VectorSearchDocumentKeyValueListPair + from .vector_search_filter_filter import VectorSearchFilter_filter + + fields: dict[str, Callable[[Any], None]] = { + "chunkMetadata": lambda n : setattr(self, 'chunk_metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + "collectionIds": lambda n : setattr(self, 'collection_ids', n.get_collection_of_primitive_values(str)), + "collectionMetadata": lambda n : setattr(self, 'collection_metadata', n.get_collection_of_object_values(VectorKeyValueListPair)), + "configuration": lambda n : setattr(self, 'configuration', n.get_object_value(VectorSearchConfiguration)), + "documentMetadata": lambda n : setattr(self, 'document_metadata', n.get_collection_of_object_values(VectorSearchDocumentKeyValueListPair)), + "filter": lambda n : setattr(self, 'filter', n.get_object_value(VectorSearchFilter_filter)), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("chunkMetadata", self.chunk_metadata) + writer.write_collection_of_primitive_values("collectionIds", self.collection_ids) + writer.write_collection_of_object_values("collectionMetadata", self.collection_metadata) + writer.write_object_value("configuration", self.configuration) + writer.write_collection_of_object_values("documentMetadata", self.document_metadata) + writer.write_object_value("filter", self.filter) + writer.write_str_value("id", self.id) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_filter_filter.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_filter_filter.py new file mode 100644 index 00000000..ada0c113 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_filter_filter.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .binary_boolean_filter import BinaryBooleanFilter + from .scoped_key_value_list_pair import ScopedKeyValueListPair + +@dataclass +class VectorSearchFilter_filter(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes BinaryBooleanFilter, ScopedKeyValueListPair + """ + # Composed type representation for type BinaryBooleanFilter + binary_boolean_filter: Optional[BinaryBooleanFilter] = None + # Composed type representation for type ScopedKeyValueListPair + scoped_key_value_list_pair: Optional[ScopedKeyValueListPair] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchFilter_filter: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchFilter_filter + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = VectorSearchFilter_filter() + from .binary_boolean_filter import BinaryBooleanFilter + + result.binary_boolean_filter = BinaryBooleanFilter() + from .scoped_key_value_list_pair import ScopedKeyValueListPair + + result.scoped_key_value_list_pair = ScopedKeyValueListPair() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .binary_boolean_filter import BinaryBooleanFilter + from .scoped_key_value_list_pair import ScopedKeyValueListPair + + if self.binary_boolean_filter or self.scoped_key_value_list_pair: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.binary_boolean_filter, self.scoped_key_value_list_pair) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.binary_boolean_filter, self.scoped_key_value_list_pair) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results.py new file mode 100644 index 00000000..9c047e47 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .vector_per_filter_search_result import VectorPerFilterSearchResult + +@dataclass +class VectorSearchResults(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of returned results. + results: Optional[list[VectorPerFilterSearchResult]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchResults: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchResults + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchResults() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .vector_per_filter_search_result import VectorPerFilterSearchResult + + from .vector_per_filter_search_result import VectorPerFilterSearchResult + + fields: dict[str, Callable[[Any], None]] = { + "results": lambda n : setattr(self, 'results', n.get_collection_of_object_values(VectorPerFilterSearchResult)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("results", self.results) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results400_error.py new file mode 100644 index 00000000..a101cc33 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class VectorSearchResults400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchResults400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchResults400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchResults400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results404_error.py new file mode 100644 index 00000000..0cf850e8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class VectorSearchResults404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchResults404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchResults404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchResults404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results422_error.py new file mode 100644 index 00000000..2191ed13 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_results422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class VectorSearchResults422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> VectorSearchResults422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: VectorSearchResults422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return VectorSearchResults422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_select_option_enum.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_select_option_enum.py new file mode 100644 index 00000000..9a1bd235 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/vector_search_select_option_enum.py @@ -0,0 +1,5 @@ +from enum import Enum + +class VectorSearchSelectOptionEnum(str, Enum): + IgnoreIfKeyAbsent = "ignoreIfKeyAbsent", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document400_error.py new file mode 100644 index 00000000..b0440302 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class WithDocument400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WithDocument400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WithDocument400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WithDocument400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document404_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document404_error.py new file mode 100644 index 00000000..9d1d4191 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document404_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class WithDocument404Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WithDocument404Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WithDocument404Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WithDocument404Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document422_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document422_error.py new file mode 100644 index 00000000..54a9d802 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_document422_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class WithDocument422Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WithDocument422Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WithDocument422Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WithDocument422Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_pipeline400_error.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_pipeline400_error.py new file mode 100644 index 00000000..824cbebd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/with_pipeline400_error.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .api_error import ApiError + +from .api_error import ApiError + +@dataclass +class WithPipeline400Error(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The error property + error: Optional[ApiError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WithPipeline400Error: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WithPipeline400Error + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WithPipeline400Error() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .api_error import ApiError + + from .api_error import ApiError + + fields: dict[str, Callable[[Any], None]] = { + "error": lambda n : setattr(self, 'error', n.get_object_value(ApiError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("error", self.error) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_create_request.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_create_request.py new file mode 100644 index 00000000..14c246c6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_create_request.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .meta_data import MetaData + from .work_zone_pipeline_create_request_type import WorkZonePipelineCreateRequest_type + +@dataclass +class WorkZonePipelineCreateRequest(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[WorkZonePipelineCreateRequest_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WorkZonePipelineCreateRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WorkZonePipelineCreateRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WorkZonePipelineCreateRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .meta_data import MetaData + from .work_zone_pipeline_create_request_type import WorkZonePipelineCreateRequest_type + + from .meta_data import MetaData + from .work_zone_pipeline_create_request_type import WorkZonePipelineCreateRequest_type + + fields: dict[str, Callable[[Any], None]] = { + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(MetaData)), + "type": lambda n : setattr(self, 'type', n.get_enum_value(WorkZonePipelineCreateRequest_type)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_create_request_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_create_request_type.py new file mode 100644 index 00000000..be26c269 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_create_request_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class WorkZonePipelineCreateRequest_type(str, Enum): + WorkZone = "WorkZone", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_get_response.py new file mode 100644 index 00000000..83fb5461 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_get_response.py @@ -0,0 +1,55 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_response import BasePipelineResponse + +from .base_pipeline_response import BasePipelineResponse + +@dataclass +class WorkZonePipelineGetResponse(BasePipelineResponse, Parsable): + # The metadata property + metadata: Optional[MetaData] = None + # The type property + type: Optional[WorkZonePipelineGetResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WorkZonePipelineGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WorkZonePipelineGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WorkZonePipelineGetResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_response import BasePipelineResponse + + from .base_pipeline_response import BasePipelineResponse + + fields: dict[str, Callable[[Any], None]] = { + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_get_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_get_response_type.py new file mode 100644 index 00000000..af5d7723 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_get_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class WorkZonePipelineGetResponse_type(str, Enum): + WorkZone = "WorkZone", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_minimal_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_minimal_response.py new file mode 100644 index 00000000..35f440ec --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_minimal_response.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .work_zone_pipeline_minimal_response_type import WorkZonePipelineMinimalResponse_type + +from .base_pipeline_minimal_response import BasePipelineMinimalResponse + +@dataclass +class WorkZonePipelineMinimalResponse(BasePipelineMinimalResponse, Parsable): + # The metadata property + metadata: Optional[bool] = None + # The type property + type: Optional[WorkZonePipelineMinimalResponse_type] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> WorkZonePipelineMinimalResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: WorkZonePipelineMinimalResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return WorkZonePipelineMinimalResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .work_zone_pipeline_minimal_response_type import WorkZonePipelineMinimalResponse_type + + from .base_pipeline_minimal_response import BasePipelineMinimalResponse + from .work_zone_pipeline_minimal_response_type import WorkZonePipelineMinimalResponse_type + + fields: dict[str, Callable[[Any], None]] = { + "metadata": lambda n : setattr(self, 'metadata', n.get_bool_value()), + "type": lambda n : setattr(self, 'type', n.get_enum_value(WorkZonePipelineMinimalResponse_type)), + } + super_fields = super().get_field_deserializers() + fields.update(super_fields) + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + super().serialize(writer) + writer.write_bool_value("metadata", self.metadata) + writer.write_enum_value("type", self.type) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_minimal_response_type.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_minimal_response_type.py new file mode 100644 index 00000000..28a3510c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/models/work_zone_pipeline_minimal_response_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class WorkZonePipelineMinimalResponse_type(str, Enum): + WorkZone = "WorkZone", + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/create_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/create_pipeline.py new file mode 100644 index 00000000..53ae6a0c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/create_pipeline.py @@ -0,0 +1,145 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from ..models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest + from ..models.metadata_configuration import MetadataConfiguration + from ..models.m_s_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest + from ..models.s3_pipeline_create_request import S3PipelineCreateRequest + from ..models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest + from ..models.s_d_m_pipeline_create_request import SDMPipelineCreateRequest + from ..models.s_f_t_p_pipeline_create_request import SFTPPipelineCreateRequest + from ..models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest + +@dataclass +class CreatePipeline(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes GoogleDrivePipelineCreateRequest, MetadataConfiguration, MSSharePointPipelineCreateRequest, S3PipelineCreateRequest, SDMPipelineCreateRequest, ServiceNowPipelineCreateRequest, SFTPPipelineCreateRequest, WorkZonePipelineCreateRequest + """ + # Composed type representation for type GoogleDrivePipelineCreateRequest + google_drive_pipeline_create_request: Optional[GoogleDrivePipelineCreateRequest] = None + # Composed type representation for type MSSharePointPipelineCreateRequest + m_s_share_point_pipeline_create_request: Optional[MSSharePointPipelineCreateRequest] = None + # Composed type representation for type MetadataConfiguration + metadata_configuration: Optional[MetadataConfiguration] = None + # Composed type representation for type SDMPipelineCreateRequest + s_d_m_pipeline_create_request: Optional[SDMPipelineCreateRequest] = None + # Composed type representation for type SFTPPipelineCreateRequest + s_f_t_p_pipeline_create_request: Optional[SFTPPipelineCreateRequest] = None + # Composed type representation for type S3PipelineCreateRequest + s3_pipeline_create_request: Optional[S3PipelineCreateRequest] = None + # Composed type representation for type ServiceNowPipelineCreateRequest + service_now_pipeline_create_request: Optional[ServiceNowPipelineCreateRequest] = None + # Composed type representation for type WorkZonePipelineCreateRequest + work_zone_pipeline_create_request: Optional[WorkZonePipelineCreateRequest] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CreatePipeline: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CreatePipeline + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("type") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = CreatePipeline() + if mapping_value and mapping_value.casefold() == "GoogleDrive".casefold(): + from ..models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest + + result.google_drive_pipeline_create_request = GoogleDrivePipelineCreateRequest() + elif mapping_value and mapping_value.casefold() == "MSSharePoint".casefold(): + from ..models.m_s_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest + + result.m_s_share_point_pipeline_create_request = MSSharePointPipelineCreateRequest() + elif mapping_value and mapping_value.casefold() == "metadata".casefold(): + from ..models.metadata_configuration import MetadataConfiguration + + result.metadata_configuration = MetadataConfiguration() + elif mapping_value and mapping_value.casefold() == "SDM".casefold(): + from ..models.s_d_m_pipeline_create_request import SDMPipelineCreateRequest + + result.s_d_m_pipeline_create_request = SDMPipelineCreateRequest() + elif mapping_value and mapping_value.casefold() == "SFTP".casefold(): + from ..models.s_f_t_p_pipeline_create_request import SFTPPipelineCreateRequest + + result.s_f_t_p_pipeline_create_request = SFTPPipelineCreateRequest() + elif mapping_value and mapping_value.casefold() == "S3".casefold(): + from ..models.s3_pipeline_create_request import S3PipelineCreateRequest + + result.s3_pipeline_create_request = S3PipelineCreateRequest() + elif mapping_value and mapping_value.casefold() == "ServiceNow".casefold(): + from ..models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest + + result.service_now_pipeline_create_request = ServiceNowPipelineCreateRequest() + elif mapping_value and mapping_value.casefold() == "WorkZone".casefold(): + from ..models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest + + result.work_zone_pipeline_create_request = WorkZonePipelineCreateRequest() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from ..models.google_drive_pipeline_create_request import GoogleDrivePipelineCreateRequest + from ..models.metadata_configuration import MetadataConfiguration + from ..models.m_s_share_point_pipeline_create_request import MSSharePointPipelineCreateRequest + from ..models.s3_pipeline_create_request import S3PipelineCreateRequest + from ..models.service_now_pipeline_create_request import ServiceNowPipelineCreateRequest + from ..models.s_d_m_pipeline_create_request import SDMPipelineCreateRequest + from ..models.s_f_t_p_pipeline_create_request import SFTPPipelineCreateRequest + from ..models.work_zone_pipeline_create_request import WorkZonePipelineCreateRequest + + if self.google_drive_pipeline_create_request: + return self.google_drive_pipeline_create_request.get_field_deserializers() + if self.m_s_share_point_pipeline_create_request: + return self.m_s_share_point_pipeline_create_request.get_field_deserializers() + if self.metadata_configuration: + return self.metadata_configuration.get_field_deserializers() + if self.s_d_m_pipeline_create_request: + return self.s_d_m_pipeline_create_request.get_field_deserializers() + if self.s_f_t_p_pipeline_create_request: + return self.s_f_t_p_pipeline_create_request.get_field_deserializers() + if self.s3_pipeline_create_request: + return self.s3_pipeline_create_request.get_field_deserializers() + if self.service_now_pipeline_create_request: + return self.service_now_pipeline_create_request.get_field_deserializers() + if self.work_zone_pipeline_create_request: + return self.work_zone_pipeline_create_request.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.google_drive_pipeline_create_request: + writer.write_object_value(None, self.google_drive_pipeline_create_request) + elif self.m_s_share_point_pipeline_create_request: + writer.write_object_value(None, self.m_s_share_point_pipeline_create_request) + elif self.metadata_configuration: + writer.write_object_value(None, self.metadata_configuration) + elif self.s_d_m_pipeline_create_request: + writer.write_object_value(None, self.s_d_m_pipeline_create_request) + elif self.s_f_t_p_pipeline_create_request: + writer.write_object_value(None, self.s_f_t_p_pipeline_create_request) + elif self.s3_pipeline_create_request: + writer.write_object_value(None, self.s3_pipeline_create_request) + elif self.service_now_pipeline_create_request: + writer.write_object_value(None, self.service_now_pipeline_create_request) + elif self.work_zone_pipeline_create_request: + writer.write_object_value(None, self.work_zone_pipeline_create_request) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/documents/documents_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/documents/documents_request_builder.py new file mode 100644 index 00000000..2d7b9197 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/documents/documents_request_builder.py @@ -0,0 +1,121 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.documents_status_response import DocumentsStatusResponse + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + +class DocumentsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/documents + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DocumentsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/documents{?%24count*,%24skip*,%24top*}", path_parameters) + + def by_document_id(self,document_id: str) -> WithDocumentItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.pipelines.item.documents.item collection + param document_id: The ID of the document to get. + Returns: WithDocumentItemRequestBuilder + """ + if document_id is None: + raise TypeError("document_id cannot be null.") + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["documentId"] = document_id + return WithDocumentItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> Optional[DocumentsStatusResponse]: + """ + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DocumentsStatusResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.documents_status_response import DocumentsStatusResponse + + return await self.request_adapter.send_async(request_info, DocumentsStatusResponse, None) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> DocumentsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DocumentsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DocumentsRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class DocumentsRequestBuilderGetQueryParameters(): + """ + Retrieve all documents associated with a specific pipeline. Optionally, filter the results using query parameters. + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class DocumentsRequestBuilderGetRequestConfiguration(RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/documents/item/with_document_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/documents/item/with_document_item_request_builder.py new file mode 100644 index 00000000..4aa947fd --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/documents/item/with_document_item_request_builder.py @@ -0,0 +1,75 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .....models.pipeline_document_response import PipelineDocumentResponse + +class WithDocumentItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/documents/{documentId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithDocumentItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/documents/{documentId}", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[PipelineDocumentResponse]: + """ + Retrieve details of a specific document associated with a pipeline. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[PipelineDocumentResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from .....models.pipeline_document_response import PipelineDocumentResponse + + return await self.request_adapter.send_async(request_info, PipelineDocumentResponse, None) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Retrieve details of a specific document associated with a pipeline. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithDocumentItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithDocumentItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithDocumentItemRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class WithDocumentItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/executions_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/executions_request_builder.py new file mode 100644 index 00000000..432e7599 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/executions_request_builder.py @@ -0,0 +1,126 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.get_pipeline_executions import GetPipelineExecutions + from .item.with_execution_item_request_builder import WithExecutionItemRequestBuilder + +class ExecutionsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/executions + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new ExecutionsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/executions{?%24count*,%24skip*,%24top*,lastExecution*}", path_parameters) + + def by_execution_id(self,execution_id: str) -> WithExecutionItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.pipelines.item.executions.item collection + param execution_id: The ID of the execution + Returns: WithExecutionItemRequestBuilder + """ + if execution_id is None: + raise TypeError("execution_id cannot be null.") + from .item.with_execution_item_request_builder import WithExecutionItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["executionId"] = execution_id + return WithExecutionItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[ExecutionsRequestBuilderGetQueryParameters]] = None) -> Optional[GetPipelineExecutions]: + """ + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[GetPipelineExecutions] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.get_pipeline_executions import GetPipelineExecutions + + return await self.request_adapter.send_async(request_info, GetPipelineExecutions, None) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[ExecutionsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> ExecutionsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: ExecutionsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return ExecutionsRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class ExecutionsRequestBuilderGetQueryParameters(): + """ + Retrieve all executions for a specific pipeline. Optionally, filter to get only the last execution. + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "last_execution": + return "lastExecution" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Filter to get the last execution + last_execution: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class ExecutionsRequestBuilderGetRequestConfiguration(RequestConfiguration[ExecutionsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/documents/documents_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/documents/documents_request_builder.py new file mode 100644 index 00000000..06359f2d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/documents/documents_request_builder.py @@ -0,0 +1,121 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ......models.documents_status_response import DocumentsStatusResponse + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + +class DocumentsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/executions/{executionId}/documents + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DocumentsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/executions/{executionId}/documents{?%24count*,%24skip*,%24top*}", path_parameters) + + def by_document_id(self,document_id: str) -> WithDocumentItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.pipelines.item.executions.item.documents.item collection + param document_id: The ID of the document to get. + Returns: WithDocumentItemRequestBuilder + """ + if document_id is None: + raise TypeError("document_id cannot be null.") + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["documentId"] = document_id + return WithDocumentItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> Optional[DocumentsStatusResponse]: + """ + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DocumentsStatusResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from ......models.documents_status_response import DocumentsStatusResponse + + return await self.request_adapter.send_async(request_info, DocumentsStatusResponse, None) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> DocumentsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DocumentsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DocumentsRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class DocumentsRequestBuilderGetQueryParameters(): + """ + Retrieve all documents associated with a specific pipeline execution. Optionally, filter the results using query parameters. + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class DocumentsRequestBuilderGetRequestConfiguration(RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/documents/item/with_document_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/documents/item/with_document_item_request_builder.py new file mode 100644 index 00000000..7a8a008f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/documents/item/with_document_item_request_builder.py @@ -0,0 +1,75 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .......models.pipeline_document_response import PipelineDocumentResponse + +class WithDocumentItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/executions/{executionId}/documents/{documentId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithDocumentItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/executions/{executionId}/documents/{documentId}", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[PipelineDocumentResponse]: + """ + Retrieve details of a specific document associated with a pipeline execution. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[PipelineDocumentResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from .......models.pipeline_document_response import PipelineDocumentResponse + + return await self.request_adapter.send_async(request_info, PipelineDocumentResponse, None) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Retrieve details of a specific document associated with a pipeline execution. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithDocumentItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithDocumentItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithDocumentItemRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class WithDocumentItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/with_execution_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/with_execution_item_request_builder.py new file mode 100644 index 00000000..d3926937 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/executions/item/with_execution_item_request_builder.py @@ -0,0 +1,85 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .....models.get_pipeline_execution_by_id import GetPipelineExecutionById + from .documents.documents_request_builder import DocumentsRequestBuilder + +class WithExecutionItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/executions/{executionId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithExecutionItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/executions/{executionId}", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[GetPipelineExecutionById]: + """ + Retrieve details of a specific pipeline execution by its execution ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[GetPipelineExecutionById] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from .....models.get_pipeline_execution_by_id import GetPipelineExecutionById + + return await self.request_adapter.send_async(request_info, GetPipelineExecutionById, None) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Retrieve details of a specific pipeline execution by its execution ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithExecutionItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithExecutionItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithExecutionItemRequestBuilder(self.request_adapter, raw_url) + + @property + def documents(self) -> DocumentsRequestBuilder: + """ + The documents property + """ + from .documents.documents_request_builder import DocumentsRequestBuilder + + return DocumentsRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class WithExecutionItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/get_pipeline.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/get_pipeline.py new file mode 100644 index 00000000..0b44b0f1 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/get_pipeline.py @@ -0,0 +1,133 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from ...models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse + from ...models.m_s_share_point_pipeline_get_response import MSSharePointPipelineGetResponse + from ...models.s3_pipeline_get_response import S3PipelineGetResponse + from ...models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse + from ...models.s_d_m_pipeline_get_response import SDMPipelineGetResponse + from ...models.s_f_t_p_pipeline_get_response import SFTPPipelineGetResponse + from ...models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse + +@dataclass +class GetPipeline(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes GoogleDrivePipelineGetResponse, MSSharePointPipelineGetResponse, S3PipelineGetResponse, SDMPipelineGetResponse, ServiceNowPipelineGetResponse, SFTPPipelineGetResponse, WorkZonePipelineGetResponse + """ + # Composed type representation for type GoogleDrivePipelineGetResponse + google_drive_pipeline_get_response: Optional[GoogleDrivePipelineGetResponse] = None + # Composed type representation for type MSSharePointPipelineGetResponse + m_s_share_point_pipeline_get_response: Optional[MSSharePointPipelineGetResponse] = None + # Composed type representation for type SDMPipelineGetResponse + s_d_m_pipeline_get_response: Optional[SDMPipelineGetResponse] = None + # Composed type representation for type SFTPPipelineGetResponse + s_f_t_p_pipeline_get_response: Optional[SFTPPipelineGetResponse] = None + # Composed type representation for type S3PipelineGetResponse + s3_pipeline_get_response: Optional[S3PipelineGetResponse] = None + # Composed type representation for type ServiceNowPipelineGetResponse + service_now_pipeline_get_response: Optional[ServiceNowPipelineGetResponse] = None + # Composed type representation for type WorkZonePipelineGetResponse + work_zone_pipeline_get_response: Optional[WorkZonePipelineGetResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> GetPipeline: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: GetPipeline + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("type") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = GetPipeline() + if mapping_value and mapping_value.casefold() == "GoogleDrive".casefold(): + from ...models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse + + result.google_drive_pipeline_get_response = GoogleDrivePipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "MSSharePoint".casefold(): + from ...models.m_s_share_point_pipeline_get_response import MSSharePointPipelineGetResponse + + result.m_s_share_point_pipeline_get_response = MSSharePointPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "SDM".casefold(): + from ...models.s_d_m_pipeline_get_response import SDMPipelineGetResponse + + result.s_d_m_pipeline_get_response = SDMPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "SFTP".casefold(): + from ...models.s_f_t_p_pipeline_get_response import SFTPPipelineGetResponse + + result.s_f_t_p_pipeline_get_response = SFTPPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "S3".casefold(): + from ...models.s3_pipeline_get_response import S3PipelineGetResponse + + result.s3_pipeline_get_response = S3PipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "ServiceNow".casefold(): + from ...models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse + + result.service_now_pipeline_get_response = ServiceNowPipelineGetResponse() + elif mapping_value and mapping_value.casefold() == "WorkZone".casefold(): + from ...models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse + + result.work_zone_pipeline_get_response = WorkZonePipelineGetResponse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from ...models.google_drive_pipeline_get_response import GoogleDrivePipelineGetResponse + from ...models.m_s_share_point_pipeline_get_response import MSSharePointPipelineGetResponse + from ...models.s3_pipeline_get_response import S3PipelineGetResponse + from ...models.service_now_pipeline_get_response import ServiceNowPipelineGetResponse + from ...models.s_d_m_pipeline_get_response import SDMPipelineGetResponse + from ...models.s_f_t_p_pipeline_get_response import SFTPPipelineGetResponse + from ...models.work_zone_pipeline_get_response import WorkZonePipelineGetResponse + + if self.google_drive_pipeline_get_response: + return self.google_drive_pipeline_get_response.get_field_deserializers() + if self.m_s_share_point_pipeline_get_response: + return self.m_s_share_point_pipeline_get_response.get_field_deserializers() + if self.s_d_m_pipeline_get_response: + return self.s_d_m_pipeline_get_response.get_field_deserializers() + if self.s_f_t_p_pipeline_get_response: + return self.s_f_t_p_pipeline_get_response.get_field_deserializers() + if self.s3_pipeline_get_response: + return self.s3_pipeline_get_response.get_field_deserializers() + if self.service_now_pipeline_get_response: + return self.service_now_pipeline_get_response.get_field_deserializers() + if self.work_zone_pipeline_get_response: + return self.work_zone_pipeline_get_response.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.google_drive_pipeline_get_response: + writer.write_object_value(None, self.google_drive_pipeline_get_response) + elif self.m_s_share_point_pipeline_get_response: + writer.write_object_value(None, self.m_s_share_point_pipeline_get_response) + elif self.s_d_m_pipeline_get_response: + writer.write_object_value(None, self.s_d_m_pipeline_get_response) + elif self.s_f_t_p_pipeline_get_response: + writer.write_object_value(None, self.s_f_t_p_pipeline_get_response) + elif self.s3_pipeline_get_response: + writer.write_object_value(None, self.s3_pipeline_get_response) + elif self.service_now_pipeline_get_response: + writer.write_object_value(None, self.service_now_pipeline_get_response) + elif self.work_zone_pipeline_get_response: + writer.write_object_value(None, self.work_zone_pipeline_get_response) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/status/status_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/status/status_request_builder.py new file mode 100644 index 00000000..6664b8fc --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/status/status_request_builder.py @@ -0,0 +1,81 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.get_pipeline_status import GetPipelineStatus + from ....models.get_pipeline_status400_error import GetPipelineStatus400Error + +class StatusRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId}/status + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new StatusRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}/status", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[GetPipelineStatus]: + """ + Get pipeline status by pipeline id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[GetPipelineStatus] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ....models.get_pipeline_status400_error import GetPipelineStatus400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": GetPipelineStatus400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.get_pipeline_status import GetPipelineStatus + + return await self.request_adapter.send_async(request_info, GetPipelineStatus, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Get pipeline status by pipeline id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> StatusRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: StatusRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return StatusRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class StatusRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/with_pipeline_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/with_pipeline_item_request_builder.py new file mode 100644 index 00000000..e2ef697b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/item/with_pipeline_item_request_builder.py @@ -0,0 +1,195 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ...models.get_pipeline400_error import GetPipeline400Error + from ...models.patch_pipeline import PatchPipeline + from ...models.with_pipeline400_error import WithPipeline400Error + from .documents.documents_request_builder import DocumentsRequestBuilder + from .executions.executions_request_builder import ExecutionsRequestBuilder + from .get_pipeline import GetPipeline + from .status.status_request_builder import StatusRequestBuilder + +class WithPipelineItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/{pipelineId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithPipelineItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/{pipelineId}", path_parameters) + + async def delete(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Delete a pipeline by pipeline id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + request_info = self.to_delete_request_information( + request_configuration + ) + from ...models.get_pipeline400_error import GetPipeline400Error + from ...models.with_pipeline400_error import WithPipeline400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": WithPipeline400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[GetPipeline]: + """ + Get details of a pipeline by pipeline id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[GetPipeline] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ...models.get_pipeline400_error import GetPipeline400Error + from ...models.with_pipeline400_error import WithPipeline400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": GetPipeline400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .get_pipeline import GetPipeline + + return await self.request_adapter.send_async(request_info, GetPipeline, error_mapping) + + async def patch(self,body: PatchPipeline, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Patch a pipeline by pipeline id + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_patch_request_information( + body, request_configuration + ) + from ...models.get_pipeline400_error import GetPipeline400Error + from ...models.with_pipeline400_error import WithPipeline400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": WithPipeline400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + def to_delete_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Delete a pipeline by pipeline id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.DELETE, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Get details of a pipeline by pipeline id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_patch_request_information(self,body: PatchPipeline, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Patch a pipeline by pipeline id + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> WithPipelineItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithPipelineItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithPipelineItemRequestBuilder(self.request_adapter, raw_url) + + @property + def documents(self) -> DocumentsRequestBuilder: + """ + The documents property + """ + from .documents.documents_request_builder import DocumentsRequestBuilder + + return DocumentsRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def executions(self) -> ExecutionsRequestBuilder: + """ + The executions property + """ + from .executions.executions_request_builder import ExecutionsRequestBuilder + + return ExecutionsRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def status(self) -> StatusRequestBuilder: + """ + The status property + """ + from .status.status_request_builder import StatusRequestBuilder + + return StatusRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class WithPipelineItemRequestBuilderDeleteRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class WithPipelineItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class WithPipelineItemRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/configurations_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/configurations_request_builder.py new file mode 100644 index 00000000..793a1033 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/configurations_request_builder.py @@ -0,0 +1,174 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.configurations400_error import Configurations400Error + from ....models.list_metadata_configurations import ListMetadataConfigurations + from ....models.list_metadata_configurations400_error import ListMetadataConfigurations400Error + from ....models.metadata_configuration_request import MetadataConfigurationRequest + from .item.with_metadata_config_item_request_builder import WithMetadataConfigItemRequestBuilder + +class ConfigurationsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/metadata/configurations + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new ConfigurationsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/metadata/configurations{?%24count*,%24skip*,%24top*}", path_parameters) + + def by_metadata_config_id(self,metadata_config_id: str) -> WithMetadataConfigItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.pipelines.metadata.configurations.item collection + param metadata_config_id: Metadata Configuration ID + Returns: WithMetadataConfigItemRequestBuilder + """ + if metadata_config_id is None: + raise TypeError("metadata_config_id cannot be null.") + from .item.with_metadata_config_item_request_builder import WithMetadataConfigItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["metadataConfigId"] = metadata_config_id + return WithMetadataConfigItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[ConfigurationsRequestBuilderGetQueryParameters]] = None) -> Optional[ListMetadataConfigurations]: + """ + List all metadata configurations + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[ListMetadataConfigurations] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ....models.configurations400_error import Configurations400Error + from ....models.list_metadata_configurations400_error import ListMetadataConfigurations400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": ListMetadataConfigurations400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.list_metadata_configurations import ListMetadataConfigurations + + return await self.request_adapter.send_async(request_info, ListMetadataConfigurations, error_mapping) + + async def post(self,body: MetadataConfigurationRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Creates a new metadata configuration. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ....models.configurations400_error import Configurations400Error + from ....models.list_metadata_configurations400_error import ListMetadataConfigurations400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": Configurations400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[ConfigurationsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + List all metadata configurations + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_post_request_information(self,body: MetadataConfigurationRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Creates a new metadata configuration. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> ConfigurationsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: ConfigurationsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return ConfigurationsRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class ConfigurationsRequestBuilderGetQueryParameters(): + """ + List all metadata configurations + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class ConfigurationsRequestBuilderGetRequestConfiguration(RequestConfiguration[ConfigurationsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class ConfigurationsRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/batch_update_documents_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/batch_update_documents_response.py new file mode 100644 index 00000000..a8b20f0c --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/batch_update_documents_response.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from ......models.document_metadata_update import DocumentMetadataUpdate + from ......models.document_metadata_update_error import DocumentMetadataUpdateError + +@dataclass +class BatchUpdateDocumentsResponse(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes DocumentMetadataUpdate, DocumentMetadataUpdateError + """ + # Composed type representation for type DocumentMetadataUpdate + document_metadata_update: Optional[DocumentMetadataUpdate] = None + # Composed type representation for type DocumentMetadataUpdateError + document_metadata_update_error: Optional[DocumentMetadataUpdateError] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> BatchUpdateDocumentsResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: BatchUpdateDocumentsResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = BatchUpdateDocumentsResponse() + if mapping_value and mapping_value.casefold() == "DocumentMetadataUpdate".casefold(): + from ......models.document_metadata_update import DocumentMetadataUpdate + + result.document_metadata_update = DocumentMetadataUpdate() + elif mapping_value and mapping_value.casefold() == "DocumentMetadataUpdateError".casefold(): + from ......models.document_metadata_update_error import DocumentMetadataUpdateError + + result.document_metadata_update_error = DocumentMetadataUpdateError() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from ......models.document_metadata_update import DocumentMetadataUpdate + from ......models.document_metadata_update_error import DocumentMetadataUpdateError + + if self.document_metadata_update: + return self.document_metadata_update.get_field_deserializers() + if self.document_metadata_update_error: + return self.document_metadata_update_error.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.document_metadata_update: + writer.write_object_value(None, self.document_metadata_update) + elif self.document_metadata_update_error: + writer.write_object_value(None, self.document_metadata_update_error) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/documents_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/documents_request_builder.py new file mode 100644 index 00000000..dc47466b --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/documents_request_builder.py @@ -0,0 +1,174 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ......models.batch_update_documents_response400_error import BatchUpdateDocumentsResponse400Error + from ......models.document_metadata_batch_request import DocumentMetadataBatchRequest + from ......models.list_configuration_documents import ListConfigurationDocuments + from .batch_update_documents_response import BatchUpdateDocumentsResponse + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + +class DocumentsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/metadata/configurations/{metadataConfigId}/documents + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DocumentsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/metadata/configurations/{metadataConfigId}/documents{?%24count*,%24skip*,%24top*,absolutePath*}", path_parameters) + + def by_document_id(self,document_id: str) -> WithDocumentItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.pipelines.metadata.configurations.item.documents.item collection + param document_id: Document ID + Returns: WithDocumentItemRequestBuilder + """ + if document_id is None: + raise TypeError("document_id cannot be null.") + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["documentId"] = document_id + return WithDocumentItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> Optional[ListConfigurationDocuments]: + """ + List the documents for a configuration + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[ListConfigurationDocuments] + """ + request_info = self.to_get_request_information( + request_configuration + ) + if not self.request_adapter: + raise Exception("Http core is null") + from ......models.list_configuration_documents import ListConfigurationDocuments + + return await self.request_adapter.send_async(request_info, ListConfigurationDocuments, None) + + async def patch(self,body: DocumentMetadataBatchRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[list[BatchUpdateDocumentsResponse]]: + """ + Patch the documents of a configuration in batch + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[list[BatchUpdateDocumentsResponse]] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_patch_request_information( + body, request_configuration + ) + from ......models.batch_update_documents_response400_error import BatchUpdateDocumentsResponse400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": BatchUpdateDocumentsResponse400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .batch_update_documents_response import BatchUpdateDocumentsResponse + + return await self.request_adapter.send_collection_async(request_info, BatchUpdateDocumentsResponse, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + List the documents for a configuration + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_patch_request_information(self,body: DocumentMetadataBatchRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Patch the documents of a configuration in batch + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/merge-patch+json", body) + return request_info + + def with_url(self,raw_url: str) -> DocumentsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DocumentsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DocumentsRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class DocumentsRequestBuilderGetQueryParameters(): + """ + List the documents for a configuration + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "absolute_path": + return "absolutePath" + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # Absolute path of the resource. Supports wildcard values (e.g., `/folder/*`). + absolute_path: Optional[str] = None + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class DocumentsRequestBuilderGetRequestConfiguration(RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class DocumentsRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/item/with_document_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/item/with_document_item_request_builder.py new file mode 100644 index 00000000..163cf847 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/documents/item/with_document_item_request_builder.py @@ -0,0 +1,81 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .......models.configuration_document import ConfigurationDocument + from .......models.configuration_document400_error import ConfigurationDocument400Error + +class WithDocumentItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/metadata/configurations/{metadataConfigId}/documents/{documentId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithDocumentItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/metadata/configurations/{metadataConfigId}/documents/{documentId}", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[ConfigurationDocument]: + """ + Get the details of a document by document id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[ConfigurationDocument] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from .......models.configuration_document400_error import ConfigurationDocument400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": ConfigurationDocument400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .......models.configuration_document import ConfigurationDocument + + return await self.request_adapter.send_async(request_info, ConfigurationDocument, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Get the details of a document by document id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithDocumentItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithDocumentItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithDocumentItemRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class WithDocumentItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/with_metadata_config_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/with_metadata_config_item_request_builder.py new file mode 100644 index 00000000..2044634e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/configurations/item/with_metadata_config_item_request_builder.py @@ -0,0 +1,132 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .....models.error_response import ErrorResponse + from .....models.metadata_configuration_response import MetadataConfigurationResponse + from .....models.metadata_configuration_response400_error import MetadataConfigurationResponse400Error + from .documents.documents_request_builder import DocumentsRequestBuilder + +class WithMetadataConfigItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/metadata/configurations/{metadataConfigId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithMetadataConfigItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/metadata/configurations/{metadataConfigId}", path_parameters) + + async def delete(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Delete a metadata configuration by ID + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + request_info = self.to_delete_request_information( + request_configuration + ) + from .....models.error_response import ErrorResponse + from .....models.metadata_configuration_response400_error import MetadataConfigurationResponse400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "404": ErrorResponse, + "409": ErrorResponse, + "500": ErrorResponse, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[MetadataConfigurationResponse]: + """ + Get the details of a configuration by ID + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[MetadataConfigurationResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from .....models.error_response import ErrorResponse + from .....models.metadata_configuration_response400_error import MetadataConfigurationResponse400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": MetadataConfigurationResponse400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .....models.metadata_configuration_response import MetadataConfigurationResponse + + return await self.request_adapter.send_async(request_info, MetadataConfigurationResponse, error_mapping) + + def to_delete_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Delete a metadata configuration by ID + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.DELETE, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Get the details of a configuration by ID + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithMetadataConfigItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithMetadataConfigItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithMetadataConfigItemRequestBuilder(self.request_adapter, raw_url) + + @property + def documents(self) -> DocumentsRequestBuilder: + """ + The documents property + """ + from .documents.documents_request_builder import DocumentsRequestBuilder + + return DocumentsRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class WithMetadataConfigItemRequestBuilderDeleteRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class WithMetadataConfigItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/metadata_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/metadata_request_builder.py new file mode 100644 index 00000000..48dc9562 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/metadata/metadata_request_builder.py @@ -0,0 +1,33 @@ +from __future__ import annotations +from collections.abc import Callable +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.request_adapter import RequestAdapter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .configurations.configurations_request_builder import ConfigurationsRequestBuilder + +class MetadataRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/metadata + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new MetadataRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/metadata", path_parameters) + + @property + def configurations(self) -> ConfigurationsRequestBuilder: + """ + The configurations property + """ + from .configurations.configurations_request_builder import ConfigurationsRequestBuilder + + return ConfigurationsRequestBuilder(self.request_adapter, self.path_parameters) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/pipelines_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/pipelines_request_builder.py new file mode 100644 index 00000000..145a120e --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/pipelines_request_builder.py @@ -0,0 +1,212 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ..models.get_pipelines import GetPipelines + from ..models.get_pipelines400_error import GetPipelines400Error + from ..models.pipeline_id import PipelineId + from ..models.pipeline_id400_error import PipelineId400Error + from .create_pipeline import CreatePipeline + from .item.with_pipeline_item_request_builder import WithPipelineItemRequestBuilder + from .metadata.metadata_request_builder import MetadataRequestBuilder + from .search.search_request_builder import SearchRequestBuilder + from .trigger.trigger_request_builder import TriggerRequestBuilder + +class PipelinesRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new PipelinesRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines{?%24count*,%24skip*,%24top*,metadataConfigId*}", path_parameters) + + def by_pipeline_id(self,pipeline_id: str) -> WithPipelineItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.pipelines.item collection + param pipeline_id: The ID of the pipeline to get. + Returns: WithPipelineItemRequestBuilder + """ + if pipeline_id is None: + raise TypeError("pipeline_id cannot be null.") + from .item.with_pipeline_item_request_builder import WithPipelineItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["pipelineId"] = pipeline_id + return WithPipelineItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[PipelinesRequestBuilderGetQueryParameters]] = None) -> Optional[GetPipelines]: + """ + Get all pipelines + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[GetPipelines] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ..models.get_pipelines400_error import GetPipelines400Error + from ..models.pipeline_id400_error import PipelineId400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": GetPipelines400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ..models.get_pipelines import GetPipelines + + return await self.request_adapter.send_async(request_info, GetPipelines, error_mapping) + + async def post(self,body: CreatePipeline, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[PipelineId]: + """ + Create a pipeline + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[PipelineId] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ..models.get_pipelines400_error import GetPipelines400Error + from ..models.pipeline_id400_error import PipelineId400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": PipelineId400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ..models.pipeline_id import PipelineId + + return await self.request_adapter.send_async(request_info, PipelineId, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[PipelinesRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + Get all pipelines + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_post_request_information(self,body: CreatePipeline, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Create a pipeline + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> PipelinesRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: PipelinesRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return PipelinesRequestBuilder(self.request_adapter, raw_url) + + @property + def metadata(self) -> MetadataRequestBuilder: + """ + The metadata property + """ + from .metadata.metadata_request_builder import MetadataRequestBuilder + + return MetadataRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def search(self) -> SearchRequestBuilder: + """ + The search property + """ + from .search.search_request_builder import SearchRequestBuilder + + return SearchRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def trigger(self) -> TriggerRequestBuilder: + """ + The trigger property + """ + from .trigger.trigger_request_builder import TriggerRequestBuilder + + return TriggerRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class PipelinesRequestBuilderGetQueryParameters(): + """ + Get all pipelines + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "metadata_config_id": + return "metadataConfigId" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Filter pipelines based on metadataConfigId + metadata_config_id: Optional[str] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class PipelinesRequestBuilderGetRequestConfiguration(RequestConfiguration[PipelinesRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class PipelinesRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/search/search_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/search/search_request_builder.py new file mode 100644 index 00000000..eea718c3 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/search/search_request_builder.py @@ -0,0 +1,120 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ...models.search_pipeline import SearchPipeline + from ...models.search_pipelines_response import SearchPipelinesResponse + from ...models.search_pipelines_response400_error import SearchPipelinesResponse400Error + +class SearchRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/search + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new SearchRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/search{?%24count*,%24skip*,%24top*}", path_parameters) + + async def post(self,body: SearchPipeline, request_configuration: Optional[RequestConfiguration[SearchRequestBuilderPostQueryParameters]] = None) -> Optional[SearchPipelinesResponse]: + """ + Search for pipelines based on metadata + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[SearchPipelinesResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ...models.search_pipelines_response400_error import SearchPipelinesResponse400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": SearchPipelinesResponse400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ...models.search_pipelines_response import SearchPipelinesResponse + + return await self.request_adapter.send_async(request_info, SearchPipelinesResponse, error_mapping) + + def to_post_request_information(self,body: SearchPipeline, request_configuration: Optional[RequestConfiguration[SearchRequestBuilderPostQueryParameters]] = None) -> RequestInformation: + """ + Search for pipelines based on metadata + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> SearchRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: SearchRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return SearchRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class SearchRequestBuilderPostQueryParameters(): + """ + Search for pipelines based on metadata + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class SearchRequestBuilderPostRequestConfiguration(RequestConfiguration[SearchRequestBuilderPostQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/trigger/trigger_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/trigger/trigger_request_builder.py new file mode 100644 index 00000000..ec65e6e9 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/pipelines/trigger/trigger_request_builder.py @@ -0,0 +1,86 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ...models.manual_pipeline_trigger import ManualPipelineTrigger + from ...models.trigger400_error import Trigger400Error + +class TriggerRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /pipelines/trigger + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new TriggerRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/pipelines/trigger", path_parameters) + + async def post(self,body: ManualPipelineTrigger, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Manually trigger a pipeline + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ...models.trigger400_error import Trigger400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": Trigger400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + def to_post_request_information(self,body: ManualPipelineTrigger, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Manually trigger a pipeline + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> TriggerRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: TriggerRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return TriggerRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class TriggerRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/py.typed b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/data_repositories/data_repositories_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/data_repositories/data_repositories_request_builder.py new file mode 100644 index 00000000..22382a08 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/data_repositories/data_repositories_request_builder.py @@ -0,0 +1,128 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID +from warnings import warn + +if TYPE_CHECKING: + from ...models.data_repositories import DataRepositories + from ...models.data_repositories400_error import DataRepositories400Error + from .item.with_repository_item_request_builder import WithRepositoryItemRequestBuilder + +class DataRepositoriesRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /retrieval/dataRepositories + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DataRepositoriesRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/retrieval/dataRepositories{?%24count*,%24skip*,%24top*}", path_parameters) + + def by_repository_id(self,repository_id: UUID) -> WithRepositoryItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.retrieval.dataRepositories.item collection + param repository_id: Repository ID + Returns: WithRepositoryItemRequestBuilder + """ + if repository_id is None: + raise TypeError("repository_id cannot be null.") + from .item.with_repository_item_request_builder import WithRepositoryItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["repositoryId"] = repository_id + return WithRepositoryItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[DataRepositoriesRequestBuilderGetQueryParameters]] = None) -> Optional[DataRepositories]: + """ + List all Data Repositories + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DataRepositories] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ...models.data_repositories400_error import DataRepositories400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DataRepositories400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ...models.data_repositories import DataRepositories + + return await self.request_adapter.send_async(request_info, DataRepositories, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[DataRepositoriesRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + List all Data Repositories + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> DataRepositoriesRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DataRepositoriesRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DataRepositoriesRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class DataRepositoriesRequestBuilderGetQueryParameters(): + """ + List all Data Repositories + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class DataRepositoriesRequestBuilderGetRequestConfiguration(RequestConfiguration[DataRepositoriesRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/data_repositories/item/with_repository_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/data_repositories/item/with_repository_item_request_builder.py new file mode 100644 index 00000000..f81e72fb --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/data_repositories/item/with_repository_item_request_builder.py @@ -0,0 +1,108 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.data_repository import DataRepository + from ....models.data_repository400_error import DataRepository400Error + from ....models.data_repository404_error import DataRepository404Error + from ....models.data_repository422_error import DataRepository422Error + +class WithRepositoryItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /retrieval/dataRepositories/{repositoryId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithRepositoryItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/retrieval/dataRepositories/{repositoryId}{?remoteName*}", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[WithRepositoryItemRequestBuilderGetQueryParameters]] = None) -> Optional[DataRepository]: + """ + List data repository by id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DataRepository] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ....models.data_repository400_error import DataRepository400Error + from ....models.data_repository404_error import DataRepository404Error + from ....models.data_repository422_error import DataRepository422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DataRepository400Error, + "404": DataRepository404Error, + "422": DataRepository422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.data_repository import DataRepository + + return await self.request_adapter.send_async(request_info, DataRepository, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[WithRepositoryItemRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + List data repository by id + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithRepositoryItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithRepositoryItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithRepositoryItemRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class WithRepositoryItemRequestBuilderGetQueryParameters(): + """ + List data repository by id + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "remote_name": + return "remoteName" + return original_name + + # Remote name if DataRepository is from remote DG. + remote_name: Optional[str] = None + + + @dataclass + class WithRepositoryItemRequestBuilderGetRequestConfiguration(RequestConfiguration[WithRepositoryItemRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/retrieval_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/retrieval_request_builder.py new file mode 100644 index 00000000..8da679f5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/retrieval_request_builder.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.request_adapter import RequestAdapter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .data_repositories.data_repositories_request_builder import DataRepositoriesRequestBuilder + from .search.search_request_builder import SearchRequestBuilder + +class RetrievalRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /retrieval + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new RetrievalRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/retrieval", path_parameters) + + @property + def data_repositories(self) -> DataRepositoriesRequestBuilder: + """ + The dataRepositories property + """ + from .data_repositories.data_repositories_request_builder import DataRepositoriesRequestBuilder + + return DataRepositoriesRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def search(self) -> SearchRequestBuilder: + """ + The search property + """ + from .search.search_request_builder import SearchRequestBuilder + + return SearchRequestBuilder(self.request_adapter, self.path_parameters) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/search/search_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/search/search_request_builder.py new file mode 100644 index 00000000..e080aa8d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/retrieval/search/search_request_builder.py @@ -0,0 +1,92 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ...models.retrieval_search_input import RetrievalSearchInput + from ...models.retrieval_search_results import RetrievalSearchResults + from ...models.retrieval_search_results400_error import RetrievalSearchResults400Error + from ...models.retrieval_search_results422_error import RetrievalSearchResults422Error + +class SearchRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /retrieval/search + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new SearchRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/retrieval/search", path_parameters) + + async def post(self,body: RetrievalSearchInput, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[RetrievalSearchResults]: + """ + Retrieve relevant content given a query string. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[RetrievalSearchResults] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ...models.retrieval_search_results400_error import RetrievalSearchResults400Error + from ...models.retrieval_search_results422_error import RetrievalSearchResults422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": RetrievalSearchResults400Error, + "422": RetrievalSearchResults422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ...models.retrieval_search_results import RetrievalSearchResults + + return await self.request_adapter.send_async(request_info, RetrievalSearchResults, error_mapping) + + def to_post_request_information(self,body: RetrievalSearchInput, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Retrieve relevant content given a query string. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> SearchRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: SearchRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return SearchRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class SearchRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/chunks/chunks_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/chunks/chunks_request_builder.py new file mode 100644 index 00000000..8160c539 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/chunks/chunks_request_builder.py @@ -0,0 +1,33 @@ +from __future__ import annotations +from collections.abc import Callable +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.request_adapter import RequestAdapter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .metadata.metadata_request_builder import MetadataRequestBuilder + +class ChunksRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/chunks + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new ChunksRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/chunks", path_parameters) + + @property + def metadata(self) -> MetadataRequestBuilder: + """ + The metadata property + """ + from .metadata.metadata_request_builder import MetadataRequestBuilder + + return MetadataRequestBuilder(self.request_adapter, self.path_parameters) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/chunks/metadata/metadata_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/chunks/metadata/metadata_request_builder.py new file mode 100644 index 00000000..30bac6fe --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/chunks/metadata/metadata_request_builder.py @@ -0,0 +1,95 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.metadata_response import MetadataResponse + from ....models.metadata_response400_error import MetadataResponse400Error + from ....models.metadata_response404_error import MetadataResponse404Error + from ....models.metadata_response422_error import MetadataResponse422Error + from ....models.metadata_updates import MetadataUpdates + +class MetadataRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/chunks/metadata + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new MetadataRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/chunks/metadata", path_parameters) + + async def patch(self,body: MetadataUpdates, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[MetadataResponse]: + """ + Allows to add, remove and modify the chunks metadata. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[MetadataResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_patch_request_information( + body, request_configuration + ) + from ....models.metadata_response400_error import MetadataResponse400Error + from ....models.metadata_response404_error import MetadataResponse404Error + from ....models.metadata_response422_error import MetadataResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": MetadataResponse400Error, + "404": MetadataResponse404Error, + "422": MetadataResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.metadata_response import MetadataResponse + + return await self.request_adapter.send_async(request_info, MetadataResponse, error_mapping) + + def to_patch_request_information(self,body: MetadataUpdates, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Allows to add, remove and modify the chunks metadata. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> MetadataRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: MetadataRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return MetadataRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class MetadataRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/collections_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/collections_request_builder.py new file mode 100644 index 00000000..4bebe8a6 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/collections_request_builder.py @@ -0,0 +1,189 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID +from warnings import warn + +if TYPE_CHECKING: + from ...models.collections400_error import Collections400Error + from ...models.collections422_error import Collections422Error + from ...models.collections_list_response import CollectionsListResponse + from ...models.collections_list_response400_error import CollectionsListResponse400Error + from ...models.collection_request import CollectionRequest + from .item.collection_item_request_builder import CollectionItemRequestBuilder + from .metadata.metadata_request_builder import MetadataRequestBuilder + +class CollectionsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new CollectionsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections{?%24count*,%24skip*,%24top*}", path_parameters) + + def by_collection_id(self,collection_id: UUID) -> CollectionItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.vector.collections.item collection + param collection_id: Collection ID + Returns: CollectionItemRequestBuilder + """ + if collection_id is None: + raise TypeError("collection_id cannot be null.") + from .item.collection_item_request_builder import CollectionItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["collection%2Did"] = collection_id + return CollectionItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[CollectionsRequestBuilderGetQueryParameters]] = None) -> Optional[CollectionsListResponse]: + """ + Gets a list of collections. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[CollectionsListResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ...models.collections400_error import Collections400Error + from ...models.collections422_error import Collections422Error + from ...models.collections_list_response400_error import CollectionsListResponse400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": CollectionsListResponse400Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ...models.collections_list_response import CollectionsListResponse + + return await self.request_adapter.send_async(request_info, CollectionsListResponse, error_mapping) + + async def post(self,body: CollectionRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + param body: A request for creating a new, single collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ...models.collections400_error import Collections400Error + from ...models.collections422_error import Collections422Error + from ...models.collections_list_response400_error import CollectionsListResponse400Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": Collections400Error, + "422": Collections422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[CollectionsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + Gets a list of collections. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_post_request_information(self,body: CollectionRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + param body: A request for creating a new, single collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> CollectionsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: CollectionsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return CollectionsRequestBuilder(self.request_adapter, raw_url) + + @property + def metadata(self) -> MetadataRequestBuilder: + """ + The metadata property + """ + from .metadata.metadata_request_builder import MetadataRequestBuilder + + return MetadataRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class CollectionsRequestBuilderGetQueryParameters(): + """ + Gets a list of collections. + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class CollectionsRequestBuilderGetRequestConfiguration(RequestConfiguration[CollectionsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class CollectionsRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/collection_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/collection_item_request_builder.py new file mode 100644 index 00000000..24163c51 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/collection_item_request_builder.py @@ -0,0 +1,157 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.collection import Collection + from ....models.collection400_error import Collection400Error + from ....models.collection404_error import Collection404Error + from ....models.collection422_error import Collection422Error + from .creation_status.creation_status_request_builder import CreationStatusRequestBuilder + from .deletion_status.deletion_status_request_builder import DeletionStatusRequestBuilder + from .documents.documents_request_builder import DocumentsRequestBuilder + +class CollectionItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections/{collection-id} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new CollectionItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections/{collection%2Did}", path_parameters) + + async def delete(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + request_info = self.to_delete_request_information( + request_configuration + ) + from ....models.collection400_error import Collection400Error + from ....models.collection404_error import Collection404Error + from ....models.collection422_error import Collection422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": Collection400Error, + "404": Collection404Error, + "422": Collection422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[Collection]: + """ + Gets a specific collection by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[Collection] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ....models.collection400_error import Collection400Error + from ....models.collection404_error import Collection404Error + from ....models.collection422_error import Collection422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": Collection400Error, + "404": Collection404Error, + "422": Collection422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.collection import Collection + + return await self.request_adapter.send_async(request_info, Collection, error_mapping) + + def to_delete_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.DELETE, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Gets a specific collection by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> CollectionItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: CollectionItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return CollectionItemRequestBuilder(self.request_adapter, raw_url) + + @property + def creation_status(self) -> CreationStatusRequestBuilder: + """ + The creationStatus property + """ + from .creation_status.creation_status_request_builder import CreationStatusRequestBuilder + + return CreationStatusRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def deletion_status(self) -> DeletionStatusRequestBuilder: + """ + The deletionStatus property + """ + from .deletion_status.deletion_status_request_builder import DeletionStatusRequestBuilder + + return DeletionStatusRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def documents(self) -> DocumentsRequestBuilder: + """ + The documents property + """ + from .documents.documents_request_builder import DocumentsRequestBuilder + + return DocumentsRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class CollectionItemRequestBuilderDeleteRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class CollectionItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/creation_status/creation_status_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/creation_status/creation_status_get_response.py new file mode 100644 index 00000000..053bd1a0 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/creation_status/creation_status_get_response.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .....models.collection_created_response import CollectionCreatedResponse + from .....models.collection_pending_response import CollectionPendingResponse + +@dataclass +class CreationStatusGetResponse(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes CollectionCreatedResponse, CollectionPendingResponse + """ + # Composed type representation for type CollectionCreatedResponse + collection_created_response: Optional[CollectionCreatedResponse] = None + # Composed type representation for type CollectionPendingResponse + collection_pending_response: Optional[CollectionPendingResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> CreationStatusGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: CreationStatusGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = CreationStatusGetResponse() + if mapping_value and mapping_value.casefold() == "CollectionCreatedResponse".casefold(): + from .....models.collection_created_response import CollectionCreatedResponse + + result.collection_created_response = CollectionCreatedResponse() + elif mapping_value and mapping_value.casefold() == "CollectionPendingResponse".casefold(): + from .....models.collection_pending_response import CollectionPendingResponse + + result.collection_pending_response = CollectionPendingResponse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .....models.collection_created_response import CollectionCreatedResponse + from .....models.collection_pending_response import CollectionPendingResponse + + if self.collection_created_response: + return self.collection_created_response.get_field_deserializers() + if self.collection_pending_response: + return self.collection_pending_response.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.collection_created_response: + writer.write_object_value(None, self.collection_created_response) + elif self.collection_pending_response: + writer.write_object_value(None, self.collection_pending_response) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/creation_status/creation_status_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/creation_status/creation_status_request_builder.py new file mode 100644 index 00000000..94d151e2 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/creation_status/creation_status_request_builder.py @@ -0,0 +1,87 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .....models.creation_status400_error import CreationStatus400Error + from .....models.creation_status404_error import CreationStatus404Error + from .....models.creation_status422_error import CreationStatus422Error + from .creation_status_get_response import CreationStatusGetResponse + +class CreationStatusRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections/{collection-id}/creationStatus + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new CreationStatusRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections/{collection%2Did}/creationStatus", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[CreationStatusGetResponse]: + """ + Gets a specific collection status from monitor by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[CreationStatusGetResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from .....models.creation_status400_error import CreationStatus400Error + from .....models.creation_status404_error import CreationStatus404Error + from .....models.creation_status422_error import CreationStatus422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": CreationStatus400Error, + "404": CreationStatus404Error, + "422": CreationStatus422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .creation_status_get_response import CreationStatusGetResponse + + return await self.request_adapter.send_async(request_info, CreationStatusGetResponse, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Gets a specific collection status from monitor by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> CreationStatusRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: CreationStatusRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return CreationStatusRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class CreationStatusRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/deletion_status/deletion_status_get_response.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/deletion_status/deletion_status_get_response.py new file mode 100644 index 00000000..799f05b8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/deletion_status/deletion_status_get_response.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .....models.collection_deleted_response import CollectionDeletedResponse + from .....models.collection_pending_response import CollectionPendingResponse + +@dataclass +class DeletionStatusGetResponse(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes CollectionDeletedResponse, CollectionPendingResponse + """ + # Composed type representation for type CollectionDeletedResponse + collection_deleted_response: Optional[CollectionDeletedResponse] = None + # Composed type representation for type CollectionPendingResponse + collection_pending_response: Optional[CollectionPendingResponse] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> DeletionStatusGetResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: DeletionStatusGetResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = DeletionStatusGetResponse() + if mapping_value and mapping_value.casefold() == "CollectionDeletedResponse".casefold(): + from .....models.collection_deleted_response import CollectionDeletedResponse + + result.collection_deleted_response = CollectionDeletedResponse() + elif mapping_value and mapping_value.casefold() == "CollectionPendingResponse".casefold(): + from .....models.collection_pending_response import CollectionPendingResponse + + result.collection_pending_response = CollectionPendingResponse() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .....models.collection_deleted_response import CollectionDeletedResponse + from .....models.collection_pending_response import CollectionPendingResponse + + if self.collection_deleted_response: + return self.collection_deleted_response.get_field_deserializers() + if self.collection_pending_response: + return self.collection_pending_response.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.collection_deleted_response: + writer.write_object_value(None, self.collection_deleted_response) + elif self.collection_pending_response: + writer.write_object_value(None, self.collection_pending_response) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/deletion_status/deletion_status_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/deletion_status/deletion_status_request_builder.py new file mode 100644 index 00000000..5db228d8 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/deletion_status/deletion_status_request_builder.py @@ -0,0 +1,87 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from .....models.deletion_status400_error import DeletionStatus400Error + from .....models.deletion_status404_error import DeletionStatus404Error + from .....models.deletion_status422_error import DeletionStatus422Error + from .deletion_status_get_response import DeletionStatusGetResponse + +class DeletionStatusRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections/{collection-id}/deletionStatus + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DeletionStatusRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections/{collection%2Did}/deletionStatus", path_parameters) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[DeletionStatusGetResponse]: + """ + Gets a specific collection status from monitor by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DeletionStatusGetResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from .....models.deletion_status400_error import DeletionStatus400Error + from .....models.deletion_status404_error import DeletionStatus404Error + from .....models.deletion_status422_error import DeletionStatus422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DeletionStatus400Error, + "404": DeletionStatus404Error, + "422": DeletionStatus422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .deletion_status_get_response import DeletionStatusGetResponse + + return await self.request_adapter.send_async(request_info, DeletionStatusGetResponse, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Gets a specific collection status from monitor by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> DeletionStatusRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DeletionStatusRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DeletionStatusRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class DeletionStatusRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/documents/documents_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/documents/documents_request_builder.py new file mode 100644 index 00000000..1252c436 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/documents/documents_request_builder.py @@ -0,0 +1,247 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from uuid import UUID +from warnings import warn + +if TYPE_CHECKING: + from .....models.documents import Documents + from .....models.documents400_error import Documents400Error + from .....models.documents404_error import Documents404Error + from .....models.documents422_error import Documents422Error + from .....models.documents_list_response import DocumentsListResponse + from .....models.documents_list_response400_error import DocumentsListResponse400Error + from .....models.documents_list_response404_error import DocumentsListResponse404Error + from .....models.documents_list_response422_error import DocumentsListResponse422Error + from .....models.document_create_request import DocumentCreateRequest + from .....models.document_update_request import DocumentUpdateRequest + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + +class DocumentsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections/{collection-id}/documents + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DocumentsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections/{collection%2Did}/documents{?%24count*,%24skip*,%24top*}", path_parameters) + + def by_document_id(self,document_id: UUID) -> WithDocumentItemRequestBuilder: + """ + Gets an item from the gen_ai_hub.document_grounding_generation_kiota.generated.vector.collections.item.documents.item collection + param document_id: Document ID + Returns: WithDocumentItemRequestBuilder + """ + if document_id is None: + raise TypeError("document_id cannot be null.") + from .item.with_document_item_request_builder import WithDocumentItemRequestBuilder + + url_tpl_params = get_path_parameters(self.path_parameters) + url_tpl_params["documentId"] = document_id + return WithDocumentItemRequestBuilder(self.request_adapter, url_tpl_params) + + async def get(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> Optional[Documents]: + """ + Gets a list of documents of a collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[Documents] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from .....models.documents400_error import Documents400Error + from .....models.documents404_error import Documents404Error + from .....models.documents422_error import Documents422Error + from .....models.documents_list_response400_error import DocumentsListResponse400Error + from .....models.documents_list_response404_error import DocumentsListResponse404Error + from .....models.documents_list_response422_error import DocumentsListResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": Documents400Error, + "404": Documents404Error, + "422": Documents422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .....models.documents import Documents + + return await self.request_adapter.send_async(request_info, Documents, error_mapping) + + async def patch(self,body: DocumentUpdateRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[DocumentsListResponse]: + """ + Upserts the data of multiple documents into a collection. + param body: An update request containing one or more documents to update existing documents in a collection by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DocumentsListResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_patch_request_information( + body, request_configuration + ) + from .....models.documents400_error import Documents400Error + from .....models.documents404_error import Documents404Error + from .....models.documents422_error import Documents422Error + from .....models.documents_list_response400_error import DocumentsListResponse400Error + from .....models.documents_list_response404_error import DocumentsListResponse404Error + from .....models.documents_list_response422_error import DocumentsListResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DocumentsListResponse400Error, + "404": DocumentsListResponse404Error, + "422": DocumentsListResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .....models.documents_list_response import DocumentsListResponse + + return await self.request_adapter.send_async(request_info, DocumentsListResponse, error_mapping) + + async def post(self,body: DocumentCreateRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[DocumentsListResponse]: + """ + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + param body: A create request containing one or more new documents to create and store in a collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DocumentsListResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from .....models.documents400_error import Documents400Error + from .....models.documents404_error import Documents404Error + from .....models.documents422_error import Documents422Error + from .....models.documents_list_response400_error import DocumentsListResponse400Error + from .....models.documents_list_response404_error import DocumentsListResponse404Error + from .....models.documents_list_response422_error import DocumentsListResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DocumentsListResponse400Error, + "404": DocumentsListResponse404Error, + "422": DocumentsListResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from .....models.documents_list_response import DocumentsListResponse + + return await self.request_adapter.send_async(request_info, DocumentsListResponse, error_mapping) + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]] = None) -> RequestInformation: + """ + Gets a list of documents of a collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_patch_request_information(self,body: DocumentUpdateRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Upserts the data of multiple documents into a collection. + param body: An update request containing one or more documents to update existing documents in a collection by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def to_post_request_information(self,body: DocumentCreateRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + param body: A create request containing one or more new documents to create and store in a collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> DocumentsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DocumentsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DocumentsRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class DocumentsRequestBuilderGetQueryParameters(): + """ + Gets a list of documents of a collection. + """ + def get_query_parameter(self,original_name: str) -> str: + """ + Maps the query parameters names to their encoded names for the URI template parsing. + param original_name: The original query parameter name in the class. + Returns: str + """ + if original_name is None: + raise TypeError("original_name cannot be null.") + if original_name == "count": + return "%24count" + if original_name == "skip": + return "%24skip" + if original_name == "top": + return "%24top" + return original_name + + # 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. + count: Optional[bool] = None + + # Number of results to be skipped from the ordered list of results + skip: Optional[int] = None + + # Number of results to display + top: Optional[int] = None + + + @dataclass + class DocumentsRequestBuilderGetRequestConfiguration(RequestConfiguration[DocumentsRequestBuilderGetQueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class DocumentsRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class DocumentsRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/documents/item/with_document_item_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/documents/item/with_document_item_request_builder.py new file mode 100644 index 00000000..883a41b5 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/item/documents/item/with_document_item_request_builder.py @@ -0,0 +1,136 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ......models.document_response import DocumentResponse + from ......models.document_response400_error import DocumentResponse400Error + from ......models.document_response404_error import DocumentResponse404Error + from ......models.document_response422_error import DocumentResponse422Error + from ......models.with_document400_error import WithDocument400Error + from ......models.with_document404_error import WithDocument404Error + from ......models.with_document422_error import WithDocument422Error + +class WithDocumentItemRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections/{collection-id}/documents/{documentId} + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new WithDocumentItemRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections/{collection%2Did}/documents/{documentId}", path_parameters) + + async def delete(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> None: + """ + Deletes a specific document of a collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: None + """ + request_info = self.to_delete_request_information( + request_configuration + ) + from ......models.document_response400_error import DocumentResponse400Error + from ......models.document_response404_error import DocumentResponse404Error + from ......models.document_response422_error import DocumentResponse422Error + from ......models.with_document400_error import WithDocument400Error + from ......models.with_document404_error import WithDocument404Error + from ......models.with_document422_error import WithDocument422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": WithDocument400Error, + "404": WithDocument404Error, + "422": WithDocument422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + return await self.request_adapter.send_no_response_content_async(request_info, error_mapping) + + async def get(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[DocumentResponse]: + """ + Gets a specific document in a collection by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DocumentResponse] + """ + request_info = self.to_get_request_information( + request_configuration + ) + from ......models.document_response400_error import DocumentResponse400Error + from ......models.document_response404_error import DocumentResponse404Error + from ......models.document_response422_error import DocumentResponse422Error + from ......models.with_document400_error import WithDocument400Error + from ......models.with_document404_error import WithDocument404Error + from ......models.with_document422_error import WithDocument422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DocumentResponse400Error, + "404": DocumentResponse404Error, + "422": DocumentResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ......models.document_response import DocumentResponse + + return await self.request_adapter.send_async(request_info, DocumentResponse, error_mapping) + + def to_delete_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Deletes a specific document of a collection. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.DELETE, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Gets a specific document in a collection by ID. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + return request_info + + def with_url(self,raw_url: str) -> WithDocumentItemRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: WithDocumentItemRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return WithDocumentItemRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class WithDocumentItemRequestBuilderDeleteRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + @dataclass + class WithDocumentItemRequestBuilderGetRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/metadata/metadata_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/metadata/metadata_request_builder.py new file mode 100644 index 00000000..3bc91bc7 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/collections/metadata/metadata_request_builder.py @@ -0,0 +1,95 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.metadata_response import MetadataResponse + from ....models.metadata_response400_error import MetadataResponse400Error + from ....models.metadata_response404_error import MetadataResponse404Error + from ....models.metadata_response422_error import MetadataResponse422Error + from ....models.metadata_updates import MetadataUpdates + +class MetadataRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/collections/metadata + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new MetadataRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/collections/metadata", path_parameters) + + async def patch(self,body: MetadataUpdates, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[MetadataResponse]: + """ + Allows to add, remove and modify the collections metadata. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[MetadataResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_patch_request_information( + body, request_configuration + ) + from ....models.metadata_response400_error import MetadataResponse400Error + from ....models.metadata_response404_error import MetadataResponse404Error + from ....models.metadata_response422_error import MetadataResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": MetadataResponse400Error, + "404": MetadataResponse404Error, + "422": MetadataResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.metadata_response import MetadataResponse + + return await self.request_adapter.send_async(request_info, MetadataResponse, error_mapping) + + def to_patch_request_information(self,body: MetadataUpdates, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Allows to add, remove and modify the collections metadata. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> MetadataRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: MetadataRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return MetadataRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class MetadataRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/documents/documents_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/documents/documents_request_builder.py new file mode 100644 index 00000000..5781df8d --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/documents/documents_request_builder.py @@ -0,0 +1,105 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ...models.document_bulk_delete_request import DocumentBulkDeleteRequest + from ...models.document_bulk_delete_response import DocumentBulkDeleteResponse + from ...models.document_bulk_delete_response400_error import DocumentBulkDeleteResponse400Error + from ...models.document_bulk_delete_response404_error import DocumentBulkDeleteResponse404Error + from ...models.document_bulk_delete_response422_error import DocumentBulkDeleteResponse422Error + from .metadata.metadata_request_builder import MetadataRequestBuilder + +class DocumentsRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/documents + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new DocumentsRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/documents", path_parameters) + + async def delete(self,body: DocumentBulkDeleteRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[DocumentBulkDeleteResponse]: + """ + Deletes list of documents across collections. + param body: A request to delete documents by their IDs. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[DocumentBulkDeleteResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_delete_request_information( + body, request_configuration + ) + from ...models.document_bulk_delete_response400_error import DocumentBulkDeleteResponse400Error + from ...models.document_bulk_delete_response404_error import DocumentBulkDeleteResponse404Error + from ...models.document_bulk_delete_response422_error import DocumentBulkDeleteResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": DocumentBulkDeleteResponse400Error, + "404": DocumentBulkDeleteResponse404Error, + "422": DocumentBulkDeleteResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ...models.document_bulk_delete_response import DocumentBulkDeleteResponse + + return await self.request_adapter.send_async(request_info, DocumentBulkDeleteResponse, error_mapping) + + def to_delete_request_information(self,body: DocumentBulkDeleteRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Deletes list of documents across collections. + param body: A request to delete documents by their IDs. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.DELETE, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> DocumentsRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: DocumentsRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return DocumentsRequestBuilder(self.request_adapter, raw_url) + + @property + def metadata(self) -> MetadataRequestBuilder: + """ + The metadata property + """ + from .metadata.metadata_request_builder import MetadataRequestBuilder + + return MetadataRequestBuilder(self.request_adapter, self.path_parameters) + + @dataclass + class DocumentsRequestBuilderDeleteRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/documents/metadata/metadata_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/documents/metadata/metadata_request_builder.py new file mode 100644 index 00000000..8b515ce4 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/documents/metadata/metadata_request_builder.py @@ -0,0 +1,95 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ....models.metadata_response import MetadataResponse + from ....models.metadata_response400_error import MetadataResponse400Error + from ....models.metadata_response404_error import MetadataResponse404Error + from ....models.metadata_response422_error import MetadataResponse422Error + from ....models.metadata_updates import MetadataUpdates + +class MetadataRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/documents/metadata + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new MetadataRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/documents/metadata", path_parameters) + + async def patch(self,body: MetadataUpdates, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[MetadataResponse]: + """ + Allows to add, remove and modify the documents metadata. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[MetadataResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_patch_request_information( + body, request_configuration + ) + from ....models.metadata_response400_error import MetadataResponse400Error + from ....models.metadata_response404_error import MetadataResponse404Error + from ....models.metadata_response422_error import MetadataResponse422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": MetadataResponse400Error, + "404": MetadataResponse404Error, + "422": MetadataResponse422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ....models.metadata_response import MetadataResponse + + return await self.request_adapter.send_async(request_info, MetadataResponse, error_mapping) + + def to_patch_request_information(self,body: MetadataUpdates, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Allows to add, remove and modify the documents metadata. + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.PATCH, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> MetadataRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: MetadataRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return MetadataRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class MetadataRequestBuilderPatchRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/search/search_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/search/search_request_builder.py new file mode 100644 index 00000000..fffe651f --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/search/search_request_builder.py @@ -0,0 +1,95 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ...models.text_search_request import TextSearchRequest + from ...models.vector_search_results import VectorSearchResults + from ...models.vector_search_results400_error import VectorSearchResults400Error + from ...models.vector_search_results404_error import VectorSearchResults404Error + from ...models.vector_search_results422_error import VectorSearchResults422Error + +class SearchRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector/search + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new SearchRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector/search", path_parameters) + + async def post(self,body: TextSearchRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[VectorSearchResults]: + """ + Search chunks + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[VectorSearchResults] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ...models.vector_search_results400_error import VectorSearchResults400Error + from ...models.vector_search_results404_error import VectorSearchResults404Error + from ...models.vector_search_results422_error import VectorSearchResults422Error + + error_mapping: dict[str, type[ParsableFactory]] = { + "400": VectorSearchResults400Error, + "404": VectorSearchResults404Error, + "422": VectorSearchResults422Error, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ...models.vector_search_results import VectorSearchResults + + return await self.request_adapter.send_async(request_info, VectorSearchResults, error_mapping) + + def to_post_request_information(self,body: TextSearchRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Search chunks + param body: The request body + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> SearchRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: SearchRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return SearchRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class SearchRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/vector_request_builder.py b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/vector_request_builder.py new file mode 100644 index 00000000..b26c9150 --- /dev/null +++ b/packages/gen/gen_ai_hub/document_grounding_generation_kiota/generated/vector/vector_request_builder.py @@ -0,0 +1,63 @@ +from __future__ import annotations +from collections.abc import Callable +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.request_adapter import RequestAdapter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .chunks.chunks_request_builder import ChunksRequestBuilder + from .collections.collections_request_builder import CollectionsRequestBuilder + from .documents.documents_request_builder import DocumentsRequestBuilder + from .search.search_request_builder import SearchRequestBuilder + +class VectorRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /vector + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new VectorRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/vector", path_parameters) + + @property + def chunks(self) -> ChunksRequestBuilder: + """ + The chunks property + """ + from .chunks.chunks_request_builder import ChunksRequestBuilder + + return ChunksRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def collections(self) -> CollectionsRequestBuilder: + """ + The collections property + """ + from .collections.collections_request_builder import CollectionsRequestBuilder + + return CollectionsRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def documents(self) -> DocumentsRequestBuilder: + """ + The documents property + """ + from .documents.documents_request_builder import DocumentsRequestBuilder + + return DocumentsRequestBuilder(self.request_adapter, self.path_parameters) + + @property + def search(self) -> SearchRequestBuilder: + """ + The search property + """ + from .search.search_request_builder import SearchRequestBuilder + + return SearchRequestBuilder(self.request_adapter, self.path_parameters) + + diff --git a/packages/gen/gen_ai_hub/proxy/gen_ai_hub_proxy/client.py b/packages/gen/gen_ai_hub/proxy/gen_ai_hub_proxy/client.py index 184148b2..3ed81683 100644 --- a/packages/gen/gen_ai_hub/proxy/gen_ai_hub_proxy/client.py +++ b/packages/gen/gen_ai_hub/proxy/gen_ai_hub_proxy/client.py @@ -264,8 +264,10 @@ def init_client(cls, data: Any) -> Any: # Set AI-Client-Type header specific to generated AI Hub SDK. # Is overwritten by environment variable AI_CLIENT_TYPE if set. kwargs['client_type'] = cls.AI_CLIENT_TYPE_VAL - data['ai_core_client'] = AICoreV2Client.from_env(**kwargs) - + ai_core_client = AICoreV2Client.from_env(**kwargs) + data['ai_core_client'] = ai_core_client + if data.get('resource_group') is None: + data['resource_group'] = ai_core_client.rest_client.headers.get('AI-Resource-Group') return data 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 00000000..cec90368 --- /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 00000000..791c1a57 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration/client.py @@ -0,0 +1,154 @@ +"""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() + + +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( + predict_request=PredictRequest(...), + ) + + # or without context manager + client = TabAiOrchestrationClient(model_name="sap-rpt-1.5") + response = await client.predict(predict_request=...) + 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) + self._resource_group = proxy.resource_group or "default" + 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, + ) -> PredictResponse: + """Make predictions using a Tabular Foundation Model. + + :param predict_request: The prediction request payload. + :returns: Prediction response from the model. + """ + return await self._predict_api.predict( # type: ignore[no-any-return] + ai_resource_group=self._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 00000000..7495576b --- /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 00000000..0b1ce141 --- /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 00000000..9de4e57d --- /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 00000000..b4b057f1 --- /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 00000000..9bc7c11f --- /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 00000000..27ae67da --- /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 00000000..98cc5e85 --- /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 00000000..6c0eae60 --- /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 00000000..67e5933d --- /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 00000000..67f818d9 --- /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 00000000..38f4f0cd --- /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 00000000..55ee4eae --- /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 00000000..e8cb464e --- /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 00000000..f3f4b5bc --- /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 00000000..e37f3a19 --- /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 00000000..da4b6a3a --- /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 00000000..695448d7 --- /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 00000000..d6f7c784 --- /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 00000000..a204190c --- /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 00000000..401176d9 --- /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 00000000..1fc1a72f --- /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 00000000..890fb3cb --- /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 00000000..f6da1929 --- /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 00000000..3ba90a74 --- /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 00000000..a25981ff --- /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 00000000..b36a1391 --- /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 00000000..623f20da --- /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 00000000..10b782b1 --- /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 00000000..6b35ad48 --- /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 00000000..681f95c0 --- /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 00000000..69871872 --- /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 00000000..af3c5258 --- /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 00000000..2ab7b7cf --- /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 00000000..e69de29b 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 00000000..bf2e4fb7 --- /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 00000000..e5e47f08 --- /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/gen_ai_hub/tab_ai_orchestration_kiota/__init__.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/__init__.py new file mode 100644 index 00000000..93e9ce32 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/__init__.py @@ -0,0 +1,5 @@ +"""Kiota-generated client for the SAP Tabular AI Orchestration service.""" + +from gen_ai_hub.tab_ai_orchestration_kiota.client import KiotaTabAiOrchestrationClient + +__all__ = ["KiotaTabAiOrchestrationClient"] diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/client.py new file mode 100644 index 00000000..e38a5074 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/client.py @@ -0,0 +1,118 @@ +"""SAP wrapper client for the Tabular AI Orchestration service using Kiota-generated code. + +The generated code under `generated/` is produced by running: + + cd packages/gen && make generate-kiota + +This requires `kiota` on PATH (install via `brew install kiota` or +`dotnet tool install --global Microsoft.OpenApi.Kiota`). + +Usage:: + + from gen_ai_hub.tab_ai_orchestration_kiota import KiotaTabAiOrchestrationClient + from gen_ai_hub.tab_ai_orchestration_kiota.generated.models.predict_request import PredictRequest + + async with KiotaTabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + response = await client.predict.post(PredictRequest(...)) +""" + +from __future__ import annotations + +from typing import Any, Optional, Self, Union + +from kiota_abstractions.authentication.authentication_provider import AuthenticationProvider +from kiota_abstractions.request_information import RequestInformation +from kiota_http.httpx_request_adapter import HttpxRequestAdapter + +from gen_ai_hub import GenAIHubProxyClient +from gen_ai_hub.proxy import get_proxy_client + +from gen_ai_hub.tab_ai_orchestration_kiota.generated.tab_ai_orchestration_client import ( + TabAiOrchestrationClient as _GeneratedClient, +) + + +class _SapAuthProvider(AuthenticationProvider): + """Injects SAP AI Core auth headers into every Kiota request.""" + + def __init__(self, proxy: GenAIHubProxyClient) -> None: + self._proxy = proxy + + async def authenticate_request( + self, + request: RequestInformation, + additional_authentication_context: Optional[dict] = None, + ) -> None: + for key, value in self._proxy.request_header.items(): + request.headers.try_add(key, value) + + +def _get_proxy(proxy_client: Optional[GenAIHubProxyClient]) -> GenAIHubProxyClient: + return proxy_client or get_proxy_client() + + +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 + + +class KiotaTabAiOrchestrationClient: + """Kiota-based 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. + + The underlying Kiota-generated client is exposed as ``.generated`` for + direct access to all request builders. + + Usage:: + + async with KiotaTabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + response = await client.generated.predict.post(PredictRequest(...)) + """ + + def __init__( + self, + model_name: str, + model_version: Optional[str] = None, + proxy_client: Optional[GenAIHubProxyClient] = None, + timeout: Union[float, None] = None, + ) -> None: + import httpx + + proxy = _get_proxy(proxy_client) + self._resource_group = proxy.resource_group or "default" + base_url = _resolve_deployment_url(proxy, model_name, model_version) + auth = _SapAuthProvider(proxy) + + http_client: Any = None + if timeout is not None: + http_client = httpx.AsyncClient(timeout=timeout) + + adapter = HttpxRequestAdapter( + auth, + http_client=http_client, + base_url=base_url, + ) + self.generated = _GeneratedClient(adapter) + + async def close(self) -> None: + """Close the underlying HTTP client.""" + await self.generated.request_adapter.get_http_client().aclose() # type: ignore[union-attr] + + async def __aenter__(self) -> Self: + return self + + async def __aexit__(self, *_: object) -> None: + await self.close() diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/kiota-lock.json b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/kiota-lock.json new file mode 100644 index 00000000..dfa74405 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/kiota-lock.json @@ -0,0 +1,35 @@ +{ + "descriptionHash": "9376CE5CDA008C3A2498C2AB56EC6E1D86832056B0240F71559005BA09F56EE757400193E7A11F20CE39773A7712EF7A2E149B918E78435D16A6E3AA81793F97", + "descriptionLocation": "../processed.yaml", + "lockFileVersion": "1.0.0", + "kiotaVersion": "1.35.0", + "clientClassName": "TabAiOrchestrationClient", + "typeAccessModifier": "Public", + "clientNamespaceName": "gen_ai_hub.tab_ai_orchestration_kiota.generated", + "language": "Python", + "usesBackingStore": false, + "excludeBackwardCompatible": true, + "includeAdditionalData": true, + "disableSSLValidation": false, + "serializers": [ + "Microsoft.Kiota.Serialization.Json.JsonSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Text.TextSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Form.FormSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Multipart.MultipartSerializationWriterFactory" + ], + "deserializers": [ + "Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory", + "Microsoft.Kiota.Serialization.Text.TextParseNodeFactory", + "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory" + ], + "structuredMimeTypes": [ + "application/json", + "text/plain;q=0.9", + "application/x-www-form-urlencoded;q=0.2", + "multipart/form-data;q=0.1" + ], + "includePatterns": [], + "excludePatterns": [], + "disabledValidationRules": [], + "allowedExternalOrigins": [] +} \ No newline at end of file diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/columnar_data.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/columnar_data.py new file mode 100644 index 00000000..6d22c9f1 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/columnar_data.py @@ -0,0 +1,46 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ColumnarData(AdditionalDataHolder, Parsable): + """ + Columnar data format where each key is a column nameand the value is a list of values for that column.Example:{ "code": ["new_code1", "new_code2"], "category": ["Electronics", "Clothing"], "price": [100, 50]} + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ColumnarData: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ColumnarData + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ColumnarData() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config.py new file mode 100644 index 00000000..8d5a52ee --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config.py @@ -0,0 +1,87 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .context_selection_config_filter_conditions import ContextSelectionConfig_filterConditions + from .context_selection_config_index_column import ContextSelectionConfig_indexColumn + from .context_selection_config_num_rows import ContextSelectionConfig_numRows + from .context_selection_config_strategy_config import ContextSelectionConfig_strategyConfig + from .context_selection_strategy_enum import ContextSelectionStrategyEnum + +@dataclass +class ContextSelectionConfig(AdditionalDataHolder, Parsable): + """ + Configuration for context selection. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + from .context_selection_strategy_enum import ContextSelectionStrategyEnum + + # Sampling strategy for context selection. + strategy: Optional[ContextSelectionStrategyEnum] = ContextSelectionStrategyEnum("random") + # Filter conditions for context selection + filter_conditions: Optional[ContextSelectionConfig_filterConditions] = None + # Name of the unique row-identifier column (e.g. 'ROW_INDEX'). Required for 'heuristic', and deterministic 'random' strategies. + index_column: Optional[ContextSelectionConfig_indexColumn] = None + # Number of rows to select for context. If not provided or set to 0, context selection is skipped. + num_rows: Optional[ContextSelectionConfig_numRows] = None + # Strategy-specific configuration parameters. + strategy_config: Optional[ContextSelectionConfig_strategyConfig] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ContextSelectionConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .context_selection_config_filter_conditions import ContextSelectionConfig_filterConditions + from .context_selection_config_index_column import ContextSelectionConfig_indexColumn + from .context_selection_config_num_rows import ContextSelectionConfig_numRows + from .context_selection_config_strategy_config import ContextSelectionConfig_strategyConfig + from .context_selection_strategy_enum import ContextSelectionStrategyEnum + + from .context_selection_config_filter_conditions import ContextSelectionConfig_filterConditions + from .context_selection_config_index_column import ContextSelectionConfig_indexColumn + from .context_selection_config_num_rows import ContextSelectionConfig_numRows + from .context_selection_config_strategy_config import ContextSelectionConfig_strategyConfig + from .context_selection_strategy_enum import ContextSelectionStrategyEnum + + fields: dict[str, Callable[[Any], None]] = { + "filterConditions": lambda n : setattr(self, 'filter_conditions', n.get_object_value(ContextSelectionConfig_filterConditions)), + "indexColumn": lambda n : setattr(self, 'index_column', n.get_object_value(ContextSelectionConfig_indexColumn)), + "numRows": lambda n : setattr(self, 'num_rows', n.get_object_value(ContextSelectionConfig_numRows)), + "strategy": lambda n : setattr(self, 'strategy', n.get_enum_value(ContextSelectionStrategyEnum)), + "strategyConfig": lambda n : setattr(self, 'strategy_config', n.get_object_value(ContextSelectionConfig_strategyConfig)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("filterConditions", self.filter_conditions) + writer.write_object_value("indexColumn", self.index_column) + writer.write_object_value("numRows", self.num_rows) + writer.write_enum_value("strategy", self.strategy) + writer.write_object_value("strategyConfig", self.strategy_config) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_filter_conditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_filter_conditions.py new file mode 100644 index 00000000..629f6681 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_filter_conditions.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .context_selection_config_filter_conditions_member1 import ContextSelectionConfig_filterConditionsMember1 + from .filter_condition import FilterCondition + from .filter_conditions import FilterConditions + +@dataclass +class ContextSelectionConfig_filterConditions(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ContextSelectionConfig_filterConditionsMember1, FilterCondition, FilterConditions + """ + # Composed type representation for type ContextSelectionConfig_filterConditionsMember1 + context_selection_config_filter_conditions_member1: Optional[ContextSelectionConfig_filterConditionsMember1] = None + # Composed type representation for type FilterCondition + filter_condition: Optional[FilterCondition] = None + # Composed type representation for type FilterConditions + filter_conditions: Optional[FilterConditions] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_filterConditions: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_filterConditions + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ContextSelectionConfig_filterConditions() + from .context_selection_config_filter_conditions_member1 import ContextSelectionConfig_filterConditionsMember1 + + result.context_selection_config_filter_conditions_member1 = ContextSelectionConfig_filterConditionsMember1() + from .filter_condition import FilterCondition + + result.filter_condition = FilterCondition() + from .filter_conditions import FilterConditions + + result.filter_conditions = FilterConditions() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .context_selection_config_filter_conditions_member1 import ContextSelectionConfig_filterConditionsMember1 + from .filter_condition import FilterCondition + from .filter_conditions import FilterConditions + + if self.context_selection_config_filter_conditions_member1 or self.filter_condition or self.filter_conditions: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.context_selection_config_filter_conditions_member1, self.filter_condition, self.filter_conditions) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.context_selection_config_filter_conditions_member1, self.filter_condition, self.filter_conditions) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_filter_conditions_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_filter_conditions_member1.py new file mode 100644 index 00000000..1116bad8 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_filter_conditions_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ContextSelectionConfig_filterConditionsMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_filterConditionsMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_filterConditionsMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ContextSelectionConfig_filterConditionsMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_index_column.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_index_column.py new file mode 100644 index 00000000..7c54cac8 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_index_column.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .context_selection_config_index_column_member1 import ContextSelectionConfig_indexColumnMember1 + +@dataclass +class ContextSelectionConfig_indexColumn(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ContextSelectionConfig_indexColumnMember1, str + """ + # Composed type representation for type ContextSelectionConfig_indexColumnMember1 + context_selection_config_index_column_member1: Optional[ContextSelectionConfig_indexColumnMember1] = None + # Composed type representation for type str + string: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_indexColumn: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_indexColumn + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ContextSelectionConfig_indexColumn() + if string_value := parse_node.get_str_value(): + result.string = string_value + else: + from .context_selection_config_index_column_member1 import ContextSelectionConfig_indexColumnMember1 + + result.context_selection_config_index_column_member1 = ContextSelectionConfig_indexColumnMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .context_selection_config_index_column_member1 import ContextSelectionConfig_indexColumnMember1 + + if self.context_selection_config_index_column_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.context_selection_config_index_column_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.string: + writer.write_str_value(None, self.string) + else: + writer.write_object_value(None, self.context_selection_config_index_column_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_index_column_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_index_column_member1.py new file mode 100644 index 00000000..7a39bee6 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_index_column_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ContextSelectionConfig_indexColumnMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_indexColumnMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_indexColumnMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ContextSelectionConfig_indexColumnMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_num_rows.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_num_rows.py new file mode 100644 index 00000000..a8ea6455 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_num_rows.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .context_selection_config_num_rows_member1 import ContextSelectionConfig_numRowsMember1 + +@dataclass +class ContextSelectionConfig_numRows(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ContextSelectionConfig_numRowsMember1, int + """ + # Composed type representation for type ContextSelectionConfig_numRowsMember1 + context_selection_config_num_rows_member1: Optional[ContextSelectionConfig_numRowsMember1] = None + # Composed type representation for type int + integer: Optional[int] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_numRows: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_numRows + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ContextSelectionConfig_numRows() + if integer_value := parse_node.get_int_value(): + result.integer = integer_value + else: + from .context_selection_config_num_rows_member1 import ContextSelectionConfig_numRowsMember1 + + result.context_selection_config_num_rows_member1 = ContextSelectionConfig_numRowsMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .context_selection_config_num_rows_member1 import ContextSelectionConfig_numRowsMember1 + + if self.context_selection_config_num_rows_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.context_selection_config_num_rows_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.integer: + writer.write_int_value(None, self.integer) + else: + writer.write_object_value(None, self.context_selection_config_num_rows_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_num_rows_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_num_rows_member1.py new file mode 100644 index 00000000..9cb74199 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_num_rows_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ContextSelectionConfig_numRowsMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_numRowsMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_numRowsMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ContextSelectionConfig_numRowsMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_strategy_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_strategy_config.py new file mode 100644 index 00000000..99a77aa9 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_strategy_config.py @@ -0,0 +1,68 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .context_selection_config_strategy_config_member1 import ContextSelectionConfig_strategyConfigMember1 + from .sampling_heuristic_config import SamplingHeuristicConfig + from .sampling_random_config import SamplingRandomConfig + +@dataclass +class ContextSelectionConfig_strategyConfig(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ContextSelectionConfig_strategyConfigMember1, SamplingHeuristicConfig, SamplingRandomConfig + """ + # Composed type representation for type ContextSelectionConfig_strategyConfigMember1 + context_selection_config_strategy_config_member1: Optional[ContextSelectionConfig_strategyConfigMember1] = None + # Composed type representation for type SamplingHeuristicConfig + sampling_heuristic_config: Optional[SamplingHeuristicConfig] = None + # Composed type representation for type SamplingRandomConfig + sampling_random_config: Optional[SamplingRandomConfig] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_strategyConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_strategyConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ContextSelectionConfig_strategyConfig() + from .context_selection_config_strategy_config_member1 import ContextSelectionConfig_strategyConfigMember1 + + result.context_selection_config_strategy_config_member1 = ContextSelectionConfig_strategyConfigMember1() + from .sampling_heuristic_config import SamplingHeuristicConfig + + result.sampling_heuristic_config = SamplingHeuristicConfig() + from .sampling_random_config import SamplingRandomConfig + + result.sampling_random_config = SamplingRandomConfig() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .context_selection_config_strategy_config_member1 import ContextSelectionConfig_strategyConfigMember1 + from .sampling_heuristic_config import SamplingHeuristicConfig + from .sampling_random_config import SamplingRandomConfig + + if self.context_selection_config_strategy_config_member1 or self.sampling_heuristic_config or self.sampling_random_config: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.context_selection_config_strategy_config_member1, self.sampling_heuristic_config, self.sampling_random_config) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.context_selection_config_strategy_config_member1, self.sampling_heuristic_config, self.sampling_random_config) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_strategy_config_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_strategy_config_member1.py new file mode 100644 index 00000000..8e0afb30 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_config_strategy_config_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ContextSelectionConfig_strategyConfigMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ContextSelectionConfig_strategyConfigMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ContextSelectionConfig_strategyConfigMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ContextSelectionConfig_strategyConfigMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_strategy_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_strategy_enum.py new file mode 100644 index 00000000..9585ab58 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/context_selection_strategy_enum.py @@ -0,0 +1,8 @@ +from enum import Enum + +class ContextSelectionStrategyEnum(str, Enum): + None_ = "none", + Random = "random", + Heuristic = "heuristic", + Auto = "auto", + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_condition.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_condition.py new file mode 100644 index 00000000..d7e788ec --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_condition.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class FilterCondition(AdditionalDataHolder, Parsable): + """ + A single filter condition for context selection. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Field name to filter on + field: Optional[str] = None + # Filter operator (e.g., 'eq', 'gte', 'lte') + op: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> FilterCondition: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: FilterCondition + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return FilterCondition() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "field": lambda n : setattr(self, 'field', n.get_str_value()), + "op": lambda n : setattr(self, 'op', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("field", self.field) + writer.write_str_value("op", self.op) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_conditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_conditions.py new file mode 100644 index 00000000..29d0afbe --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_conditions.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .filter_conditions_conditions import FilterConditions_conditions + +@dataclass +class FilterConditions(AdditionalDataHolder, Parsable): + """ + Filter conditions for context selection. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # List of filter conditions + conditions: Optional[list[FilterConditions_conditions]] = None + # Logical operator to combine conditions ('and' or 'or') + logic: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> FilterConditions: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: FilterConditions + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return FilterConditions() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .filter_conditions_conditions import FilterConditions_conditions + + from .filter_conditions_conditions import FilterConditions_conditions + + fields: dict[str, Callable[[Any], None]] = { + "conditions": lambda n : setattr(self, 'conditions', n.get_collection_of_object_values(FilterConditions_conditions)), + "logic": lambda n : setattr(self, 'logic', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("conditions", self.conditions) + writer.write_str_value("logic", self.logic) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_conditions_conditions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_conditions_conditions.py new file mode 100644 index 00000000..8d06a448 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/filter_conditions_conditions.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .filter_condition import FilterCondition + from .filter_conditions import FilterConditions + +@dataclass +class FilterConditions_conditions(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes FilterCondition, FilterConditions + """ + # Composed type representation for type FilterCondition + filter_condition: Optional[FilterCondition] = None + # Composed type representation for type FilterConditions + filter_conditions: Optional[FilterConditions] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> FilterConditions_conditions: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: FilterConditions_conditions + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = FilterConditions_conditions() + from .filter_condition import FilterCondition + + result.filter_condition = FilterCondition() + from .filter_conditions import FilterConditions + + result.filter_conditions = FilterConditions() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .filter_condition import FilterCondition + from .filter_conditions import FilterConditions + + if self.filter_condition or self.filter_conditions: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.filter_condition, self.filter_conditions) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value(None, self.filter_condition, self.filter_conditions) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/h_t_t_p_validation_error.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/h_t_t_p_validation_error.py new file mode 100644 index 00000000..ba357c3a --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/h_t_t_p_validation_error.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.api_error import APIError +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .validation_error import ValidationError + +@dataclass +class HTTPValidationError(APIError, AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The detail property + detail: Optional[list[ValidationError]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> HTTPValidationError: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: HTTPValidationError + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return HTTPValidationError() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .validation_error import ValidationError + + from .validation_error import ValidationError + + fields: dict[str, Callable[[Any], None]] = { + "detail": lambda n : setattr(self, 'detail', n.get_collection_of_object_values(ValidationError)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("detail", self.detail) + writer.write_additional_data_value(self.additional_data) + + @property + def primary_message(self) -> Optional[str]: + """ + The primary error message. + """ + return super().message + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1.py new file mode 100644 index 00000000..aa3ea5b0 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1.py @@ -0,0 +1,61 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_index_column import ModelRpt1_index_column + +@dataclass +class ModelRpt1(AdditionalDataHolder, Parsable): + """ + RPT1 Reference: https://help.sap.com/docs/sap-ai-core/generative-ai/example-payloads-for-inferencing-sap-rpt-1?locale=en-US#parameters + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # (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. + parse_data_types: Optional[bool] = True + # (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. + index_column: Optional[ModelRpt1_index_column] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_index_column import ModelRpt1_index_column + + from .model_rpt1_index_column import ModelRpt1_index_column + + fields: dict[str, Callable[[Any], None]] = { + "index_column": lambda n : setattr(self, 'index_column', n.get_object_value(ModelRpt1_index_column)), + "parse_data_types": lambda n : setattr(self, 'parse_data_types', n.get_bool_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("index_column", self.index_column) + writer.write_bool_value("parse_data_types", self.parse_data_types) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5.py new file mode 100644 index 00000000..4ba1fab6 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5.py @@ -0,0 +1,65 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_5_index_column import ModelRpt1_5_index_column + from .model_rpt1_5_prediction_config import ModelRpt1_5PredictionConfig + +@dataclass +class ModelRpt1_5(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # (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. + parse_data_types: Optional[bool] = True + # (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. + index_column: Optional[ModelRpt1_5_index_column] = None + # (Optional) An object for configuring predictions. + prediction_config: Optional[ModelRpt1_5PredictionConfig] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1_5() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_5_index_column import ModelRpt1_5_index_column + from .model_rpt1_5_prediction_config import ModelRpt1_5PredictionConfig + + from .model_rpt1_5_index_column import ModelRpt1_5_index_column + from .model_rpt1_5_prediction_config import ModelRpt1_5PredictionConfig + + fields: dict[str, Callable[[Any], None]] = { + "index_column": lambda n : setattr(self, 'index_column', n.get_object_value(ModelRpt1_5_index_column)), + "parse_data_types": lambda n : setattr(self, 'parse_data_types', n.get_bool_value()), + "prediction_config": lambda n : setattr(self, 'prediction_config', n.get_object_value(ModelRpt1_5PredictionConfig)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("index_column", self.index_column) + writer.write_bool_value("parse_data_types", self.parse_data_types) + writer.write_object_value("prediction_config", self.prediction_config) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations.py new file mode 100644 index 00000000..f6c51ace --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations.py @@ -0,0 +1,58 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_5_explanations_top_relevant_context_rows import ModelRpt1_5Explanations_top_relevant_context_rows + +@dataclass +class ModelRpt1_5Explanations(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # (Optional, RPT Default: 0) Number of top column scores to return. A value of 0 disables explainability. + top_column_scores: Optional[int] = 0 + # (Optional) Number of most relevant context rows to return for each query row. + top_relevant_context_rows: Optional[ModelRpt1_5Explanations_top_relevant_context_rows] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5Explanations: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5Explanations + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1_5Explanations() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_5_explanations_top_relevant_context_rows import ModelRpt1_5Explanations_top_relevant_context_rows + + from .model_rpt1_5_explanations_top_relevant_context_rows import ModelRpt1_5Explanations_top_relevant_context_rows + + fields: dict[str, Callable[[Any], None]] = { + "top_column_scores": lambda n : setattr(self, 'top_column_scores', n.get_int_value()), + "top_relevant_context_rows": lambda n : setattr(self, 'top_relevant_context_rows', n.get_object_value(ModelRpt1_5Explanations_top_relevant_context_rows)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("top_column_scores", self.top_column_scores) + writer.write_object_value("top_relevant_context_rows", self.top_relevant_context_rows) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations_top_relevant_context_rows.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations_top_relevant_context_rows.py new file mode 100644 index 00000000..6a867cd7 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations_top_relevant_context_rows.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_5_explanations_top_relevant_context_rows_member1 import ModelRpt1_5Explanations_top_relevant_context_rowsMember1 + +@dataclass +class ModelRpt1_5Explanations_top_relevant_context_rows(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes int, ModelRpt1_5Explanations_top_relevant_context_rowsMember1 + """ + # Composed type representation for type int + integer: Optional[int] = None + # Composed type representation for type ModelRpt1_5Explanations_top_relevant_context_rowsMember1 + model_rpt1_5_explanations_top_relevant_context_rows_member1: Optional[ModelRpt1_5Explanations_top_relevant_context_rowsMember1] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5Explanations_top_relevant_context_rows: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5Explanations_top_relevant_context_rows + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ModelRpt1_5Explanations_top_relevant_context_rows() + if integer_value := parse_node.get_int_value(): + result.integer = integer_value + else: + from .model_rpt1_5_explanations_top_relevant_context_rows_member1 import ModelRpt1_5Explanations_top_relevant_context_rowsMember1 + + result.model_rpt1_5_explanations_top_relevant_context_rows_member1 = ModelRpt1_5Explanations_top_relevant_context_rowsMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_5_explanations_top_relevant_context_rows_member1 import ModelRpt1_5Explanations_top_relevant_context_rowsMember1 + + if self.model_rpt1_5_explanations_top_relevant_context_rows_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.model_rpt1_5_explanations_top_relevant_context_rows_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.integer: + writer.write_int_value(None, self.integer) + else: + writer.write_object_value(None, self.model_rpt1_5_explanations_top_relevant_context_rows_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations_top_relevant_context_rows_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations_top_relevant_context_rows_member1.py new file mode 100644 index 00000000..bd56d701 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_explanations_top_relevant_context_rows_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ModelRpt1_5Explanations_top_relevant_context_rowsMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5Explanations_top_relevant_context_rowsMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5Explanations_top_relevant_context_rowsMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1_5Explanations_top_relevant_context_rowsMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_index_column.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_index_column.py new file mode 100644 index 00000000..3f4e9229 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_index_column.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_5_index_column_member1 import ModelRpt1_5_index_columnMember1 + +@dataclass +class ModelRpt1_5_index_column(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ModelRpt1_5_index_columnMember1, str + """ + # Composed type representation for type ModelRpt1_5_index_columnMember1 + model_rpt1_5_index_column_member1: Optional[ModelRpt1_5_index_columnMember1] = None + # Composed type representation for type str + string: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5_index_column: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5_index_column + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ModelRpt1_5_index_column() + if string_value := parse_node.get_str_value(): + result.string = string_value + else: + from .model_rpt1_5_index_column_member1 import ModelRpt1_5_index_columnMember1 + + result.model_rpt1_5_index_column_member1 = ModelRpt1_5_index_columnMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_5_index_column_member1 import ModelRpt1_5_index_columnMember1 + + if self.model_rpt1_5_index_column_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.model_rpt1_5_index_column_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.string: + writer.write_str_value(None, self.string) + else: + writer.write_object_value(None, self.model_rpt1_5_index_column_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_index_column_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_index_column_member1.py new file mode 100644 index 00000000..36d9e3cb --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_index_column_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ModelRpt1_5_index_columnMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5_index_columnMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5_index_columnMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1_5_index_columnMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_prediction_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_prediction_config.py new file mode 100644 index 00000000..1e674094 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_5_prediction_config.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_5_explanations import ModelRpt1_5Explanations + +@dataclass +class ModelRpt1_5PredictionConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # (Optional) Configuration used to request explanations. + explanations: Optional[ModelRpt1_5Explanations] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_5PredictionConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_5PredictionConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1_5PredictionConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_5_explanations import ModelRpt1_5Explanations + + from .model_rpt1_5_explanations import ModelRpt1_5Explanations + + fields: dict[str, Callable[[Any], None]] = { + "explanations": lambda n : setattr(self, 'explanations', n.get_object_value(ModelRpt1_5Explanations)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("explanations", self.explanations) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_index_column.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_index_column.py new file mode 100644 index 00000000..dd7fa71d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_index_column.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1_index_column_member1 import ModelRpt1_index_columnMember1 + +@dataclass +class ModelRpt1_index_column(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ModelRpt1_index_columnMember1, str + """ + # Composed type representation for type ModelRpt1_index_columnMember1 + model_rpt1_index_column_member1: Optional[ModelRpt1_index_columnMember1] = None + # Composed type representation for type str + string: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_index_column: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_index_column + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = ModelRpt1_index_column() + if string_value := parse_node.get_str_value(): + result.string = string_value + else: + from .model_rpt1_index_column_member1 import ModelRpt1_index_columnMember1 + + result.model_rpt1_index_column_member1 = ModelRpt1_index_columnMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1_index_column_member1 import ModelRpt1_index_columnMember1 + + if self.model_rpt1_index_column_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.model_rpt1_index_column_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.string: + writer.write_str_value(None, self.string) + else: + writer.write_object_value(None, self.model_rpt1_index_column_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_index_column_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_index_column_member1.py new file mode 100644 index 00000000..61321164 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/model_rpt1_index_column_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ModelRpt1_index_columnMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ModelRpt1_index_columnMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ModelRpt1_index_columnMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ModelRpt1_index_columnMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_metadata.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_metadata.py new file mode 100644 index 00000000..a3ad2add --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_metadata.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictMetadata(AdditionalDataHolder, Parsable): + """ + Metadata about the prediction. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The num_columns property + num_columns: Optional[int] = None + # The num_predictions property + num_predictions: Optional[int] = None + # The num_query_rows property + num_query_rows: Optional[int] = None + # The num_rows property + num_rows: Optional[int] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictMetadata: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictMetadata + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictMetadata() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "num_columns": lambda n : setattr(self, 'num_columns', n.get_int_value()), + "num_predictions": lambda n : setattr(self, 'num_predictions', n.get_int_value()), + "num_query_rows": lambda n : setattr(self, 'num_query_rows', n.get_int_value()), + "num_rows": lambda n : setattr(self, 'num_rows', n.get_int_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("num_columns", self.num_columns) + writer.write_int_value("num_predictions", self.num_predictions) + writer.write_int_value("num_query_rows", self.num_query_rows) + writer.write_int_value("num_rows", self.num_rows) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request.py new file mode 100644 index 00000000..23a961cb --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request.py @@ -0,0 +1,107 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .columnar_data import ColumnarData + from .context_selection_config import ContextSelectionConfig + from .prediction_config import PredictionConfig + from .predict_request_context_rows import PredictRequest_contextRows + from .predict_request_model_config import PredictRequest_modelConfig + from .predict_request_rows import PredictRequest_rows + from .t_f_m_enum import TFMEnum + +@dataclass +class PredictRequest(AdditionalDataHolder, Parsable): + """ + Request schema for prediction endpoint. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Query-only rows in columnar form. An object mapping from column name to array of column values. + columns: Optional[ColumnarData] = None + # (Optional) Context rows in columnar form, only relevant if 'columns' is provided. An object mapping from column name to array of column values. + context_columns: Optional[ColumnarData] = None + # (Optional) Context rows in row form, only relevant if 'rows' is provided. An array of objects representing table rows. + context_rows: Optional[PredictRequest_contextRows] = None + # Context selection configuration + context_selection_config: Optional[ContextSelectionConfig] = None + # (Optional) Any additional TFM-specific configurations that will be passed to the selected TFM. + model_config: Optional[PredictRequest_modelConfig] = None + # Name of the deployed model + model_name: Optional[TFMEnum] = None + # Prediction configuration + prediction_config: Optional[PredictionConfig] = None + # Query-only rows in row form. An array of objects representing table rows. + rows: Optional[PredictRequest_rows] = None + # Scenario configuration identifier + scenario_config_name: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictRequest() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .columnar_data import ColumnarData + from .context_selection_config import ContextSelectionConfig + from .prediction_config import PredictionConfig + from .predict_request_context_rows import PredictRequest_contextRows + from .predict_request_model_config import PredictRequest_modelConfig + from .predict_request_rows import PredictRequest_rows + from .t_f_m_enum import TFMEnum + + from .columnar_data import ColumnarData + from .context_selection_config import ContextSelectionConfig + from .prediction_config import PredictionConfig + from .predict_request_context_rows import PredictRequest_contextRows + from .predict_request_model_config import PredictRequest_modelConfig + from .predict_request_rows import PredictRequest_rows + from .t_f_m_enum import TFMEnum + + fields: dict[str, Callable[[Any], None]] = { + "columns": lambda n : setattr(self, 'columns', n.get_object_value(ColumnarData)), + "contextColumns": lambda n : setattr(self, 'context_columns', n.get_object_value(ColumnarData)), + "contextRows": lambda n : setattr(self, 'context_rows', n.get_object_value(PredictRequest_contextRows)), + "contextSelectionConfig": lambda n : setattr(self, 'context_selection_config', n.get_object_value(ContextSelectionConfig)), + "modelConfig": lambda n : setattr(self, 'model_config', n.get_object_value(PredictRequest_modelConfig)), + "modelName": lambda n : setattr(self, 'model_name', n.get_enum_value(TFMEnum)), + "predictionConfig": lambda n : setattr(self, 'prediction_config', n.get_object_value(PredictionConfig)), + "rows": lambda n : setattr(self, 'rows', n.get_object_value(PredictRequest_rows)), + "scenarioConfigName": lambda n : setattr(self, 'scenario_config_name', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("columns", self.columns) + writer.write_object_value("contextColumns", self.context_columns) + writer.write_object_value("contextRows", self.context_rows) + writer.write_object_value("contextSelectionConfig", self.context_selection_config) + writer.write_object_value("modelConfig", self.model_config) + writer.write_enum_value("modelName", self.model_name) + writer.write_object_value("predictionConfig", self.prediction_config) + writer.write_object_value("rows", self.rows) + writer.write_str_value("scenarioConfigName", self.scenario_config_name) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows.py new file mode 100644 index 00000000..6c01eaad --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows.py @@ -0,0 +1,64 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .predict_request_context_rows_member1 import PredictRequest_contextRowsMember1 + from .predict_request_context_rows_member2 import PredictRequest_contextRowsMember2 + +@dataclass +class PredictRequest_contextRows(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes list[PredictRequest_contextRowsMember1], PredictRequest_contextRowsMember2 + """ + # Composed type representation for type list[PredictRequest_contextRowsMember1] + predict_request_context_rows_member1: Optional[list[PredictRequest_contextRowsMember1]] = None + # Composed type representation for type PredictRequest_contextRowsMember2 + predict_request_context_rows_member2: Optional[PredictRequest_contextRowsMember2] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_contextRows: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_contextRows + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = PredictRequest_contextRows() + if predict_request_context_rows_member1_value := parse_node.get_collection_of_object_values(PredictRequest_contextRowsMember1): + result.predict_request_context_rows_member1 = predict_request_context_rows_member1_value + else: + from .predict_request_context_rows_member2 import PredictRequest_contextRowsMember2 + + result.predict_request_context_rows_member2 = PredictRequest_contextRowsMember2() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .predict_request_context_rows_member1 import PredictRequest_contextRowsMember1 + from .predict_request_context_rows_member2 import PredictRequest_contextRowsMember2 + + if self.predict_request_context_rows_member2: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.predict_request_context_rows_member2) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.predict_request_context_rows_member1: + writer.write_collection_of_object_values(None, self.predict_request_context_rows_member1) + else: + writer.write_object_value(None, self.predict_request_context_rows_member2) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows_member1.py new file mode 100644 index 00000000..95f181a9 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows_member1.py @@ -0,0 +1,46 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictRequest_contextRowsMember1(AdditionalDataHolder, Parsable): + """ + Row-wise data format where each element is a dictionaryrepresenting a single row with column names as keys.Example:[ {"code": "new_code1", "category": "Electronics", "price": 100}, {"code": "new_code2", "category": "Clothing", "price": 50},] + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_contextRowsMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_contextRowsMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictRequest_contextRowsMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows_member2.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows_member2.py new file mode 100644 index 00000000..2a550adf --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_context_rows_member2.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictRequest_contextRowsMember2(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_contextRowsMember2: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_contextRowsMember2 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictRequest_contextRowsMember2() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_model_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_model_config.py new file mode 100644 index 00000000..05395fa4 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_model_config.py @@ -0,0 +1,73 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .model_rpt1 import ModelRpt1 + from .model_rpt1_5 import ModelRpt1_5 + +@dataclass +class PredictRequest_modelConfig(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes ModelRpt1, ModelRpt1_5 + """ + # Composed type representation for type ModelRpt1 + model_rpt1: Optional[ModelRpt1] = None + # Composed type representation for type ModelRpt1_5 + model_rpt1_5: Optional[ModelRpt1_5] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_modelConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_modelConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + try: + child_node = parse_node.get_child_node("") + mapping_value = child_node.get_str_value() if child_node else None + except AttributeError: + mapping_value = None + result = PredictRequest_modelConfig() + if mapping_value and mapping_value.casefold() == "ModelRpt1".casefold(): + from .model_rpt1 import ModelRpt1 + + result.model_rpt1 = ModelRpt1() + elif mapping_value and mapping_value.casefold() == "ModelRpt1_5".casefold(): + from .model_rpt1_5 import ModelRpt1_5 + + result.model_rpt1_5 = ModelRpt1_5() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .model_rpt1 import ModelRpt1 + from .model_rpt1_5 import ModelRpt1_5 + + if self.model_rpt1: + return self.model_rpt1.get_field_deserializers() + if self.model_rpt1_5: + return self.model_rpt1_5.get_field_deserializers() + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.model_rpt1: + writer.write_object_value(None, self.model_rpt1) + elif self.model_rpt1_5: + writer.write_object_value(None, self.model_rpt1_5) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows.py new file mode 100644 index 00000000..d4a7b7b9 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows.py @@ -0,0 +1,64 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .predict_request_rows_member1 import PredictRequest_rowsMember1 + from .predict_request_rows_member2 import PredictRequest_rowsMember2 + +@dataclass +class PredictRequest_rows(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes list[PredictRequest_rowsMember1], PredictRequest_rowsMember2 + """ + # Composed type representation for type list[PredictRequest_rowsMember1] + predict_request_rows_member1: Optional[list[PredictRequest_rowsMember1]] = None + # Composed type representation for type PredictRequest_rowsMember2 + predict_request_rows_member2: Optional[PredictRequest_rowsMember2] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_rows: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_rows + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = PredictRequest_rows() + if predict_request_rows_member1_value := parse_node.get_collection_of_object_values(PredictRequest_rowsMember1): + result.predict_request_rows_member1 = predict_request_rows_member1_value + else: + from .predict_request_rows_member2 import PredictRequest_rowsMember2 + + result.predict_request_rows_member2 = PredictRequest_rowsMember2() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .predict_request_rows_member1 import PredictRequest_rowsMember1 + from .predict_request_rows_member2 import PredictRequest_rowsMember2 + + if self.predict_request_rows_member2: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.predict_request_rows_member2) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.predict_request_rows_member1: + writer.write_collection_of_object_values(None, self.predict_request_rows_member1) + else: + writer.write_object_value(None, self.predict_request_rows_member2) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows_member1.py new file mode 100644 index 00000000..c387dbde --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows_member1.py @@ -0,0 +1,46 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictRequest_rowsMember1(AdditionalDataHolder, Parsable): + """ + Row-wise data format where each element is a dictionaryrepresenting a single row with column names as keys.Example:[ {"code": "new_code1", "category": "Electronics", "price": 100}, {"code": "new_code2", "category": "Clothing", "price": 50},] + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_rowsMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_rowsMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictRequest_rowsMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows_member2.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows_member2.py new file mode 100644 index 00000000..f196f5f1 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_request_rows_member2.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictRequest_rowsMember2(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictRequest_rowsMember2: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictRequest_rowsMember2 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictRequest_rowsMember2() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_response.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_response.py new file mode 100644 index 00000000..7f9f3de8 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_response.py @@ -0,0 +1,79 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .predict_metadata import PredictMetadata + from .predict_response_predictions import PredictResponse_predictions + from .predict_status import PredictStatus + +@dataclass +class PredictResponse(AdditionalDataHolder, Parsable): + """ + Response schema for prediction endpoint. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # Warnings or informational messages from context selection + additional_information: Optional[list[str]] = None + # The id property + id: Optional[str] = None + # Metadata about the prediction. + metadata: Optional[PredictMetadata] = None + # The predictions property + predictions: Optional[list[PredictResponse_predictions]] = None + # Status of the prediction. + status: Optional[PredictStatus] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictResponse: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictResponse + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictResponse() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .predict_metadata import PredictMetadata + from .predict_response_predictions import PredictResponse_predictions + from .predict_status import PredictStatus + + from .predict_metadata import PredictMetadata + from .predict_response_predictions import PredictResponse_predictions + from .predict_status import PredictStatus + + fields: dict[str, Callable[[Any], None]] = { + "additional_information": lambda n : setattr(self, 'additional_information', n.get_collection_of_primitive_values(str)), + "id": lambda n : setattr(self, 'id', n.get_str_value()), + "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(PredictMetadata)), + "predictions": lambda n : setattr(self, 'predictions', n.get_collection_of_object_values(PredictResponse_predictions)), + "status": lambda n : setattr(self, 'status', n.get_object_value(PredictStatus)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_primitive_values("additional_information", self.additional_information) + writer.write_str_value("id", self.id) + writer.write_object_value("metadata", self.metadata) + writer.write_collection_of_object_values("predictions", self.predictions) + writer.write_object_value("status", self.status) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_response_predictions.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_response_predictions.py new file mode 100644 index 00000000..8f002cec --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_response_predictions.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictResponse_predictions(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictResponse_predictions: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictResponse_predictions + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictResponse_predictions() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_status.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_status.py new file mode 100644 index 00000000..9857b8d2 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/predict_status.py @@ -0,0 +1,54 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class PredictStatus(AdditionalDataHolder, Parsable): + """ + Status of the prediction. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The code property + code: Optional[int] = None + # The message property + message: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictStatus: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictStatus + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictStatus() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "code": lambda n : setattr(self, 'code', n.get_int_value()), + "message": lambda n : setattr(self, 'message', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_int_value("code", self.code) + writer.write_str_value("message", self.message) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/prediction_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/prediction_config.py new file mode 100644 index 00000000..7b5bcb0e --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/prediction_config.py @@ -0,0 +1,53 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .target_column import TargetColumn + +@dataclass +class PredictionConfig(Parsable): + """ + Configuration for what to predict.Model-agnostic prediction config. Only contains fields shared acrossall TFMs. Model-specific fields belong in `PredictRequest.modelConfig`. + """ + # List of target columns with prediction configuration + target_columns: Optional[list[TargetColumn]] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> PredictionConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: PredictionConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return PredictionConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .target_column import TargetColumn + + from .target_column import TargetColumn + + fields: dict[str, Callable[[Any], None]] = { + "targetColumns": lambda n : setattr(self, 'target_columns', n.get_collection_of_object_values(TargetColumn)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_collection_of_object_values("targetColumns", self.target_columns) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config.py new file mode 100644 index 00000000..60f2a7ef --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config.py @@ -0,0 +1,78 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .sampling_heuristic_config_pool_size import SamplingHeuristicConfig_poolSize + +@dataclass +class SamplingHeuristicConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # When true, heuristic sampling falls back to random on timeout instead of raising an error. Set by the orchestrator when strategy=AUTO. + allow_timeout_fallback: Optional[bool] = False + # Max CASE WHEN expressions per subquery chunk (avoids HANA parse-tree depth limit). + chunk_size: Optional[int] = 100 + # Column count above which chunked SQL is used instead of a flat query. + chunk_threshold: Optional[int] = 150 + # 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. + fuzzy_date_days: Optional[int] = 30 + # Numeric fuzzy threshold as a fraction of the absolute query value. E.g. 0.1 = +/-10%. + fuzzy_num_pct: Optional[float] = 0.1 + # Fraction of numRows filled by scoring method (remainder is random fill). Must be between 0 and 1. + method_ratio: Optional[float] = 0.67 + # If set, scoring runs against a random subsample of this many rows instead of the full table. None = full table scan. + pool_size: Optional[SamplingHeuristicConfig_poolSize] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SamplingHeuristicConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SamplingHeuristicConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SamplingHeuristicConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .sampling_heuristic_config_pool_size import SamplingHeuristicConfig_poolSize + + from .sampling_heuristic_config_pool_size import SamplingHeuristicConfig_poolSize + + fields: dict[str, Callable[[Any], None]] = { + "allowTimeoutFallback": lambda n : setattr(self, 'allow_timeout_fallback', n.get_bool_value()), + "chunkSize": lambda n : setattr(self, 'chunk_size', n.get_int_value()), + "chunkThreshold": lambda n : setattr(self, 'chunk_threshold', n.get_int_value()), + "fuzzyDateDays": lambda n : setattr(self, 'fuzzy_date_days', n.get_int_value()), + "fuzzyNumPct": lambda n : setattr(self, 'fuzzy_num_pct', n.get_float_value()), + "methodRatio": lambda n : setattr(self, 'method_ratio', n.get_float_value()), + "poolSize": lambda n : setattr(self, 'pool_size', n.get_object_value(SamplingHeuristicConfig_poolSize)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_bool_value("allowTimeoutFallback", self.allow_timeout_fallback) + writer.write_int_value("chunkSize", self.chunk_size) + writer.write_int_value("chunkThreshold", self.chunk_threshold) + writer.write_int_value("fuzzyDateDays", self.fuzzy_date_days) + writer.write_float_value("fuzzyNumPct", self.fuzzy_num_pct) + writer.write_float_value("methodRatio", self.method_ratio) + writer.write_object_value("poolSize", self.pool_size) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config_pool_size.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config_pool_size.py new file mode 100644 index 00000000..47fee13e --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config_pool_size.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .sampling_heuristic_config_pool_size_member1 import SamplingHeuristicConfig_poolSizeMember1 + +@dataclass +class SamplingHeuristicConfig_poolSize(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes int, SamplingHeuristicConfig_poolSizeMember1 + """ + # Composed type representation for type int + integer: Optional[int] = None + # Composed type representation for type SamplingHeuristicConfig_poolSizeMember1 + sampling_heuristic_config_pool_size_member1: Optional[SamplingHeuristicConfig_poolSizeMember1] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SamplingHeuristicConfig_poolSize: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SamplingHeuristicConfig_poolSize + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = SamplingHeuristicConfig_poolSize() + if integer_value := parse_node.get_int_value(): + result.integer = integer_value + else: + from .sampling_heuristic_config_pool_size_member1 import SamplingHeuristicConfig_poolSizeMember1 + + result.sampling_heuristic_config_pool_size_member1 = SamplingHeuristicConfig_poolSizeMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .sampling_heuristic_config_pool_size_member1 import SamplingHeuristicConfig_poolSizeMember1 + + if self.sampling_heuristic_config_pool_size_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.sampling_heuristic_config_pool_size_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.integer: + writer.write_int_value(None, self.integer) + else: + writer.write_object_value(None, self.sampling_heuristic_config_pool_size_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config_pool_size_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config_pool_size_member1.py new file mode 100644 index 00000000..3e5c177f --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_heuristic_config_pool_size_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SamplingHeuristicConfig_poolSizeMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SamplingHeuristicConfig_poolSizeMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SamplingHeuristicConfig_poolSizeMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SamplingHeuristicConfig_poolSizeMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_random_config.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_random_config.py new file mode 100644 index 00000000..d6b1bc97 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/sampling_random_config.py @@ -0,0 +1,47 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class SamplingRandomConfig(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # When true, uses HASH_SHA256 of indexColumn for ordering instead of RAND(), producing the same row order on every call for the same data. + deterministic: Optional[bool] = False + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> SamplingRandomConfig: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: SamplingRandomConfig + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return SamplingRandomConfig() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + "deterministic": lambda n : setattr(self, 'deterministic', n.get_bool_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_bool_value("deterministic", self.deterministic) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/t_f_m_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/t_f_m_enum.py new file mode 100644 index 00000000..3ad01bdd --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/t_f_m_enum.py @@ -0,0 +1,8 @@ +from enum import Enum + +class TFMEnum(str, Enum): + SapRpt1Small = "sap-rpt-1-small", + SapRpt1Large = "sap-rpt-1-large", + SapRpt15 = "sap-rpt-1.5", + SapRpt15Large = "sap-rpt-1.5-large", + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column.py new file mode 100644 index 00000000..5aae4df3 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column.py @@ -0,0 +1,74 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .target_column_top_k import TargetColumn_top_k + from .task_type_enum import TaskTypeEnum + +@dataclass +class TargetColumn(AdditionalDataHolder, Parsable): + """ + Configuration for a target column to predict. + """ + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # (Optional) Placeholder value indicating cells to predict + prediction_placeholder: Optional[str] = "[PREDICT]" + from .task_type_enum import TaskTypeEnum + + # (Optional) Type of prediction task (classification or regression) + task_type: Optional[TaskTypeEnum] = TaskTypeEnum("classification") + # Name of the column to predict + name: Optional[str] = None + # (Optional) Controls how many labels to predict for each column in each row. Only applicable to 'classification' task type. + top_k: Optional[TargetColumn_top_k] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> TargetColumn: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: TargetColumn + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return TargetColumn() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .target_column_top_k import TargetColumn_top_k + from .task_type_enum import TaskTypeEnum + + from .target_column_top_k import TargetColumn_top_k + from .task_type_enum import TaskTypeEnum + + fields: dict[str, Callable[[Any], None]] = { + "name": lambda n : setattr(self, 'name', n.get_str_value()), + "prediction_placeholder": lambda n : setattr(self, 'prediction_placeholder', n.get_str_value()), + "task_type": lambda n : setattr(self, 'task_type', n.get_enum_value(TaskTypeEnum)), + "top_k": lambda n : setattr(self, 'top_k', n.get_object_value(TargetColumn_top_k)), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_str_value("name", self.name) + writer.write_str_value("prediction_placeholder", self.prediction_placeholder) + writer.write_enum_value("task_type", self.task_type) + writer.write_object_value("top_k", self.top_k) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column_top_k.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column_top_k.py new file mode 100644 index 00000000..45ea7df0 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column_top_k.py @@ -0,0 +1,62 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import ComposedTypeWrapper, Parsable, ParseNode, ParseNodeHelper, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .target_column_top_k_member1 import TargetColumn_top_kMember1 + +@dataclass +class TargetColumn_top_k(ComposedTypeWrapper, Parsable): + """ + Composed type wrapper for classes int, TargetColumn_top_kMember1 + """ + # Composed type representation for type int + integer: Optional[int] = None + # Composed type representation for type TargetColumn_top_kMember1 + target_column_top_k_member1: Optional[TargetColumn_top_kMember1] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> TargetColumn_top_k: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: TargetColumn_top_k + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + result = TargetColumn_top_k() + if integer_value := parse_node.get_int_value(): + result.integer = integer_value + else: + from .target_column_top_k_member1 import TargetColumn_top_kMember1 + + result.target_column_top_k_member1 = TargetColumn_top_kMember1() + return result + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .target_column_top_k_member1 import TargetColumn_top_kMember1 + + if self.target_column_top_k_member1: + return ParseNodeHelper.merge_deserializers_for_intersection_wrapper(self.target_column_top_k_member1) + return {} + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + if self.integer: + writer.write_int_value(None, self.integer) + else: + writer.write_object_value(None, self.target_column_top_k_member1) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column_top_k_member1.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column_top_k_member1.py new file mode 100644 index 00000000..12f4d957 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/target_column_top_k_member1.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class TargetColumn_top_kMember1(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> TargetColumn_top_kMember1: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: TargetColumn_top_kMember1 + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return TargetColumn_top_kMember1() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/task_type_enum.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/task_type_enum.py new file mode 100644 index 00000000..878d4f01 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/task_type_enum.py @@ -0,0 +1,6 @@ +from enum import Enum + +class TaskTypeEnum(str, Enum): + Classification = "classification", + Regression = "regression", + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/validation_error.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/validation_error.py new file mode 100644 index 00000000..d7743b31 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/validation_error.py @@ -0,0 +1,66 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .validation_error_ctx import ValidationError_ctx + +@dataclass +class ValidationError(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + # The ctx property + ctx: Optional[ValidationError_ctx] = None + # The loc property + loc: Optional[list[str]] = None + # The msg property + msg: Optional[str] = None + # The type property + type: Optional[str] = None + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ValidationError: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ValidationError + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ValidationError() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + from .validation_error_ctx import ValidationError_ctx + + from .validation_error_ctx import ValidationError_ctx + + fields: dict[str, Callable[[Any], None]] = { + "ctx": lambda n : setattr(self, 'ctx', n.get_object_value(ValidationError_ctx)), + "loc": lambda n : setattr(self, 'loc', n.get_collection_of_primitive_values(str)), + "msg": lambda n : setattr(self, 'msg', n.get_str_value()), + "type": lambda n : setattr(self, 'type', n.get_str_value()), + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_object_value("ctx", self.ctx) + writer.write_collection_of_primitive_values("loc", self.loc) + writer.write_str_value("msg", self.msg) + writer.write_str_value("type", self.type) + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/validation_error_ctx.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/validation_error_ctx.py new file mode 100644 index 00000000..62a149c9 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/models/validation_error_ctx.py @@ -0,0 +1,43 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter +from typing import Any, Optional, TYPE_CHECKING, Union + +@dataclass +class ValidationError_ctx(AdditionalDataHolder, Parsable): + # Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additional_data: dict[str, Any] = field(default_factory=dict) + + + @staticmethod + def create_from_discriminator_value(parse_node: ParseNode) -> ValidationError_ctx: + """ + Creates a new instance of the appropriate class based on discriminator value + param parse_node: The parse node to use to read the discriminator value and create the object + Returns: ValidationError_ctx + """ + if parse_node is None: + raise TypeError("parse_node cannot be null.") + return ValidationError_ctx() + + def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]: + """ + The deserialization information for the current model + Returns: dict[str, Callable[[ParseNode], None]] + """ + fields: dict[str, Callable[[Any], None]] = { + } + return fields + + def serialize(self,writer: SerializationWriter) -> None: + """ + Serializes information the current object + param writer: Serialization writer to use to serialize this model + Returns: None + """ + if writer is None: + raise TypeError("writer cannot be null.") + writer.write_additional_data_value(self.additional_data) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/predict/predict_request_builder.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/predict/predict_request_builder.py new file mode 100644 index 00000000..aa14b8f6 --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/predict/predict_request_builder.py @@ -0,0 +1,89 @@ +from __future__ import annotations +from collections.abc import Callable +from dataclasses import dataclass, field +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.base_request_configuration import RequestConfiguration +from kiota_abstractions.default_query_parameters import QueryParameters +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.method import Method +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.request_information import RequestInformation +from kiota_abstractions.request_option import RequestOption +from kiota_abstractions.serialization import Parsable, ParsableFactory +from typing import Any, Optional, TYPE_CHECKING, Union +from warnings import warn + +if TYPE_CHECKING: + from ..models.h_t_t_p_validation_error import HTTPValidationError + from ..models.predict_request import PredictRequest + from ..models.predict_response import PredictResponse + +class PredictRequestBuilder(BaseRequestBuilder): + """ + Builds and executes requests for operations under /predict + """ + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: + """ + Instantiates a new PredictRequestBuilder and sets the default values. + param path_parameters: The raw url or the url-template parameters for the request. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + super().__init__(request_adapter, "{+baseurl}/predict", path_parameters) + + async def post(self,body: PredictRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[PredictResponse]: + """ + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + param body: Request schema for prediction endpoint. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: Optional[PredictResponse] + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = self.to_post_request_information( + body, request_configuration + ) + from ..models.h_t_t_p_validation_error import HTTPValidationError + + error_mapping: dict[str, type[ParsableFactory]] = { + "422": HTTPValidationError, + } + if not self.request_adapter: + raise Exception("Http core is null") + from ..models.predict_response import PredictResponse + + return await self.request_adapter.send_async(request_info, PredictResponse, error_mapping) + + def to_post_request_information(self,body: PredictRequest, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation: + """ + Make predictions for tabular data using a deployed Tabular Foundation Model. Required Headers: - ai-resource-group: AI Core resource group identifier + param body: Request schema for prediction endpoint. + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. + Returns: RequestInformation + """ + if body is None: + raise TypeError("body cannot be null.") + request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters) + request_info.configure(request_configuration) + request_info.headers.try_add("Accept", "application/json") + request_info.set_content_from_parsable(self.request_adapter, "application/json", body) + return request_info + + def with_url(self,raw_url: str) -> PredictRequestBuilder: + """ + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + param raw_url: The raw URL to use for the request builder. + Returns: PredictRequestBuilder + """ + if raw_url is None: + raise TypeError("raw_url cannot be null.") + return PredictRequestBuilder(self.request_adapter, raw_url) + + @dataclass + class PredictRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]): + """ + Configuration for the request such as headers, query parameters, and middleware options. + """ + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) + + diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/py.typed b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/tab_ai_orchestration_client.py b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/tab_ai_orchestration_client.py new file mode 100644 index 00000000..e2919d2d --- /dev/null +++ b/packages/gen/gen_ai_hub/tab_ai_orchestration_kiota/generated/tab_ai_orchestration_client.py @@ -0,0 +1,53 @@ +from __future__ import annotations +from collections.abc import Callable +from kiota_abstractions.api_client_builder import enable_backing_store_for_serialization_writer_factory, register_default_deserializer, register_default_serializer +from kiota_abstractions.base_request_builder import BaseRequestBuilder +from kiota_abstractions.get_path_parameters import get_path_parameters +from kiota_abstractions.request_adapter import RequestAdapter +from kiota_abstractions.serialization import ParseNodeFactoryRegistry, SerializationWriterFactoryRegistry +from kiota_serialization_form.form_parse_node_factory import FormParseNodeFactory +from kiota_serialization_form.form_serialization_writer_factory import FormSerializationWriterFactory +from kiota_serialization_json.json_parse_node_factory import JsonParseNodeFactory +from kiota_serialization_json.json_serialization_writer_factory import JsonSerializationWriterFactory +from kiota_serialization_multipart.multipart_serialization_writer_factory import MultipartSerializationWriterFactory +from kiota_serialization_text.text_parse_node_factory import TextParseNodeFactory +from kiota_serialization_text.text_serialization_writer_factory import TextSerializationWriterFactory +from typing import Any, Optional, TYPE_CHECKING, Union + +if TYPE_CHECKING: + from .predict.predict_request_builder import PredictRequestBuilder + +class TabAiOrchestrationClient(BaseRequestBuilder): + """ + The main entry point of the SDK, exposes the configuration and the fluent API. + """ + def __init__(self,request_adapter: RequestAdapter) -> None: + """ + Instantiates a new TabAiOrchestrationClient and sets the default values. + param request_adapter: The request adapter to use to execute the requests. + Returns: None + """ + if request_adapter is None: + raise TypeError("request_adapter cannot be null.") + super().__init__(request_adapter, "{+baseurl}", None) + register_default_serializer(JsonSerializationWriterFactory) + register_default_serializer(TextSerializationWriterFactory) + register_default_serializer(FormSerializationWriterFactory) + register_default_serializer(MultipartSerializationWriterFactory) + register_default_deserializer(JsonParseNodeFactory) + register_default_deserializer(TextParseNodeFactory) + register_default_deserializer(FormParseNodeFactory) + if not self.request_adapter.base_url: + self.request_adapter.base_url = "/v1" + self.path_parameters["base_url"] = self.request_adapter.base_url + + @property + def predict(self) -> PredictRequestBuilder: + """ + The predict property + """ + from .predict.predict_request_builder import PredictRequestBuilder + + return PredictRequestBuilder(self.request_adapter, self.path_parameters) + + diff --git a/packages/gen/openapitools.json b/packages/gen/openapitools.json new file mode 100644 index 00000000..8dd0d745 --- /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/pyproject.toml b/packages/gen/pyproject.toml index 9c0befc6..da24033d 100644 --- a/packages/gen/pyproject.toml +++ b/packages/gen/pyproject.toml @@ -53,6 +53,14 @@ dependencies = [ google = ["google-genai~=2.20.0", "langchain-google-genai~=4.3.1"] amazon = ["boto3>=1.40.61", "aiobotocore>=3.2.0", "langchain-aws~=1.7.0"] all = ["sap-ai-sdk-gen[google,amazon]"] +kiota = [ + "microsoft-kiota-abstractions>=1.4.0", + "microsoft-kiota-http>=1.3.0", + "microsoft-kiota-serialization-json>=1.1.0", + "microsoft-kiota-serialization-text>=1.1.0", + "microsoft-kiota-serialization-form>=1.1.0", + "microsoft-kiota-serialization-multipart>=1.1.0", +] [dependency-groups] dev = [ diff --git a/packages/gen/specs/document-grounding/api.yaml b/packages/gen/specs/document-grounding/api.yaml new file mode 100644 index 00000000..44d28468 --- /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 00000000..c4fd2260 --- /dev/null +++ b/packages/gen/specs/document-grounding/options-per-service.json @@ -0,0 +1,11 @@ +{ + "api.yaml": { + "directoryName": "gen_ai_hub/document_grounding_generation/generated", + "basePath": "/lm/document-grounding", + "kiota": { + "className": "DocumentGroundingClient", + "namespaceName": "gen_ai_hub.document_grounding_generation_kiota.generated", + "directoryName": "gen_ai_hub/document_grounding_generation_kiota/generated" + } + } +} 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 00000000..80227263 --- /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 00000000..b1efab05 --- /dev/null +++ b/packages/gen/specs/tab-ai-orchestration/options-per-service.json @@ -0,0 +1,11 @@ +{ + "api.yaml": { + "directoryName": "gen_ai_hub/tab_ai_orchestration/generated", + "basePath": "/v1", + "kiota": { + "className": "TabAiOrchestrationClient", + "namespaceName": "gen_ai_hub.tab_ai_orchestration_kiota.generated", + "directoryName": "gen_ai_hub/tab_ai_orchestration_kiota/generated" + } + } +} diff --git a/packages/kiota-generator/pyproject.toml b/packages/kiota-generator/pyproject.toml new file mode 100644 index 00000000..7abe31cb --- /dev/null +++ b/packages/kiota-generator/pyproject.toml @@ -0,0 +1,34 @@ +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[project] +name = "sap-kiota-generator" +version = "0.1.0" +description = "SAP Cloud SDK for AI (Python): Kiota-based OpenAPI code generation tooling" +license = "Apache-2.0" +license-files = ["LICENSE"] +authors = [{ name = "SAP SE" }] +requires-python = ">=3.10" +dependencies = [ + "PyYAML>=6.0", + "sap-openapi-generator>=0.1.0", +] + +[project.scripts] +sap-kiota-generate = "sap_kiota_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"] + +[tool.uv.sources] +sap-openapi-generator = { workspace = true } diff --git a/packages/kiota-generator/src/sap_kiota_generator/__init__.py b/packages/kiota-generator/src/sap_kiota_generator/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/kiota-generator/src/sap_kiota_generator/generate.py b/packages/kiota-generator/src/sap_kiota_generator/generate.py new file mode 100644 index 00000000..392401a9 --- /dev/null +++ b/packages/kiota-generator/src/sap_kiota_generator/generate.py @@ -0,0 +1,208 @@ +"""End-to-end Kiota generation pipeline for SAP Cloud SDK Python packages. + +Mirrors the sap-generate interface so both generators are interchangeable: + + sap-kiota-generate -i -o [-s ] + +For each spec file found under : + 1. Reads per-service options from options-per-service.json (directoryName, basePath, + and a nested "kiota" object with className / namespaceName) + 2. Pre-processes the spec (vendor extension resolution, base-path injection) via + the shared sap_openapi_generator.preprocess_spec module + 3. Invokes the Kiota CLI (must be on PATH: `kiota generate -l python ...`) + 4. Moves generated output into place under // + 5. Touches py.typed + +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) + kiota - nested object with Kiota-specific options: + className - root client class name (default: ApiClient) + namespaceName - Python namespace / module prefix (default: generated) +""" + +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, load_spec, dump_spec + +_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 PurePosixPath(spec_path.relative_to(input_dir)).as_posix() + + +def _strip_security(spec_path: Path) -> None: + """Remove securitySchemes and security fields from a preprocessed spec. + + Kiota's OpenAPI parser enforces RFC-3986 URI validity on OAuth flow URLs. + SAP specs often contain placeholder values (e.g. tokenUrl with parenthesised + template variables) that are invalid URIs. Since auth is handled by the SAP + wrapper client — not by Kiota — stripping these fields is safe. + """ + spec = load_spec(spec_path) + spec.pop("security", None) + components = spec.get("components", {}) + components.pop("securitySchemes", None) + if not components: + spec.pop("components", None) + # Also remove per-operation security overrides + for path_item in spec.get("paths", {}).values(): + if not isinstance(path_item, dict): + continue + for method in ("get", "post", "put", "delete", "patch", "options", "head", "trace"): + op = path_item.get(method) + if isinstance(op, dict): + op.pop("security", None) + dump_spec(spec, spec_path) + + +def generate_one( + spec_path: Path, + output_dir: Path, + kiota_class_name: str, + kiota_namespace: str, + options_path: Path | None = None, + spec_key: str | None = None, +) -> None: + with tempfile.TemporaryDirectory(prefix="sap-kiota-") as tmp: + tmp_path = Path(tmp) + processed = tmp_path / "processed.yaml" + gen_tmp = tmp_path / "gen-tmp" + + preprocess( + input_path=spec_path, + output_path=processed, + options_path=options_path, + spec_key=spec_key, + ) + + # Kiota's OpenAPI parser rejects invalid URIs in securitySchemes (e.g. placeholder + # tokenUrl values like "https://(subdomain).auth.(host)/token"). Strip security + # definitions entirely — auth is handled by the SAP wrapper client, not by Kiota. + _strip_security(processed) + + cmd = [ + "kiota", "generate", + "-l", "python", + "-d", str(processed), + "-o", str(gen_tmp), + "-c", kiota_class_name, + "-n", kiota_namespace, + "--clean-output", + "--exclude-backward-compatible", + ] + + result = subprocess.run(cmd, check=False) + if result.returncode != 0: + sys.exit(result.returncode) + + if not gen_tmp.exists(): + print(f"ERROR: expected generated output at {gen_tmp}", file=sys.stderr) + sys.exit(1) + + if output_dir.exists(): + shutil.rmtree(output_dir) + shutil.copytree(str(gen_tmp), str(output_dir)) + + (output_dir / "py.typed").touch() + + +def generate( + input_path: Path, + output_dir: Path, + options_per_service_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) + + kiota_opts = opts.get("kiota", {}) + kiota_class_name = kiota_opts.get("className", "ApiClient") + # kiota.directoryName overrides the top-level directoryName for the Kiota output + kiota_directory = kiota_opts.get("directoryName", directory_name) + # Derive a default namespace from the kiota directory if not specified + default_namespace = kiota_directory.replace("/", ".") + kiota_namespace = kiota_opts.get("namespaceName", default_namespace) + + service_output = output_dir / kiota_directory + + generate_one( + spec_path=spec, + output_dir=service_output, + kiota_class_name=kiota_class_name, + kiota_namespace=kiota_namespace, + options_path=options_per_service_path, + spec_key=key, + ) + print(f"Generated (kiota): {key} → {service_output}") + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Generate Python API clients from OpenAPI specs using Kiota (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)", + ) + args = parser.parse_args() + generate( + input_path=args.input, + output_dir=args.outputDir, + options_per_service_path=args.optionsPerService, + ) + + +if __name__ == "__main__": + main() diff --git a/packages/openapi-generator/Makefile b/packages/openapi-generator/Makefile new file mode 100644 index 00000000..8914136c --- /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 00000000..698719e5 --- /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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: [ + [{{{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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: [ + {_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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{^items.isEnumOrRef}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: [{{{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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/items.isContainer}} + {{/isArray}} + {{#isMap}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + {{#items.isContainer}} + {{#items.isMap}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: 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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: { + _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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: 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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: 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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: obj.get({{{vendorExtensions.x-py-wire-name-literal}}}){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: {{{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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: 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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: 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}} + {{#lambda.pythonStringLiteral}}{{{name}}}{{/lambda.pythonStringLiteral}}: 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 00000000..ab3b1af0 --- /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 00000000..e582bd15 --- /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 00000000..83f8e9c6 --- /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 00000000..8e834508 --- /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 00000000..64400a9e --- /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 00000000..1686704b --- /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 00000000..eae4dd63 --- /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 00000000..7f71e70d --- /dev/null +++ b/sample-code/sample_code/document_grounding_generation.py @@ -0,0 +1,30 @@ +from gen_ai_hub.document_grounding_generation import ( + GroundingApiClient, + DataRepositoryType, + FiltersInner, + RetrievalApi, + RetrievalSearchConfiguration, + RetrievalSearchFilter, + RetrievalSearchInput, +) + + +async def retrieval_search(): + result = await RetrievalApi(GroundingApiClient()).search( + ai_resource_group="default", + retrieval_search_input=RetrievalSearchInput( + query="Features of Generative AI Hub", + filters=[ + FiltersInner( + RetrievalSearchFilter( + id="SAPHelp", + data_repository_type=DataRepositoryType.HELP_DOT_SAP_DOT_COM, + search_configuration=RetrievalSearchConfiguration( + max_chunk_count=5 + ), + ) + ) + ], + ), + ) + return {"result": result.to_dict()} diff --git a/sample-code/sample_code/document_grounding_kiota.py b/sample-code/sample_code/document_grounding_kiota.py new file mode 100644 index 00000000..70083612 --- /dev/null +++ b/sample-code/sample_code/document_grounding_kiota.py @@ -0,0 +1,47 @@ +"""Sample: Document Grounding search using the Kiota-generated client. + +The Kiota client uses a request-builder tree. After running `make generate-kiota`, +the generated root client (`DocumentGroundingClient`) exposes path segments as +properties, e.g.: + + client.generated.retrieval.search.post(body) + +The request and response models live under: + gen_ai_hub.document_grounding_generation_kiota.generated.models.* +""" + +from gen_ai_hub.document_grounding_generation_kiota import KiotaGroundingApiClient + +# These model classes are generated by `make generate-kiota` and will be available +# under gen_ai_hub.document_grounding_generation_kiota.generated.models.* +# Imported lazily here so the module can be imported even before generation is run. + + +async def retrieval_search(): + from gen_ai_hub.document_grounding_generation_kiota.generated.models.retrieval_search_input import ( + RetrievalSearchInput, + ) + from gen_ai_hub.document_grounding_generation_kiota.generated.models.retrieval_search_filter import ( + RetrievalSearchFilter, + ) + from gen_ai_hub.document_grounding_generation_kiota.generated.models.retrieval_search_configuration import ( + RetrievalSearchConfiguration, + ) + + client = KiotaGroundingApiClient() + + body = RetrievalSearchInput() + body.query = "Features of Generative AI Hub" + + search_filter = RetrievalSearchFilter() + search_filter.id = "SAPHelp" + search_filter.data_repository_type = "help.sap.com" + + search_config = RetrievalSearchConfiguration() + search_config.max_chunk_count = 5 + search_filter.search_configuration = search_config + + body.filters = [search_filter] + + result = await client.generated.retrieval.search.post(body) + return {"result": result} diff --git a/sample-code/sample_code/server.py b/sample-code/sample_code/server.py index 4e011e3b..0259a420 100644 --- a/sample-code/sample_code/server.py +++ b/sample-code/sample_code/server.py @@ -1,7 +1,17 @@ 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, + document_grounding_kiota, + google, + openai, + orchestration, + tab_ai_orchestration, + tab_ai_orchestration_kiota, +) app = FastAPI(title="SAP AI Core Python SDK Sample Application") @@ -68,3 +78,25 @@ 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.get("/document-grounding-generation/retrieval/search")( + document_grounding_generation.retrieval_search +) + +# Document Grounding Generation (Kiota-generated client) +app.get("/kiota/document-grounding/retrieval/search")( + document_grounding_kiota.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 +) + +# Tabular AI Orchestration (Kiota-generated client) +app.get("/kiota/tab-ai-orchestration/predict")(tab_ai_orchestration_kiota.predict) +app.get("/kiota/tab-ai-orchestration/predict-with-explanations")( + tab_ai_orchestration_kiota.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 00000000..04632cb1 --- /dev/null +++ b/sample-code/sample_code/tab_ai_orchestration.py @@ -0,0 +1,125 @@ +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( + 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( + predict_request=request, + ) + + return response.to_dict() diff --git a/sample-code/sample_code/tab_ai_orchestration_kiota.py b/sample-code/sample_code/tab_ai_orchestration_kiota.py new file mode 100644 index 00000000..2404fdf4 --- /dev/null +++ b/sample-code/sample_code/tab_ai_orchestration_kiota.py @@ -0,0 +1,42 @@ +"""Sample: Tabular AI Orchestration predictions using the Kiota-generated client. + +The Kiota client exposes a request-builder tree. After running `make generate-kiota`, +the generated root client (`TabAiOrchestrationClient`) exposes: + + client.generated.predict.post(body) # POST /predict + client.generated.predict.with_http_info(...) # raw response + +The request and response models live under: + gen_ai_hub.tab_ai_orchestration_kiota.generated.models.* +""" + +from gen_ai_hub.tab_ai_orchestration_kiota import KiotaTabAiOrchestrationClient + + +async def predict(): + from gen_ai_hub.tab_ai_orchestration_kiota.generated.models.predict_request import ( + PredictRequest, + ) + + async with KiotaTabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + body = PredictRequest() + # Populate body fields as required by your deployment's schema. + # See gen_ai_hub.tab_ai_orchestration_kiota.generated.models for all model classes. + result = await client.generated.predict.post(body) + return {"result": result} + + +async def predict_with_explanations(): + from gen_ai_hub.tab_ai_orchestration_kiota.generated.models.predict_request import ( + PredictRequest, + ) + from gen_ai_hub.tab_ai_orchestration_kiota.generated.models.context_selection_config import ( + ContextSelectionConfig, + ) + + async with KiotaTabAiOrchestrationClient(model_name="sap-rpt-1.5") as client: + body = PredictRequest() + context_config = ContextSelectionConfig() + body.context_selection_config = context_config + result = await client.generated.predict.post(body) + return {"result": result} diff --git a/uv.lock b/uv.lock index e7b0f3e3..16c5a08d 100644 --- a/uv.lock +++ b/uv.lock @@ -24,6 +24,8 @@ members = [ "sap-ai-sdk-base", "sap-ai-sdk-core", "sap-ai-sdk-gen", + "sap-kiota-generator", + "sap-openapi-generator", ] [[package]] @@ -1241,6 +1243,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, ] +[[package]] +name = "h2" +version = "4.4.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "hpack" }, + { name = "hyperframe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e7/85/7c366e69d84c17bb778fe41419e1fbcce3033d5b7ce29bbffff0a98b859f/h2-4.4.1.tar.gz", hash = "sha256:4e866ffb1a869ae14dd9b5e6beb5c24a13da0495ad72b65925ded182521c1516", size = 2157281, upload-time = "2026-08-03T11:45:09.509Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/22/e85faf23bd72a92d1921e37d674ca56eb298a3c8be31fdecef0ff2b3aaac/h2-4.4.1-py3-none-any.whl", hash = "sha256:0e25f1462b23c9cb82d9eb02e28bc706dac2a68cb457c6a0d74d63c8a2a5d0e6", size = 62636, upload-time = "2026-08-03T11:44:59.164Z" }, +] + +[[package]] +name = "hpack" +version = "4.2.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/26/5b/fcabf6028144a8723726318b07a32c2f3314acdff6265743cf08a344b18e/hpack-4.2.0.tar.gz", hash = "sha256:0895cfa3b5531fc65fe439c05eb65144f123bf7a394fcaa56aa423548d8e45c0", size = 51300, upload-time = "2026-06-23T18:34:46.667Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/71/b4/4a9fcfb2aef6ba44d9073ecd301443aa00b3dac95de5619f2a7de7ec8a91/hpack-4.2.0-py3-none-any.whl", hash = "sha256:858ac0b02280fa582b5080d68db0899c62a80375e0e5413a74970c5e518b6986", size = 34246, upload-time = "2026-06-23T18:34:45.472Z" }, +] + [[package]] name = "httpcore" version = "1.0.9" @@ -1269,6 +1293,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" }, ] +[package.optional-dependencies] +http2 = [ + { name = "h2" }, +] + [[package]] name = "httpx-sse" version = "0.4.3" @@ -1278,6 +1307,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d2/fd/6668e5aec43ab844de6fc74927e155a3b37bf40d7c3790e49fc0406b6578/httpx_sse-0.4.3-py3-none-any.whl", hash = "sha256:0ac1c9fe3c0afad2e0ebb25a934a59f4c7823b60792691f779fad2c5568830fc", size = 8960, upload-time = "2025-10-10T21:48:21.158Z" }, ] +[[package]] +name = "hyperframe" +version = "6.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/02/e7/94f8232d4a74cc99514c13a9f995811485a6903d48e5d952771ef6322e30/hyperframe-6.1.0.tar.gz", hash = "sha256:f630908a00854a7adeabd6382b43923a4c4cd4b821fcb527e6ab9e15382a3b08", size = 26566, upload-time = "2025-01-22T21:41:49.302Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/48/30/47d0bf6072f7252e6521f3447ccfa40b421b6824517f82854703d0f5a98b/hyperframe-6.1.0-py3-none-any.whl", hash = "sha256:b03380493a519fce58ea5af42e4a42317bf9bd425596f7a0835ffce80f1a42e5", size = 13007, upload-time = "2025-01-22T21:41:47.295Z" }, +] + [[package]] name = "idna" version = "3.18" @@ -2066,6 +2104,83 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, ] +[[package]] +name = "microsoft-kiota-abstractions" +version = "1.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "opentelemetry-api" }, + { name = "opentelemetry-sdk" }, + { name = "std-uritemplate" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/81/37/de6a378d24c64a3c5098cfbd8d80249941e7574d5cda1dd1f222fb38bb1c/microsoft_kiota_abstractions-1.12.2.tar.gz", hash = "sha256:3b18e6077868adcdabf8597a0f8f800f4b7fe30b6622189a199da29c007ade15", size = 25576, upload-time = "2026-09-10T19:55:33.602Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/af/9f1ad2ab81cdac4bce10118db728dd84ac7dbda5eea082e301b061138f8f/microsoft_kiota_abstractions-1.12.2-py3-none-any.whl", hash = "sha256:79f480f26c8682c819a28d24b98552e2a9a5ede50dde23dcd5ff9c1fad1f4201", size = 44688, upload-time = "2026-09-10T19:55:41.299Z" }, +] + +[[package]] +name = "microsoft-kiota-http" +version = "1.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "httpx", extra = ["http2"] }, + { name = "microsoft-kiota-abstractions" }, + { name = "opentelemetry-api" }, + { name = "opentelemetry-sdk" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/14/ee/9f47056a3d6dbd685b57f6dc1d237920ef05b7c602261d940feff887b070/microsoft_kiota_http-1.12.2.tar.gz", hash = "sha256:1456dea9136145050a5e4cd641af1faa465008a2bc9f09ca63318a312be1c107", size = 22551, upload-time = "2026-09-10T19:55:36.473Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a9/4d/4f99282ea28d8eed394747c67a3e44fc5cdf3facad7a595316c4998031c7/microsoft_kiota_http-1.12.2-py3-none-any.whl", hash = "sha256:ae6ccc92a5988a658ca985b259668870a9d71d7b0b5f4a97d2ad52f3068ba571", size = 32073, upload-time = "2026-09-10T19:55:44.202Z" }, +] + +[[package]] +name = "microsoft-kiota-serialization-form" +version = "1.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "microsoft-kiota-abstractions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/22/4e/42a875feef4f57ba16103087daa585919464289c01f413d1085cbeb9b768/microsoft_kiota_serialization_form-1.12.2.tar.gz", hash = "sha256:f733abd141ae3c7e2704f436efacf4171036a6b1eeb3ff597b7470138b386841", size = 9181, upload-time = "2026-09-10T19:55:37.472Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/24/89/870e31f792fb87c17130eb3e0443f9fdab35c037c5e539e8ea0c20cb9c75/microsoft_kiota_serialization_form-1.12.2-py3-none-any.whl", hash = "sha256:791f81f50146a99e4020b855c1cde18960ef3decf791fa986258fb453cc9e12e", size = 10882, upload-time = "2026-09-10T19:55:45.123Z" }, +] + +[[package]] +name = "microsoft-kiota-serialization-json" +version = "1.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "microsoft-kiota-abstractions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/af/75/ec38886b601d6dc5640f6d86163b9e2ffa22d375a422349a5dbc085a2d32/microsoft_kiota_serialization_json-1.12.2.tar.gz", hash = "sha256:a8a749aed369b5775965668f0636d5bc9acbff1adcdd090d7d6baeff0dcf1ac9", size = 10171, upload-time = "2026-09-10T19:55:38.315Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4c/7b/fe68383fc4d61fa6f08f9cc45bc981cab6697a8eec1e4298e5eb965320dc/microsoft_kiota_serialization_json-1.12.2-py3-none-any.whl", hash = "sha256:db6dedfdd37a51dceb83fceec04d22ccabf4bc6f3955dc211eba12e024b821a9", size = 11808, upload-time = "2026-09-10T19:55:46.181Z" }, +] + +[[package]] +name = "microsoft-kiota-serialization-multipart" +version = "1.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "microsoft-kiota-abstractions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e3/3d/6d88d3954b90ce5287c5930c219f878d866d845ee4125d9c6d314f951873/microsoft_kiota_serialization_multipart-1.12.2.tar.gz", hash = "sha256:d35b81f7c076c4d2bc1b5a124ff73648b66ab323924a45df9a7d30252daf1ca8", size = 5111, upload-time = "2026-09-10T19:55:39.236Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7f/00/1bf26f3098fa0b4b56e60368fa7a3175c0cd71229fc096cb1703ab42a5e2/microsoft_kiota_serialization_multipart-1.12.2-py3-none-any.whl", hash = "sha256:bbf064acc2442bd93d09ea916d90b5f9ebaeb9a871ec46dcb6556936d73d4667", size = 6702, upload-time = "2026-09-10T19:55:47.035Z" }, +] + +[[package]] +name = "microsoft-kiota-serialization-text" +version = "1.12.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "microsoft-kiota-abstractions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/6e/c3/62e185aed661f0dd11cce9283ca59a0b23d47b7379d75185d7191b933e6c/microsoft_kiota_serialization_text-1.12.2.tar.gz", hash = "sha256:df88c01cb52f374ee13bebafc6330b91ad5a77b5b4249962bcbb2fe754b6ea6e", size = 7362, upload-time = "2026-09-10T19:55:40.244Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9c/c8/07751219f694644276930194fce25e04b39c897af10ff67af778c1fe8e4c/microsoft_kiota_serialization_text-1.12.2-py3-none-any.whl", hash = "sha256:05e3e8d84715f9709a59e6771e876d9f7f64edca9070122c9ec3ef04a0a56498", size = 8895, upload-time = "2026-09-10T19:55:47.884Z" }, +] + [[package]] name = "multidict" version = "6.7.1" @@ -2548,6 +2663,45 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b1/ca/53357e460a1172e831ecbe43dd0c37342b7211a1eb09f4cf21a412adbbdf/openai-2.49.0-py3-none-any.whl", hash = "sha256:b694201eaa42a1ccf2aa125fe29458150108fb22df1abfb55d7188599da81d8c", size = 1648589, upload-time = "2026-07-27T22:51:38Z" }, ] +[[package]] +name = "opentelemetry-api" +version = "1.44.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ee/8b/aa9e2d8b8dfa7c946f7dec5d1f8f6ba8eca062f43509a06bdb5ce93d26c0/opentelemetry_api-1.44.0.tar.gz", hash = "sha256:67647e5e9566edcf421166fdf022b3537f818635daa852b289e34604dc6fb33a", size = 72406, upload-time = "2026-07-16T15:25:32.678Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ca/6f/a04e900f465ff3221ccc395522503e2d10e79fa21f2723c8e177aae1e0d1/opentelemetry_api-1.44.0-py3-none-any.whl", hash = "sha256:94b98c893a91b88657eaac1e3ba89618cdb85be6918196705354f34728b2cdef", size = 60018, upload-time = "2026-07-16T15:25:11.657Z" }, +] + +[[package]] +name = "opentelemetry-sdk" +version = "1.44.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "opentelemetry-api" }, + { name = "opentelemetry-semantic-conventions" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5d/77/a6592cbc7c8d9bcc9d6757a9df45e04a7c585e3e6e7a13456da522b21109/opentelemetry_sdk-1.44.0.tar.gz", hash = "sha256:cebe7f65dc12f26ead75c6064de12fd2a9052e5060c0272d402cfa203aae123b", size = 208624, upload-time = "2026-07-16T15:25:46.078Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e7/23/ff077e61886ee020a17ce9c8b6fa11c601c8d8345b09ea24f605445df62a/opentelemetry_sdk-1.44.0-py3-none-any.whl", hash = "sha256:df081c4c6bcfdb1211e3e86140376792643128a25f8d72d1d27675936e7e96ad", size = 137221, upload-time = "2026-07-16T15:25:29.534Z" }, +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.65b0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "opentelemetry-api" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8f/73/0cbdebcb4cf545fdd328da14f5137e37d0770c3f26185e478b0d15d94f50/opentelemetry_semantic_conventions-0.65b0.tar.gz", hash = "sha256:f9b2b81e9d5b64f11bc952075e7e9c7fb0aab075c7fd1c46d597f1b919852d60", size = 148774, upload-time = "2026-07-16T15:25:46.902Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a6/0e/49df70d9b81fb5cbae4bbf2a49d865b09bcbcbc4eb53f5851b1027738d78/opentelemetry_semantic_conventions-0.65b0-py3-none-any.whl", hash = "sha256:1cacde7b0ad306f84c5ef08c3dbe1bbaf20165bba6f8bff43b670e555a086bcb", size = 204645, upload-time = "2026-07-16T15:25:30.688Z" }, +] + [[package]] name = "orjson" version = "3.11.9" @@ -4253,6 +4407,14 @@ google = [ { name = "google-genai" }, { name = "langchain-google-genai" }, ] +kiota = [ + { name = "microsoft-kiota-abstractions" }, + { name = "microsoft-kiota-http" }, + { name = "microsoft-kiota-serialization-form" }, + { name = "microsoft-kiota-serialization-json" }, + { name = "microsoft-kiota-serialization-multipart" }, + { name = "microsoft-kiota-serialization-text" }, +] [package.dev-dependencies] dev = [ @@ -4287,6 +4449,12 @@ requires-dist = [ { name = "langchain-google-genai", marker = "extra == 'google'", specifier = "~=4.3.1" }, { name = "langchain-openai", specifier = "~=1.6.0" }, { name = "langcodes", specifier = "~=3.5.1" }, + { name = "microsoft-kiota-abstractions", marker = "extra == 'kiota'", specifier = ">=1.4.0" }, + { name = "microsoft-kiota-http", marker = "extra == 'kiota'", specifier = ">=1.3.0" }, + { name = "microsoft-kiota-serialization-form", marker = "extra == 'kiota'", specifier = ">=1.1.0" }, + { name = "microsoft-kiota-serialization-json", marker = "extra == 'kiota'", specifier = ">=1.1.0" }, + { name = "microsoft-kiota-serialization-multipart", marker = "extra == 'kiota'", specifier = ">=1.1.0" }, + { name = "microsoft-kiota-serialization-text", marker = "extra == 'kiota'", specifier = ">=1.1.0" }, { name = "openai", specifier = ">=1.66.0" }, { name = "overloading", specifier = "==0.5.0" }, { name = "packaging", specifier = ">=23.2" }, @@ -4295,7 +4463,7 @@ requires-dist = [ { name = "sap-ai-sdk-core", editable = "packages/core" }, { name = "sap-ai-sdk-gen", extras = ["google", "amazon"], marker = "extra == 'all'", editable = "packages/gen" }, ] -provides-extras = ["google", "amazon", "all"] +provides-extras = ["google", "amazon", "all", "kiota"] [package.metadata.requires-dev] dev = [ @@ -4313,6 +4481,56 @@ dev = [ { name = "sphinxawesome-theme" }, ] +[[package]] +name = "sap-kiota-generator" +version = "0.1.0" +source = { editable = "packages/kiota-generator" } +dependencies = [ + { name = "pyyaml" }, + { name = "sap-openapi-generator" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-cov" }, +] + +[package.metadata] +requires-dist = [ + { name = "pyyaml", specifier = ">=6.0" }, + { name = "sap-openapi-generator", editable = "packages/openapi-generator" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.0" }, + { name = "pytest-cov", specifier = ">=5.0" }, +] + +[[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" @@ -4585,6 +4803,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c8/cb/6a6a47d5b464bd08695d254f3da6e7986cc70c9fa5d778eda57538edfe56/starlette-1.6.0-py3-none-any.whl", hash = "sha256:a86dd39d14bb45f85a3d18525215a9ef0cfd1f192ac793220e72598c90335f0c", size = 75969, upload-time = "2026-08-08T18:27:56.196Z" }, ] +[[package]] +name = "std-uritemplate" +version = "2.0.12" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7a/f8/8f2b708394a6371e9b0e1cabdaf1be314f6b28c3697786a0a7e5f31ee9bf/std_uritemplate-2.0.12.tar.gz", hash = "sha256:c245e6d9c6804e435c45fa94ee4a3c8a57e08aeeb45af261101cb0d513964534", size = 6557, upload-time = "2026-07-16T11:04:14.654Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/53/9b/77a4936805a7853189ca040b698f7c8d6a1d4ca88c09a880a95b8d544d6a/std_uritemplate-2.0.12-py3-none-any.whl", hash = "sha256:42b702d8d7eb8c13b586c527b8f2edaff456b69fee88e817d2f5dc5f088b8765", size = 7095, upload-time = "2026-07-16T11:04:15.43Z" }, +] + [[package]] name = "tabulate" version = "0.10.0"